Email and Groupware

check_mailstat.pl

Description:

Check mail server statistics like how many messages sent, received, bounced, rejected, virus, spam.
This plugin make use of mailgraph to analyse mail server log and get the statistics counter.

Current Version

0.9.1

Last Release Date

2011-03-17

Compatible With

  • Nagios 2.x
  • Nagios 3.x

Owner

License

GPL


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Notes
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.
Reviews (5) Add a Review
NRPE: Unable to read output
by manh12a3, June 30, 2014
I download you plugin to test it but it didn't work for me and give me this error

Remote host:
I run command
./check_mailstat.pl -w 5:0:0:0:0:0 -c 10:0:0:0:0:0
OK: sent:0.03 received:0.03 bounced:0.00 rejected:0.00 virus:0.03 spam:0.00 |sent=0.03 received=0.03 bounced=0.00 rejected=0.00 virus=0.03 spam=0.00


/etc/init.d/nrpe.cfg
command[check_mailstat]=/usr/lib/nagios/plugins/check_mailstat.pl -w $ARG1$ -c $ARG2$

On server Nagios

./check_nrpe -H remotehost -c check_mailstat -a 50:0:0:0:0:0

NRPE: Unable to read output


How to configure and fix?
Helpful? Yes  No 
Is there a way to run the script by check_ssh insted of NRPE?
by Diodati, December 31, 2013
I'd like to run the script on a remote server without NRPE support, but with ssh access. Is there a way to modify the script to accomplish that? Sorry, i'm not a perl programmer
Helpful? Yes  No 
Great plugin!
by Magalex_2x14, April 30, 2013
Thanks for the great plugin!
With Centreon 2.4.2 i can see graph only for "sent" counter. The problem is related to the performance data format. I'm not good specialist, but i took as a sample perfdata from other service with good graphs, and changed some code in check_mailstat.pl:

change line 97 to: my $perfdata = sprintf "'sent'=%-6.2f;;;;'received'=%-6.2f;;;;'bounced'=%-6.2f;;;;'rejected'=%-6.2f;;;;'virus'=%-6.2f;;;;'spam'=%-6.2f;;;;", @stat_counter;

add as line 98: $perfdata =~ s/s+//g; #remove spaces

I hope this helps... Sorry for bad English.
Helpful? Yes  No 
error
by ahmedali, May 31, 2012
Hi,

I download you plugin to test it but it didn't work for me and give me this error

Use of uninitialized value $stat_line in scalar chomp at ./check_mailstat.pl line 187.
Use of uninitialized value $stat_line in split at ./check_mailstat.pl line 188.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value in subtraction (-) at ./check_mailstat.pl line 210.
Use of uninitialized value $stat_line in concatenation (.) or string at ./check_mailstat.pl line 221.
OK: sent:0.00 received:0.00 bounced:0.00 rejected:0.00 virus:0.00 spam:0.00 |sent=0.00 received=0.00 bounced=0.00 rejected=0.00 virus=0.00 spam=0.00

Please advise me to solve this issue.
Helpful? Yes  No 
pnp4nagios template
by done, August 31, 2011
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
Owner's Reply:

There was in fact a PNP4Nagios template with check_mailstat.pl v0.9.1. However, I only updated it in my blog, and forgot to upload it here, sorry for that.


Helpful? Yes  No 
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.3 (8)
Favorites
2
Views
104,307