snmpmon - A daemon for monitoring remote hosts via SNMP
# 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
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:
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.
snmpmon --delete <name>
Removes the machine name from the list of routers in ~etc_dir~/configuration.
snmpmon --list
This reads a list of all routers from the config file and prints it to STDOUT.
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
Run in debugging mode
Read the monitor configuration from <file>, defaults to ~etcdir~/configuration.
~etcdir~/configuration
Use syslog facility <f> for logging messages; this defaults to ~facility~, but you can override it in the config file.
By default the program will detach from the shell and run in the background. However, for debugging purposes it is important to suppress this.
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).
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.
~etc_dir~/configuration The programs config file.
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.
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: $!"; }
To install SNMP::Monitor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SNMP::Monitor
CPAN shell
perl -MCPAN -e shell install SNMP::Monitor
For more information on module installation, please visit the detailed CPAN module installation guide.