Next: todo | Previous: spong.message | [Table of Contents] | [Index] |
spongfaq - frequently asked questions about Spong ($Revision: 1.4 $, $Date: 2001/01/05 20:50:01 $)
This document contains a list of the most Frequently Asked Questions (FAQ) about Spong. It is really not a HOWTO, but is in a classical Question / Answer form.
This is hopefully a simple tool. It does not compete with Tivoli, OpenView, UniCenter, or any other commercial packages, and I have no intention of trying to turn it into one. It is not SNMP based, it communicates via simple TCP based messages. It is written in Perl, so hopefully it can be run on multiple systems
It has the following features:
client based monitoring (CPU, disk, processes, logs, etc...)
monitoring of network services (smtp, http, ping, pop, dns, etc...)
grouping of hosts (routers, servers, workstations, PCs)
rules based messaging when problems occur
configurable on a host by host basis
results displayed via text or web based interface
history of problems
verbose information to help diagnosis problems
If your spong-client is setup and runs properly (i.e. spong-client --debug shows that the checks are being run and the results are being sent to the spong-server). Depending on how your server is setup, the full domain name of your host may not returned with the code that spong-client uses.
The spong-server has a bit of security for status update messages. The host name in the status message must match a host name defined in the spong.hosts files. spong-client uses the gethostbyname() function to try to resolve the host's full name. If it just gets the host name without the domain, spong-server will quietly reject and drop the message.
You can run the perl snippet below to determine what host name that spong-client is resolving for the machine it is running on. perl -MSys::Hostname -e \ '($h) = (gethostbyname(Sys::Hostname::hostname()))[0]; print "$h\n"'
It should print out you the fully qualified domain name of your system. This should match the hostname configured in the song.hosts file on the spong-server machine. If they don't match then you can do 1 of 2 things.
In your hosts file make use that the full domain name is the first name of your host's line. i.e. 192.168.2.34 my-host.inkcom.com my-host
Or put if your system is in your DNS server properly, make sure that 'dns' is in front of 'file' on the hosts: line of the /etc/nsswitch.conf file.
There a utility gethost-test in the /utils/
directory of
the Spong distribution. You can run it on a machine to make sure that it
is setup correctly to resolve it's full quality domain name. The utility
is run by enter the following command perl gethost-test
.
If none of the above works or can't make the changes, you still have one last
resort. The spong.conf
and spong.conf.<hostname>
file are loaded
after the $HOST variable is assigned. That mean that you can override the
calculated $HOST hostname. Just added at '$HOST = "desired host name";'
statement in either of the spong.conf
or spong.conf.<hostname>
files.
The most important thing is to go through the the spong.conf manpage, the spong.hosts manpage, and the spong.message manpage configuration files. And be sure to read the documentation for the spong.conf manpage, the spong.hosts manpage the spong.message manpage, configuration files and the the spong-message manpage and the spong-server manpage programs.
If you are still having problems, follow the check list below to help resolve your problem.
$SEND_MESSAGE in spong.conf
In spong.conf make sure the $SEND_MESSAGE is set to 'RED', 'CHANGE' or 'RED-CHANGE'.
$RULES_MATCH in spong.conf
In spong.message make sure that $RULES_MATCH is set to 'ALL' or 'FIRST-MATCH'. If you set it to 'OLD', spong-message will revert to the old notification method in Spong 2.0 - 2.1.
Messaging rules in spong.message
If your are having problems with defining your rules, put in a very minimal rules set. $MESSAGING_RULES = [ { contacts => [ 'sjohnson' ] }, ];
This will send everything to the 'sjohnson' contact.
%HUMANS in spong.hosts
In spong.hosts, you must define at least one contact (the %HUMANS in spong.hosts) in order to have any notifications sent. For the example rule setup above, to get e-mail sent to that user you can have an entry like: %HUMANS = ( 'sjohnson' => { name => 'Stephen Johnson', email => 'stephen.johnson@mailhost.at.my.com', }, );
Testing messaging rules
If you have a problem with your messaging rules, The spong-message program has a debugging and test mode. These modes will allow you to check, test and tweak your messaging rules in spong.message.
Run the spong-message program from a command line as follows: spong-message --debug --test color host service `perl -e "print time()"` \ 'This is a test.'
The --debug flag will output a large amount of detailed output about what the program is doing. The --test flag if the test mode flag. Spong-message will do everyting but send out the notifications.
color = status color - green, yellow, or red hostname = a hostname from your spong.hosts file service = a service name that you are testing.
The back-ticked perl expression just prints the current system time in epoch format. And the "The is a test." field is the summary message from a status update message.
The --debug output is very detailed about every step that the spong-message program is doing. You may need to redirect the output to a file in order to look at.
Spong Message will detail step-by-step all of the matched it attempts and the resultsand actions of those matches. It will refer to rules by an index number starting with the number zero (0) for the first rule.
To test days and times ranges your will need to caculate a specific date/time into an epoc or calender time format to feed it to spong-message. You can use this short perl code snippet to do it. perl -MPOSIX -e 'print mktime( sec, min, hour, day, (month - 1) , \ (year - 1900) ), "\n"'
The time is in 24 hour format and the year is the 4 digit year. This will print a large number. Use the number in place of the back-ticked perl expression on spong-message command.
Testing with spong-server
The best way to test everything to set $SEND_MESSAGE to 'CHANGE' and run spong-server in debug mode with a debug level of at least 3 (i.e. spong-server --debug 3 ). This will cause spong-server to call spong-message for every chagne in status of any host . And spong-server will call spong-message in debug mode also. This will let you see everying that spong-server and spong-message is doing. You will see spong-server say something like "change in state to red messaging a human." in it's debug output when it is sending out notifications.
Once you have your single contact / single messaging rule configuration working. Change $SEND_MESSAGE to what you desire. And then start adding in more messaging rules and contacts. But continue testing your spong.message config file as described above (see "Testing Messaging Rules").
Copyright (c) 1999-2000 Stephen L Johnson