Author image Jochen Wiedmann

NAME

snmpmon - A daemon for monitoring remote hosts via SNMP

SYNOPSIS

    # Add router <name> to the list of items being monitored
    snmpmon --add <name> [options]

    # Remove router <name> from the list of items being monitored
    snmpmon --delete <name> [options]

    # List all routers being monitored
    snmpmon --list [options]

    # Start the monitor;
    snmpmon --start [options]
    # You might prefer this version for /etc/rc2.d
    snmpmon start
    
    # Stop the monitor
    snmpmon --stop [options]
    # ... and this one for /etc/rc2.d
    snmpmon stop

DESCRIPTION

The SNMP monitor is a simple tool for monitoring remote routers via SNMP. Usually it runs in the background, sending SNMP queries to the routers, logging interface loads or taking action upon interface state changes. What the program does, depends on the following command line options:

Adding a router to the list of routers

    snmpmon --add <name>

Adds a new machine to the list of routers being monitored. The name is a symbolic name, unique within the list. The program will invoke the SNMP::Monitor::Install::AddRouter method for you which prompts you a lot of questions so that a raw configuration of the monitor can be created.

The router list is stored in the configuration file, ~etc_dir~/configuration.

Removing a router from the list of routers

    snmpmon --delete <name>

Removes the machine name from the list of routers in ~etc_dir~/configuration.

Printing a list of all routers

    snmpmon --list

This reads a list of all routers from the config file and prints it to STDOUT.

Starting the monitor

    snmpmon --start [options]
    snmpmon start [options]

This will start a monitor session; you usually do this when the system comes up. Available options are in particular

--debug

Run in debugging mode

--config <file>

Read the monitor configuration from <file>, defaults to ~etcdir~/configuration.

--facility <f>

Use syslog facility <f> for logging messages; this defaults to ~facility~, but you can override it in the config file.

--nodetach

By default the program will detach from the shell and run in the background. However, for debugging purposes it is important to suppress this.

--pidfile <file>

When the program has detached from the shell, it stores it's PID in the given file, by default ~pid_file~ (overridable in the config file).

Stopping the monitor

    snmpmon --stop [options]
    snmpmon stop [options]

Called for shutting the monitor down. The pidfile is used for guessing the monitor's PID. If such a file doesn't exist or no process with the given PID is available, the program attempt's to find a running monitor by looking into the process list.

FILES

~etc_dir~/configuration The programs config file.

AUTHOR AND COPYRIGHT

This program is

    Copyright (C) 1998    Jochen Wiedmann
                          Am Eisteich 9
                          72555 Metzingen
                          Germany

                          Phone: +49 7123 14887
                          Email: joe@ispsoft.de

All rights reserved.

You may distribute this module under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

SEE ALSO

SNMP::Monitor(3), SNMP(3), SNMP::Monitor::Install(3)

EOF

require SNMP::Monitor; my $config = SNMP::Monitor->Configuration('configuration');

require Config; $config->{'startperl'} = $Config::Config{'startperl'}; $config->{'startperl'} = $Config::Config{'startperl'}; # Make -w happy ...

$script =~ s/\~(\w+)\~/$config->{$1}/eg;

if (!open(FILE, ">snmpmon") || !print FILE ($script) || !close(FILE)) { die "Error while writing snmpmon script: $!"; }