«

»

Dec 17

check_mailstat.pl: a nagios plugin for monitoring mail server statistics

mailgraph is a good tool at analysing mail server log, it supports many MTA(including sendmail, postfix, exim,etc.), with support for mailscanner,spamassassin,etc.

As a whole, mailgraph can tell mail server statistics like how many messages sent/ received/ bounced/ rejected/ virus/ spam per time interval, which can be used as a sign of mail server healthy.

This plugin includes a patch for mailgraph so that it will also output its statistics counter to an external file(plus the rra file),and a check_mailstat.pl which check the stat counter to see if it’s ok, emit WARN/CRITICAl result if not.It can run on nagios server, or on remote server via NRPE.

see Readme file in the package for install instructions.

Downloads:

7 comments

2 pings

  1. Sven P

    Hi There,

    a really cool Plugin :) But can you please add Performance Data Output so that i can graph the Mailstats with PNP4Nagios? That wourld be great.

    Thank you very much for that Script and your Answer :)

    Greetins
    Sven

  2. Curu Wong

    I am glad that you like it. I have released the 0.9.1 version, which added perfdata output(and it includes a PNP4Nagios template).

  3. Dan Candea

    I made a pnp4nagios template which is similar with the one from mailgraph.cgi. Maybe you want to include it in the package. The data is displayed only in two graphs.
    http://docs.quah.ro/nagios/check_mailstat.php

  4. Curu Wong

    There was a PNP4Nagios in v0.9.1.
    I want to have a look at your template first, but it seems I can’t get it from the provided link, it shows me a php error,would you please check that?

  5. Pierre-Yves Dubreucq

    Hi,
    I don’t use PNP4Nagios but I’m using Centreon http://www.centreon.com/
    I’ve modified this script to graph with Centreon
    On line 97 subsitute ” ” by “;”
    like that :
    Replace :

    my $perfdata = sprintf "sent=%-6.2f received=%-6.2f bounced=%-6.2f rejected=%-6.2f virus=%-6.2f spam=%-6.2f", @stat_counter;

    Par :

    my $perfdata = sprintf "sent=%-6.2f;received=%-6.2f;bounced=%-6.2f;rejected=%-6.2f;virus=%-6.2f;spam=%-6.2f", @stat_counter;

    Could you tell me if your script with this modification stay compatible with pnp4nagios ?

    If it’s true, could you update your plugin ?

    Thanks by advance.

  6. Curu Wong

    Hi, It may break PNP4Nagios if substitute ” ” by “;”
    Basically, PNP4Nagios uses the same logic as the perl module Nagios::Plugin::Performance when parsing performance data. Reading the source code of that module, you will find that blank character(including space) is used to seperate different perfdata metric, whereas semicolon(;) is used to seprate fields of a single metric.

    If you have read section 2.6 of the Nagios plug-in development guidelines, you will know the recommended format of perf data.

  7. Dan Candea

    @Curu Wong

    it tries to interpret the php. just acces the link without the script
    http://docs.quah.ro/nagios/
    To save use the right side icon.

  1. DBsysNet # Databases, Systems, Networks » Supervision de postfix via mailgraph avec le plugin check_mailstat.pl via Nagios/Centreon

    [...] cela nous allons utiliser le plugins check_mailstat.pl avec une petite adaptation du script afin de le rendre compatible avec la génération de graphe [...]

  2. Databases, Systems, Networks » Supervision de postfix via mailgraph avec le plugin check_mailstat.pl via Nagios/Centreon

    [...] cela nous allons utiliser le plugins check_mailstat.pl avec une petite adaptation du script afin de le rendre compatible avec la génération de graphe [...]

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">