User manual

The WebMux™ Model 480S, 580SG, and 680PG User Guide – Version 7.0.x
Appendix 5 – Sample Custom CGI Code
The custom cgi-bin checking program may be written in Java, VB, C, or Perl, for
example, or it may be a WB or shell script. Here is sample script written for the
linux shell bash which sees if an SSH daemon is running as its check criterion.
#!/bin/bash
echo "Content-type: text/plain"
echo # blank line
if ps -C sshd &>/dev/null ; then
echo "OK" # response from server goes here, see list below.
echo "SSH service available"
else
echo "NOT OK"
echo "SSH daemon not running"
fi
The following is a list of valid CGI code responses:
OK - server is alive, no weight change
OVERLOAD - set weight to 0, to quiesce (same as “WEIGHT=0”)
QUIESCE - set weight to 0, to quiesce (same as “WEIGHT=0”)
WEIGHT=n - set weight to integer n
WEIGHT-=n - subtract integer n from the weight
WEIGHT+=n - add integer n to the weight
The response must be in all capitals to be recognized. The changes in weight
count as an unsaved configuration change. It is not automatically saved.
Copyright© 1997-2005 CAI Networks, Inc.
85