Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_mailstat.pl

Rating
8 votes
Favoured:
2
Current Version
0.9.1
Last Release Date
2011-03-17
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Owner
License
GPL
Hits
104328
Files:
FileDescription
check_mailstat_plugin_v0.9.zipcheck_mailstat_plugin_v0.9.zip
check_mailstat_plugin_v0.9.1.zipcheck_mailstat_plugin_v0.9.1.zip
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!
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.
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)
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?
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
byMagalex_2x14, April 24, 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.
byahmedali, May 8, 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.
bydone, August 4, 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.