HP ProLiant DL380G5-WSS 3.7.0 HP StorageWorks HP Scalable NAS File Serving Sof - Page 346
Types of custom scripts, Probe scripts
View all HP ProLiant DL380G5-WSS manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 346 highlights
Types of custom scripts You can develop the following types of custom scripts for use with service and device monitors. Probe scripts Probe scripts run periodically and check the health of a service or device. You will need to determine what the probe should look at and how it should exit. For example, you might want to create a custom service monitor for an application that creates a pid file when it is running. You could write a shell script called /usr/local/myprobes/testpid that looks up the pid from the application's pid file and then determines whether the pid is actually running. Here is the testpid script: if [ ! -e $1 ]; then # Does the pid file exist? exit 1 fi read pid < $1 # Read the pid into the variable pid kill -0 $pid # Does the pid exist in the process table? When you create the service monitor, you would specify the following as the user probe script. (Specifying the application's pid file as a parameter instead of naming it in the script allows the testpid script to be used with any application that creates a pid file.) usr/local/myprobes/testpid /var/run/application.pid When the monitor executes the testpid script, it will first determine whether the / var/run/application/pid file exists. If the file does not exist, the script exits with a non-zero exit status, which the monitor interprets as a failure. If the file does exist, the script reads the pid from the file into the variable pid. The kill command then determines whether the pid is running. The exit status of the kill command is the exit status of the script. If the kill command finds that the pid is running, it will exit with status 0, and the script will exit with status 0. The monitor will interpret the 0 exit status as "success" and will signal to the cluster that the application is up. If the kill command finds that the pid is not running, it will exit with a non-zero status, and the script will exit with that same status. The monitor will interpret that exit status as "failure," which will signal the monitor that the application is down. HP Scalable 346 Advanced monitor topics