Table of Contents
Check mailboxes
Script: check_mailboxes
It is a plugin to read users mailboxes and warn if number of unread emails were found.
It shows per user
- number of unread emails
- number of emails total
- the last 10 entries of the mailbox
For performance data it writes the number of unread mail entries.
Return values:
- unknown - mail command not found or no sudo permission for executing user
- ok - no mail was found or count of unread emails is below warning level
- warning - count of unread emails is equal or higher warning level
- critical - count of unread emails is equal or higher critical level or error on mail command occured
Requirements
- GNU
mail
binary - sudo permissions to
mail
icingaclient ALL=(ALL) NOPASSWD: /usr/bin/mail
Standalone installation
From this repository you need next to this script:
-
inc_pluginfunctions
shared function for all IML checks written in bash
Syntax
./check_mailboxes -h
______________________________________________________________________
CHECK_MAILBOXES
v1.0
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_mailboxes.html
______________________________________________________________________
Check Mailboxes of local users and count unread mails.
It returs with warning
- if warning level was reached
It returs with error
- if critical level was reached
- one of the mailboxes has an error/ is locked
SYNTAX:
check_mailboxes
OPTIONS:
-h or --help show this help.
-w VALUE warning level (default: 1)
-c VALUE critical level (default: 10)
PARAMETERS:
none
EXAMPLE:
check_mailboxes -w 1 -c 5
Examples
No unread items
OK: 0 unread mails in mailboxes of 1 users
--- root: No applicable messages
Limits: warning at 1 - critical at 10 unread mails
|unread=0;;
Several found message
CRITICAL: 377 unread mails in mailboxes of 2 users
--- root: 2 unread of 2 total
>N 1 root Tue May 6 08:18 34/1278 apt-listchanges: news for
N 2 root Wed Aug 13 02:14 68/2987 apt-listchanges: news for
--- www-data: 375 unread of 382 total
U 373 Mail Delivery Syst Wed Apr 2 12:35 73/2572 Undelivered Mail Returned
U 374 Mail Delivery Syst Wed Apr 2 12:58 73/2566 Undelivered Mail Returned
U 375 Mail Delivery Syst Wed Apr 2 13:54 73/2570 Undelivered Mail Returned
U 376 Mail Delivery Syst Wed Apr 2 13:59 73/2537 Undelivered Mail Returned
U 377 Mail Delivery Syst Wed Apr 2 14:05 73/2530 Undelivered Mail Returned
U 378 Mail Delivery Syst Tue Apr 8 10:51 73/2526 Undelivered Mail Returned
U 379 Mail Delivery Syst Wed Apr 9 11:05 73/2526 Undelivered Mail Returned
U 380 Mail Delivery Syst Wed May 28 16:03 73/2566 Undelivered Mail Returned
U 381 Mail Delivery Syst Thu Jun 19 13:17 73/2566 Undelivered Mail Returned
U 382 Mail Delivery Syst Wed Jul 30 16:21 73/2566 Undelivered Mail Returned
Limits: warning at 1 - critical at 10 unread mails
|unread=377;;