Monitoring exim

From OpenNMS
Jump to: navigation, 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 :)

http://www.opennms.eu/exim-perl-and-snmp-oh-my/ http://agaton.scsys.co.uk/~iann/talks/ouce2013/

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 [ http://pookey.co.uk/wordpress/archives/70-cacti-and-exim-a-mostly-complete-guide-part-1 ]

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/exim_stats.pl

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

extend .1.3.6.1.4.1.8607.64 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="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
    </resourceType>

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

      <systemDef name="eximstats">
        <sysoidMask>.1.3.6.1.4.1.8072.3.</sysoidMask>
        <collect>
          <includeGroup>eximstats-qstats</includeGroup>
        </collect>
      </systemDef>

</datacollection-group>

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

    <include-collection dataCollectionGroup="eximstats"/>

And finally, the graphs

vim snmp-graph.properties



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

And then further down add:

######
###### Reports for exim stats
######
report.eximstats.eximqstats.name=Exim Queue
report.eximstats.eximqstats.columns=eximstatqueued
report.eximstats.eximqstats.type=nodeSnmp
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" \

report.eximstats.eximinout.name=Exim Mail
report.eximstats.eximinout.columns=eximstatin, eximstatout
report.eximstats.eximinout.type=nodeSnmp
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" \

report.eximstats.eximbounces.name=Exim Bounces
report.eximstats.eximbounces.columns=eximstatbounces
report.eximstats.eximbounces.type=nodeSnmp
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" \

report.eximstats.breakdown.name=Exim Mail Breakdown
report.eximstats.breakdown.columns=eximstatin, eximstatgreylist, eximstatvirus, eximstatrcptrej
report.eximstats.breakdown.type=nodeSnmp
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:

Eximgraphs.png

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