NAME

SNMP::Monitor::Install - Create a config file for SNMP::Monitor module

SYNOPSIS

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);

DESCRIPTION

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.

Install($file, $prefix)

(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.

Save($file, $config)

(Class method) Saves the configuration $config in the file $file.

CONFIGURATION FILE

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:

dbi_dsn
dbi_user
dbi_pass

The DSN, user name and password for accessing the database.

email

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.

etc_dir

Path to the directory where the configuration file is stored.

facility

The syslog facility to use for syslog messages, by default daemon.

hosts

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.

path_gnuplot
path_ppmtogif

The paths to the gnuplot and ppmtogif binaries

pid_file

Path of the PID file. By default /var/run/snmpmon.pid.

users

A list of users that may view information. Can be overwritten in the router or interface configuration.

Router 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:

Community

The community string being used for accessing the routers SNMP server; defaults to public.

description

A one line description of the router, from time to time being used in output.

DestHost

The routers host name (resolvable via DNS) or IP address.

email

This attribute, if present, overrides the global email attribute.

interfaces

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.

name

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).

RemotePort

The service name or port number where the routers SNMP server is listening. Defaults to 161.

users

A list of users that may view information about this router. Can be overwritten in the interface configuration.

Interface configuration

Interfaces are yet more key/value pairs, the keys being:

description

The interface number, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifDescr.

email

This attribute, if present, overrides the routers email attribute.

events

An array list of events being created for monitoring this interface. Currently available are:

SNMP::Monitor::Event::IfStatus

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.

SNMP::Monitor::Event::IfLoad

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.

num

The interface number, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifIndex.

speed

The interface speed in Bits per second, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifSpeed.

short_message

A textual description of the interface, being used in reports and other output.

type

The interface type, as returned by the SNMP variable interfaces.ifTable.ifEntry.ifType.

users

A list of users that may view information about this interface.

AUTHOR AND COPYRIGHT

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.

SEE ALSO

snmpmon(1), SNMP::Monitor(3)