Mitch Planck wrote:
> Hi all,
> I have an mrtg server already set up monitoring all our connections and I'd
> like to add in monitoring of the postfix server stats. I got the perl scrips
> from http://taz.net.au/postfix/mrtg/ and modified them slightly to meet my
> needs (here are my mods: http://www.brooks-planck.org/mrtg). What I need now
> is the ability to run the mrtg-mailstats.pl from the mrtg server and have it
> collect the data saved in the /tmp/stats.db file. My guess is that I'll have
> to modify the scripts some more so that they rcp the stats to the mrtg
> server or something like that. Since I already have a mrtg server I don't
> want to set up the postfix server to be doing that as well so my question is
> has anyone else done this and have a working setup they can share or tips on
> this.
If you install UCD-SNMP on the postfix host itself, I believe there is
an option to allow you to run any command and return the results. MRTG
supports directly querying an OID. I have never tried this, but don't
see any reason why it wouldn't work. You'd have to install the perl
scripts directly on your postfix server and setup snmpd.conf
appropriately, in particular this part of the man page defines the syntax:
exec NAME PROG ARGS
exec MIBNUM NAME PROG ARGS
If MIBNUM is not specified, the agent executes the
named PROG with arguments of ARGS and returns the
exit status and the first line of the STDOUT output
of the PROG program to queries of the
1.3.6.1.4.1.2021.8.1.100 and
1.3.6.1.4.1.2021.8.1.101 mib columns (respec-
tively). All STDOUT output beyond the first line
is silently truncated.
If MIBNUM is specified, it acts as above but
returns the exit status to MIBNUM.100.0 and the
entire STDOUT output to the table MIBNUM.101 in a
mib table. In this case, the MIBNUM.101 mib con-
tains the entire STDOUT output, one mib table entry
per line of output (ie, the first line is output as
MIBNUM.101.1, the second at MIBNUM.101.2, etc...).
Note: The MIBNUM must be specified in dotted-
integer notation and can not be specified as
".iso.org.dod.internet..." (should instead
be .1.3.6.1...).
Note: The agent caches the exit status and STDOUT
of the executed program for 30 seconds after
the initial query. This is to increase
speed and maintain consistency of informa-
tion for consecutive table queries. The
cache can be flushed by a snmp-set request
of integer(1) to 1.3.6.1.4.1.2021.100.VER-
CLEARCACHE.