Skip to content

Icinga/Nagios Monitoring Plugin to check Postfix mailq

License

Notifications You must be signed in to change notification settings

transitiv/check_postfix_mailq

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

check_postfix_mailq

About

This nagios/icinga plugin collects information about the postfix mail queue by running the mailq command. It runs different checks on the mailq output and provides detailed perfdata.

Example

$ ./check_postfix_mailq.py --count-warning 5 --count-critical 10
WARNING: mailq count >5 | active=1;;;; count=7;5;10;; deferred=5;;;; hold=1;;;; recipients=10;0;0;; size=107800B;0;0;;

$ ./check_postfix_mailq.py --count-warning 5 --count-critical 10 --perfdata-details
WARNING: mailq count >5 | active=1;;;; count=7;5;10;; count[MAILER-DAEMON]=1 count[[email protected]]=2 count[[email protected]]=1 count[[email protected]]=1 count[[email protected]]=1 count[[email protected]]=1 deferred=5;;;; hold=1;;;; recipients=10;0;0;; recipients[MAILER-DAEMON]=1 recipients[[email protected]]=4 recipients[[email protected]]=1 recipients[[email protected]]=1 recipients[[email protected]]=1 recipients[[email protected]]=2 size=107800B;0;0;; size[MAILER-DAEMON]=18636B size[[email protected]]=33217B size[[email protected]]=20786B size[[email protected]]=495B size[[email protected]]=34176B size[[email protected]]=490B

Requirements

  • Standard modules of Python2 or Python3
  • Permission to read postfix queues, see authorized_mailq_users of postconf(5)
  • Command mailq can be found in PATH variable

Why a new plugin

  • Provide more details about the mail queue
  • Should be runnable out of the box, don't depend on externals libraries
  • Personal interest to get familiar with python unit tests

Development and Testing

Run unit tests:

# Run in git directory of check_postfix_mailq
$ python2 -m unittest discover -s tests
$ python3 -m unittest discover -s tests

Run a short performance test (mailq output read from a local file):

# Run in git directory of check_postfix_mailq
$ export PATH=$PWD/tests/performance:$PATH
$ time ./check_postfix_mailq.py --count-warning 5 --count-critical 10 --perfdata-details
CRITICAL: mailq count >10 | count=4676;5;10;; count[MAILER-DAEMON]=668 count[[email protected]]=1336 count[[email protected]]=668 count[[email protected]]=668 count[[email protected]]=668 count[[email protected]]=668 recipients[MAILER-DAEMON]=668 recipients[[email protected]]=2672 recipients[[email protected]]=668 recipients[[email protected]]=668 recipients[[email protected]]=668 recipients[[email protected]]=1336 size=72010400B;0;0;; size[MAILER-DAEMON]=12448848B size[[email protected]]=22188956B size[[email protected]]=13885048B size[[email protected]]=330660B size[[email protected]]=22829568B size[[email protected]]=327320B

real    0m0.169s
user    0m0.148s
sys     0m0.012s

Alternative monitoring solutions

About

Icinga/Nagios Monitoring Plugin to check Postfix mailq

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.3%
  • Shell 0.7%