check_gmailunread.py

Bookmark and Share

Current Version
v0.1.0
Last Release Date
2012-08-01
Compatible With
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion
E-mail
License
GPL
Hits
20915
Files:
FileDescription
check_gmailunread.pycheck_gmailunread.py
check_gmailunread.py
Simple imap python script to check the number of unread emails in a gmail account and alert based on the specified WARN and CRIT parameters.
peter@blackbird:~/Code/nagiosplugins$ ./check_gmailunread.py
Error: no gmail user specified.
Usage: check_gmailunread.py -u email_user -p email_password -w warn_unread -c crit_unread
check_gmailunread.py -h for detailed help
check_gmailunread.py -V for version information


peter@blackbird:~/Code/nagiosplugins$ ./check_gmailunread.py -h
Nagios plugin to check how many unread emails are in a gmail account

Usage: check_gmailunread.py -u email_user -p email_password -w warn_unread -c crit_unread
check_gmailunread.py -h for detailed help
check_gmailunread.py -V for version information

Options:
-h
Print this help message.
-V
Print version information then exit.
-u gmail_user
User name of the gmail account.
For google enterprise accounts use the full email address:
eg, your.email@yourcompany.com
-p gmail_password
Password of the gmail account.
-w warn_count
Warning threshold count for unread emails.
-c crit_count
Critical threshold count for unread emails.


EXAMPLES:

Use full gmail email address:

peter@blackbird:~/Code/nagiosplugins$ ./check_gmailunread.py -u joe.smith@gmail.com -p secretpassword -w 150 -c 350
Unread email count for joe.smith@gmail.com is 238: WARNING
peter@blackbird:~/Code/nagiosplugins$

Use only gmail account name:

peter@blackbird:~/Code/nagiosplugins$ ./check_gmailunread.py -u joe.smith -p secretpassword -w 150 -c 350
Unread email count for joe.smith is 238: WARNING
peter@blackbird:~/Code/nagiosplugins$