Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Postfix Mails Stats
1.1
2016-10-19
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
- Nagios XI
GPL
7937
File | Description |
---|---|
check_mstat | check_mstat |
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!
Please Change mail.log permissions like (chmod 644 mail.log) so plugin have read permission on mail.log
Implement logrotation on mail.log this file will rotate daily then you have stats of daily basis.
Warning and Critical levels are not defined because i dint feel the need.
#./check_mstat
Total Mails Sent: 110357 Bounced: 861 Deferred: 6068 |Sent=110357;0;9999999 Bounced=861;0;9999999 Deferred=6068;0;9999999
Thanks :) cheers
check_mstat
Reviews (1)
bynishith, March 14, 2023
Plugin Works Well.
While execution, if you're getting Shell Interpreter Error, run "sed -i -e 's/\r$//' check_mstat" command.
==================================
Here is my check_mstat file
#!/bin/bash
# Please Change mail.log permissions like (chmod 644 mail.log)
# Implement logrotation on mail.log this file will rotate daily then you have stats of daily basis
#
LOGFILE='/var/log/maillog'
sent=`cat $LOGFILE | grep status=sent | /usr/bin/wc -l`
bounced=`cat $LOGFILE | grep status=bounced | /usr/bin/wc -l`
deferred=`cat $LOGFILE | grep status=deferred | /usr/bin/wc -l`
echo "Total Mails Sent: $sent Bounced: $bounced Deferred: $deferred |Sent="$sent";0;9999999 Bounced="$bounced";0;9999999 Deferred="$deferred";0;9999999"
exit 0
==================================
Here is my postfix.cfg file
define host {
use generic-switch
host_name central_nagios_postfix
address 192.168.1.1
}
#
define hostgroup {
hostgroup_name Postfix
members central_nagios_postfix
}
#
define service {
use generic-service,srv-pnp
host_name central_nagios_postfix
check_interval 5
retry_interval 1
contacts nishith.vyas
service_description Postfix_Mail_Sent
check_command check_postfix_sent_mails
notification_interval 1440
notifications_enabled 1
}
==================================
Here is my commands.cfg file.
define command{
command_name check_postfix_sent_mails
command_line $USER1$/check_mstat
}
==================================
If PNP4Nagios has already been configured, this will start showing graphs also.
Many thanks to the author for making such a nice & simple script.
While execution, if you're getting Shell Interpreter Error, run "sed -i -e 's/\r$//' check_mstat" command.
==================================
Here is my check_mstat file
#!/bin/bash
# Please Change mail.log permissions like (chmod 644 mail.log)
# Implement logrotation on mail.log this file will rotate daily then you have stats of daily basis
#
LOGFILE='/var/log/maillog'
sent=`cat $LOGFILE | grep status=sent | /usr/bin/wc -l`
bounced=`cat $LOGFILE | grep status=bounced | /usr/bin/wc -l`
deferred=`cat $LOGFILE | grep status=deferred | /usr/bin/wc -l`
echo "Total Mails Sent: $sent Bounced: $bounced Deferred: $deferred |Sent="$sent";0;9999999 Bounced="$bounced";0;9999999 Deferred="$deferred";0;9999999"
exit 0
==================================
Here is my postfix.cfg file
define host {
use generic-switch
host_name central_nagios_postfix
address 192.168.1.1
}
#
define hostgroup {
hostgroup_name Postfix
members central_nagios_postfix
}
#
define service {
use generic-service,srv-pnp
host_name central_nagios_postfix
check_interval 5
retry_interval 1
contacts nishith.vyas
service_description Postfix_Mail_Sent
check_command check_postfix_sent_mails
notification_interval 1440
notifications_enabled 1
}
==================================
Here is my commands.cfg file.
define command{
command_name check_postfix_sent_mails
command_line $USER1$/check_mstat
}
==================================
If PNP4Nagios has already been configured, this will start showing graphs also.
Many thanks to the author for making such a nice & simple script.