Next: spong.message | Previous: spong.groups | [Table of Contents] | [Index] |
spong.hosts - define hosts and services to monitor
The spong.hosts
file defines two things. 1) The hosts you want to monitor
(and the attributes associated with each host), and 2) The humans that will
be contacted when a given host has problems (and the attributes associated
with each human).
Each host should have the following attributes associated with it:
Optionally, the follow attributes can also be assigned to a host:
The services attribute is a string listing the network modules to run against the host separated by spaces. The list of network modules included with Spong is constantly growing, but they include ``dns'' , ``ftp'', ``smtp'', ``http'', ``imap'', ``pop3'', ``nntp'', ``nfs'',``ntp'' and ``ssh''. The list can include any addition network checks that you have developed (see the spong-network entry elsewhere in this document and the developer-guide entry elsewhere in this document for more details) . Any host listed is automatically checked for network connectivity (via ping). The meta-service ``noping'' can be included in the list of modules to cause spong-network to skip the ``ping'' test.
Service names in services can be flagged to skip the remaining checks if it fails. The tests that are slipped are flagged with a special "clear" status color. The "clear" status mean they have not been checked due special circumstances. The service name is flagged by appending a colon (":") on the end of the service name. For example: 'myhost.org' => { 'services' => 'ping: ftp smtp' },
Skip the 'ftp' and 'smtp' checks if the 'ping' check fails.
The down, down:servicename attributeis are a list of ``downtimes''. It is a list (well reference to one anyway) of one or more strings in the following format - ``d:hh:mm-hh:mm''. ``d'' is the day of the week (0-6, 0 = Sunday, 6 = Saturday), if ``d'' is ``*'', then every day of the week is matched. The string to the right of the day is the start and end time of the down time in 24 hour format
The ip_addr attribute is a list (well reference to one anyway) of IP address that the machine responds to.
The skip_network_checks flag be used to temporarily disable the network checks for one or more hosts. The hosts can stll received spong-client status updates. And the historical network information for the hosts is available. This is useful when the hosts are being renamed or re-networked over an extended period of time.
Additional attributes can be added into %HOSTS entries. These attributes can be used for any external program or additional modules that you have added to your Spong installation. All of the Spong programs will ignore any attributes that they don't recognize.
Each human that is defined should have the following attributes associated with it:
And zero or more of the following attributes assigned to each human for messaging when there are problems:
These attributes are messaging modules names for sending out notifications to people. All of the messing modules are loaded by spong-message as a plug-in modules. The attributes listed above are the messaging modules that are part of the current Spong distribution. New messaging modules can be easily be developed. See the spong-message entry elsewhere in this document and the the developer-guide entry elsewhere in this document for more details).
The group attribute designates a group contact. It is a string that holds a list of one or more %HUMANS entries seperated by spaces or comma. The the spong-message entry elsewhere in this document program will expand each entry in the group attribute to a seperate contact in the current the spong.message manpage file context. For example: spong.hosts: %HUMANS = ( 'bob' => { name => 'Bob Smith', email => 'bob@example.com', }, 'ray' => { name => 'Ray R.', pager => '8145551234', } 'admins' => { name => 'Unix Admins', group => 'bob,ray' }, ); spong.message: $MESSAGING_RULES = [ { hosts => ['dns.*'], services => ['dns'], contacts => [ { rcpts='admins', delay => 600, repeat=> 600 } ], }, ];
If the $MESSAGEING_RULES rule triggers, it will add 'bob' and 'ray' as contacts with attributes of 'delay => 600' and 'repeat => 600'.
The spong.conf
file is simply Perl code that gets imported by each spong
program, so the only real format restrictions is just what is syntactically
correct in Perl (which some would say is anything 8-).
What is expected in this file are the definitions for two hashes of hashes (in Perl speak). The %HOSTS hash, and the %HUMANS hash. If you are not comfortable with Perl lingo, then just think of them as stanza definitions.
First, the HUMANS. The following describes the <%HUMANS> hash. %HUMANS = ( [stanza], [stanza], [stanza] );
where [stanza] is a second hash, that looks like the following: 'unix-staff' => { name => 'Midrange On-call Staff', email => 'unix-staff@school.edu', skytel => '1234567' },
What this says is that the 'unix-staff' human has the following attributes (name = Midrange On-call Staff, email = unix-statff@school.edu, skytel = 1234567).
Now, the HOSTS. The following describes the %HOSTS hash. %HOSTS = ( [stanza], [stanza], [stanza] );
where [stanza] is a second hash, that looks like the following: 'www.uiowa.edu' => { services => 'ftp smtp http', ip_addr => ['192.168.15.2','10.2.124.200'], down => [ '*:0015-0030','6:23:00-23:59'] },
What this says is that the 'www.uiowa.edu' host has the following attributes (services = ftp smtp http; ip address=192.168.15.2 and 10.2.124.200; and down time of 12:15AM-12:30AM every day and from 11:00PM-12:00PM on Saturdays).
I know the format can be a little odd at first, but I chose it because of both its simplicity to work with in the code (I don't have to parse anything - Perl does all the work), and because it is easy to extend - adding additional attributes is quite straightforward.
Here are some lines from our spong.hosts file to show you possible configurations. %HUMANS = ( 'unix-staff' => { name => 'Midrange On-call Staff', email => 'admin-staff@school.edu', }, 'edhill' => { name => 'Ed Hill', email => 'ed-hill@school.edu', skytel => '1234567' }, ); %HOSTS = ( 'strobe.weeg.school.edu' =>; { services => 'dns ftp smtp http', ip_addr => [ '192.168.15.2', '10.2.124.200' ], down => [ "*:05:30-06:30", "0:00:00-04:00 ] }, 'www.school.edu' => { services => 'ftp smtp http' }, );
the spong-server entry elsewhere in this document, the spong-network entry elsewhere in this document, the spong-message entry elsewhere in this document
Ed Hill <ed-hill@uiowa.edu
>, Unix System Administrator, The University of
Iowa
Stephen L Johnson <sjohnson@monsters.org
>
Based on code/ideas from Sean MacGuire (BB), and Helen Harrison (Pong). Ed Hill original converted Big Brother (http://www.bb4.com) into Perl which diverged from Big Brother to become Spong. Ed Hill continued Spong development until version 2.1. Stephen L Johnson took over development in October, 1999 with his changes which became Spong 2.5.