3.5.1 Matrix Server Administration Guide
Chapter 17: Advanced Monitor Topics 271
Copyright © 1999-2007 PolyServe, Inc. All rights reserved.
• For a service monitor, the file must be installed on each server
associated with the virtual host on which the service monitor is
located.
• For a device monitor, the file must be installed on each server that is
configured with the virtual hosts associated with the device monitor.
• The command termination exit status is used to signal script success
or failure. A 0 (zero) exit status indicates script success; any other exit
status indicates script failure.
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