SNMP::Monitor::Install - Create a config file for SNMP::Monitor module
require SNMP::Monitor::Install; # Create a new config file SNMP::Monitor::Install->Install($file, $prefix); # Save a config file SNMP::Monitor::Install->Save($file, $config);
This module is used to create config files for the SNMP::Monitor module. It offers class methods for creating new files and adding hosts. It tries to guess system defaults and queries the user for settings.
All methods throw a Perl exception in case of errors.
(Class method) This method is called to create a completely new config file. It suggests the prefix $prefix as a default for directory locations and stores the configuration in the file $file.
$prefix
$file
(Class method) Saves the configuration $config in the file $file.
$config
The configuration file is created by the Data::Dumper module. See Data::Dumper(3). This means that it contains valid Perl source: You have both the restrictions that Perl puts on you and the full power of Perl available.
However, the first thing to keep in mind when manually editing the file is: Do yourself a favour and let Perl do a syntax check for you by executing
perl -e 'require "/etc/snmpmon/configuration"; print "ok\n"'
In general, the configuration file contains a hash ref, thus a lot of key/value pairs. Available keys include:
The DSN, user name and password for accessing the database.
The administrators email address. Messages will be sent to this address. It is overridable in the router and interface configuration. Multiple, comma separated recipients can be used.
Path to the directory where the configuration file is stored.
configuration
The syslog facility to use for syslog messages, by default daemon.
daemon
An hash ref routers that are being monitored, in other words: Yet more key/value pairs, the keys being router names and the values being router configurations.
See "Router configuration" below for a description of the values.
The paths to the gnuplot and ppmtogif binaries
Path of the PID file. By default /var/run/snmpmon.pid.
/var/run/snmpmon.pid
A list of users that may view information. Can be overwritten in the router or interface configuration.
For any router in the list of routers an SNMP::Session instance will be created. Thus the router is configured by a hash ref of key/value pairs that merely describe the SNMP session:
The community string being used for accessing the routers SNMP server; defaults to public.
public
A one line description of the router, from time to time being used in output.
The routers host name (resolvable via DNS) or IP address.
This attribute, if present, overrides the global email attribute.
email
A list of interfaces being available at the router. Configuring an interface here doesn't necessarily mean, that a session is watching this interface. For example, you definitely don't want to receive an email any time when a dialup line goes up or down. :-)
See "Interface configuration" below for a detailed description of interfaces.
A short, unique name of the router. This name is used for identifying the router in the database, thus it has to be short (10 characters).
The service name or port number where the routers SNMP server is listening. Defaults to 161.
161
A list of users that may view information about this router. Can be overwritten in the interface configuration.
Interfaces are yet more key/value pairs, the keys being:
The interface number, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifDescr.
interfaces.ifTable.ifEntry.ifDescr
This attribute, if present, overrides the routers email attribute.
An array list of events being created for monitoring this interface. Currently available are:
This is for watching the interface status. Whenever the administrative or operative status changes, then a mail will be sent to the interfaces admin. You definitely don't want this for a dialup line ... :-)
The status will be queried every minute.
This is for logging accounting information. Every 5 minutes the module will query the interfaces status and the ifInOctets and ifOutOctets. The interface utilization in percent will be calculated and written to the database, together with the status information and the counter differences.
ifInOctets
ifOutOctets
The interface number, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifIndex.
interfaces.ifTable.ifEntry.ifIndex
The interface speed in Bits per second, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifSpeed.
interfaces.ifTable.ifEntry.ifSpeed
A textual description of the interface, being used in reports and other output.
The interface type, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifType.
interfaces.ifTable.ifEntry.ifType
A list of users that may view information about this interface.
This module 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.
snmpmon(1), SNMP::Monitor(3)
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.