The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

netsnmp-sendmail-setup - sets up Sendmail monitoring via SNMP

SYNOPSIS

netsnmp-sendmail-setup [-nq] [--bindir=DIR] [--configure] [--deconfigure] [--dry-run] [--status-file=FILE] [--quiet] [--restart=service=command]

netsnmp-sendmail-setup --help | --usage

DESCRIPTION

Sets up sendmail and snmpd for obtaining Sendmail statistics via SNMP. First, it checks whether the Sendmail configuration source /etc/mail/sendmail.mc contains the STATUS_FILE clause and adds it if not. Then, it creates the status file and runs make in the /etc/mail directory. Finally, the file /etc/snmp/snmpd.conf is scanned for the perl use NetSNMP::Sendmail statement. It is added if not already present. Each added configuration line is preceded by a comment stating that it was added by the script.

When run with the --deconfigure option, the reverse operation is performed. The NetSNMP::Sendmail configuration statement is removed from the snmpd configuration unconditionally. The STATUS_FILE clause is removed from /etc/mail/sendmail.mc only if it is preceded by the netsnmp-sendmail-setup comment marker. The status file itself is never removed.

OPTIONS

--bindir=DIR

Some installations place Sendmail binaries in a separate directory, which is not included in the $PATH environment variable. Use this option to inform NetSNMP::Sendmail about this.

Notice for the users of Debian-based systems: the /usr/lib/sm.bin directory is picked up automatically.

--configure

A no-op option included for symmetry with --deconfigure.

--deconfigure

Remove the configuration statements previously added to the snmdp and sendmail configuration files.

-n, --dry-run

Dry run mode. Don't modify any files, just print what would have been done and exit with the appropriate error code (see EXIT STATUS section).

Use the --quiet option to control the amount of data printed.

-q, --quiet

Quiet mode. When used once, suppresses informative output. When used twice, suppresses both informative output and notification messages about modified files.

--restart=service=command

Use command to restart system service service (either snmpd or sendmail). Use --restart=service=no to skip restarting this particular service.

In the absence of this option, netsnmp-sendmail-setup uses the first available command from the following list:

    systemctl restart $service
    service $service restart
    /etc/init.d/$service restart
    /etc/rc.d/$service restart
--status-file=FILE

Name of the Sendmail status file to use when generating the define(STATUS_FILE) statement in the Sendmail configuration file.

--help

Displays short help message.

--usage

Displaye short usage message.

FILES

/etc/mail/Makefile

This file is supposed to recreate the sendmail.cf file from sendmail.mc if no special goal is given.

/etc/snmp/snmpd.conf

Default snmpd configuration file. This file must exist.

/etc/mail/sendmail.mc

Default source file for creating sendmail.cf.

/etc/mail/sendmail.st

Default statistics file to use. Can be changed using the --status-file option.

/usr/lib/sm.bin

Default directory for Sendmail binaries on Debian-based installations. If exists, it will be used in the NetSNMP::Sendmail configuration.

This can be changed using the --bindir command line option.

EXIT STATUS

0

Success.

1

Success, no modification was necessary.

2

Fatal error occurred.

64

Command line usage error.

SEE ALSO

NetSNMP::Sendmail(3).

BUGS

The Sendmail configuration directory and the name of the snmpd configuration file are hardcoded.

The command relies on make -C /etc/mail to create sendmail.cf from sendmail.mc.