Hitachi

uCosminexus Application Server HTTP Server User Guide


E.3 Creating a monitoring script

When you want HTTP Server to be monitored by HACMP for AIX, you need to create a script that monitors HTTP Server and store it in the monitor method. This script must return 0 when HTTP Server is working normally and return a value other than zero when a problem is detected.

In HTTP Server, the execution command differs from the process that actually provides services. For the server to be monitored by HACMP for AIX, create a script that can actually monitor the process.

However, if the server is not monitored, or operation is only within the local node, you do not need to create scripts.

The following example shows how to write a shell script for monitoring HTTP Server behavior. The sample script returns 0 when HTTP Server is working normally, and returns a value other than zero when a problem is detected.

(Example)

The script returns 0 if a process ID stored in the file specified with the PidFile directive is running, and returns 1 if it is not running.

#!/bin/sh
 
 
HWSIDFILE=/opt/hitachi/httpsd/logs/httpd.pid
if [ ! -e $HWSIDFILE ]
then
        exit 1
fi
 
HWSID=`cat $HWSIDFILE`
if [ x$HWSID = "x" ]
then
        exit 1
fi
 
STATUS=`ps -p $HWSID | grep $HWSID | awk '{print $1}'`
 
if [ x$STATUS = "x" ]
then
        exit 1
else
        exit 0
fi
Organization of this subsection

(1) Notes

HTTP Server provides a process that controls a group of processes that handle requests (see 4.1 Relationship between processes and directives of HTTP Server). In the example above, the script monitors whether the control process is running. The script does not monitor the behavior of the processes that handle requests.