Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_postfix_processed
2
2013-03-20
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios XI
GPL
88581
File | Description |
---|---|
check_postfix_processed | check_postifx_processed (old version) |
check_postfix_processed | Improved version 1.1: check_postfix_processed |
check_postfix_processed2 | check_postfix_processed2 |
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!
Performance issue on large logfiles is fixed in v1.1
Performance more improved by using awk in version 2.
HINT!!!
If the version2 does not work, and you get 0 as result, First make sure nagios/nrpe has read permissions on the mail.log, secondly there might be a mismatch in the LOCALE variabels between the shell and the postfix environment. In that case do the following:
1) open a shell
2) give the command: awk -v now=`date +%s` 'BEGIN{print strftime("%b %d %T", now)}'
3) the result is something like this: mrt 29 11:46:01
4) open your maillog and take a look at the date format. (Probably it is: Mar 29 10:34:56)
As you see, one says mrt, the other Mar. This will not work.
5) execute the following in the shell: export LC_TIME=en_US
6) give the awk command again. If this changes the output of the awk to the same output as used in the maillog, add this EXPORT-line somewhere in the script and you are done.
7) kairu0 found that it was not the locale that was wrong, but that the log files uses spaces instead of 0. Ie. "Aug 6" instead of "Aug 06". In that case replace the strftime("%b %d %T" with strftime("%b %e %T" on two locations in the script.
8) if that did not work, try to figure out what locale command you should give, or contact me.
This script parses the /var/log/.
IFS is used so the date/time field is seen as different columns instead of 1 field.
Grep finds the lines where the logs says: sent
This is processed by awk to get the required fields.
Tac is used to serch bottom up.
If the time of the log is less different then the currenttime-NO_OF_SECONDS then we have a hit. The hits are counted and returned to nagios.
It can be used in combination with process_perf_data 1 / pnp4nagios
There are 3 version available. The last 2 version have the best performance, lowest loads. Please read all the notes if you have difficulties using the latest.
IFS is used so the date/time field is seen as different columns instead of 1 field.
Grep finds the lines where the logs says: sent
This is processed by awk to get the required fields.
Tac is used to serch bottom up.
If the time of the log is less different then the currenttime-NO_OF_SECONDS then we have a hit. The hits are counted and returned to nagios.
It can be used in combination with process_perf_data 1 / pnp4nagios
There are 3 version available. The last 2 version have the best performance, lowest loads. Please read all the notes if you have difficulties using the latest.
Reviews (3)
bygerardjp, October 30, 2014
0
bytoridium, August 6, 2013
awk -v now=`date +%s` 'BEGIN{print strftime("%b %d %T", now)}'
gives me Aug 06 19:57:43 and log file have padded zeros Aug 6 19:57:11
I use 'BEGIN{print strftime("%b %e %T", now-seconds)}'` in the script to get it to work.
gives me Aug 06 19:57:43 and log file have padded zeros Aug 6 19:57:11
I use 'BEGIN{print strftime("%b %e %T", now-seconds)}'` in the script to get it to work.
byMerval, June 3, 2013
Once I figured out the permissions were incorrect for the nagios user, this plugin started working like a charm!