Monitoring exim

From OpenNMS
Jump to navigation Jump to search

Monitoring Exim with OpenNMS

OUCE 2013

There was a talk at OUCE 2013 about this same topic, but the graphs are not as featured as the ones below, but the script is FAR cleaner. I would check it out if you have the time to merge the 2 and create one awesome script set :)

Monitoring port 25

By default OpenNMS will monitor port 25 as it is the SMTP service, If you need to monitor exim running on another port, you will need to create a new service for the port.

Gathering SNMP data

I have managed to get exim monitoring into OpenNMS after tweaking the code found [ ]

On the server you want to monitor

On the server you want to monitor the exim queue on download and extract the file attached to this page.

I wanted to attach it, but no compressed archives are available :( Contact me directly on the opennms discussion mailing list for a copy or use the one from the link above and modify it per below (minor tweaks needed)

Add this line to cron

*/1 * * * * /opt/exim_snmp/

Add this line to the bottom of /etc/snmp/snmpd.conf

extend . mx-stats /bin/cat /opt/exim_snmp/exim4/statistics

Restart SNMP on the serverservice snmpd restart

In OpenNMS

Create a new datacollection file: vim datacollection/eximstats.xml

<?xml version="1.0"?>
<datacollection-group name="eximstats">

    <resourceType name="eximmtastats" label="Exim MTA Statistics">
      <persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
      <storageStrategy class=""/>

      <group name="eximstats-qstats" ifType="ignore">
        <mibObj oid="." instance="1" alias="eximstatgreylist"  type="gauge" />
        <mibObj oid="." instance="2" alias="eximstatrcptrej"   type="gauge" />
        <mibObj oid="." instance="3" alias="eximstatin"        type="gauge" />
        <mibObj oid="." instance="4" alias="eximstatout"       type="gauge" />
        <mibObj oid="." instance="5" alias="eximstatspam"      type="gauge" />
        <mibObj oid="." instance="6" alias="eximstatvirus"     type="gauge" />
        <mibObj oid="." instance="7" alias="eximstatqueued"    type="gauge" />
        <mibObj oid="." instance="8" alias="eximstatbounces"   type="gauge" />

      <systemDef name="eximstats">


Define it as a monitored group by adding it to datacollection-config.xml

    <include-collection dataCollectionGroup="eximstats"/>

And finally, the graphs


At the top add:
eximstats.eximqstats, eximstats.eximbounces, eximstats.eximinout, eximstats.breakdown, \

And then further down add:

###### Reports for exim stats
###### Queue
report.eximstats.eximqstats.command=--title="Exim mail queue" \
 --vertical-label="Messages in queue" \
 DEF:eximqstats={rrd1}:eximstatqueued:AVERAGE \
 DEF:mineximqstats={rrd1}:eximstatqueued:MIN \
 DEF:maxeximqstats={rrd1}:eximstatqueued:MAX \
 LINE1:eximqstats#0000ff:"Mail queue" \
 GPRINT:eximqstats:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximqstats:MIN:" Min \\:%8.2lf"  \
 GPRINT:eximqstats:MAX:" Max \\:%8.2lf\\n" \ Mail
report.eximstats.eximinout.columns=eximstatin, eximstatout
report.eximstats.eximinout.command=--title="Exim mail" \
 --vertical-label="Messages" \
 DEF:eximin={rrd1}:eximstatin:AVERAGE \
 DEF:mineximin={rrd1}:eximstatin:MIN \
 DEF:maxeximin={rrd1}:eximstatin:MAX \
 DEF:eximout={rrd2}:eximstatout:AVERAGE \
 DEF:mineximout={rrd2}:eximstatout:MIN \
 DEF:maxeximout={rrd2}:eximstatout:MAX \
 LINE1:eximin#0000ff:"Mail in" \
 GPRINT:eximin:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximin:MIN:" Min \\:%8.2lf" \
 GPRINT:eximin:MAX:" Max \\:%8.2lf\\n" \
 LINE1:eximout#ff0000:"Mail out" \
 GPRINT:eximout:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximout:MIN:" Min \\:%8.2lf" \
 GPRINT:eximout:MAX:" Max \\:%8.2lf\\n" \ Bounces
report.eximstats.eximbounces.command=--title="Exim bounced messages" \
 --vertical-label="Messages" \
 DEF:eximbounce={rrd1}:eximstatbounces:AVERAGE \
 DEF:mineximbounce={rrd1}:eximstatbounces:MIN \
 DEF:maxeximbounce={rrd1}:eximstatbounces:MAX \
 LINE1:eximbounce#0000ff:"Mail queue" \
 GPRINT:eximbounce:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximbounce:MIN:" Min \\:%8.2lf"  \
 GPRINT:eximbounce:MAX:" Max \\:%8.2lf\\n" \ Mail Breakdown
report.eximstats.breakdown.columns=eximstatin, eximstatgreylist, eximstatvirus, eximstatrcptrej
report.eximstats.breakdown.command=--title="Exim mail breakdown" \
 --vertical-label="Messages" \
 DEF:eximin={rrd1}:eximstatin:AVERAGE \
 DEF:mineximin={rrd1}:eximstatin:MIN \
 DEF:maxeximin={rrd1}:eximstatin:MAX \
 DEF:eximgrey={rrd2}:eximstatgreylist:AVERAGE \
 DEF:mineximgrey={rrd2}:eximstatgreylist:MIN \
 DEF:maxeximgrey={rrd2}:eximstatgreylist:MAX \
 DEF:eximvirus={rrd3}:eximstatvirus:AVERAGE \
 DEF:mineximvirus={rrd3}:eximstatvirus:MIN \
 DEF:maxeximvirus={rrd3}:eximstatvirus:MAX \
 DEF:eximrej={rrd4}:eximstatrcptrej:AVERAGE \
 DEF:mineximrej={rrd4}:eximstatrcptrej:MIN \
 DEF:maxeximrej={rrd4}:eximstatrcptrej:MAX \
 LINE1:eximin#0000ff:"Mail in" \
 GPRINT:eximin:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximin:MIN:" Min \\:%8.2lf" \
 GPRINT:eximin:MAX:" Max \\:%8.2lf\\n" \
 LINE1:eximgrey#00ff00:"Greylisted" \
 GPRINT:eximgrey:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximgrey:MIN:" Min \\:%8.2lf" \
 GPRINT:eximgrey:MAX:" Max \\:%8.2lf\\n" \
 LINE1:eximvirus#fff200:"Virus Rejected" \
 GPRINT:eximvirus:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximvirus:MIN:" Min \\:%8.2lf" \
 GPRINT:eximvirus:MAX:" Max \\:%8.2lf\\n" \
 LINE1:eximrej#ff0000:"RCPT Rejected" \
 GPRINT:eximrej:AVERAGE:" Average \\:%8.2lf" \
 GPRINT:eximrej:MIN:" Min \\:%8.2lf" \
 GPRINT:eximrej:MAX:" Max \\:%8.2lf\\n" \

And after all that, you end up with something like:


Help / Troubleshooting

The numbers of mail are huge!

The counters incriment from the time the service was started. Each time the service restarts, it will be reset to 0

The graphs have reset to 0 whats wrong!

See above.

Why that SNMP OID

No idea, it was in the original page and it works :)