Local Mail Box Nagios Check

One of the annoyances of my (working) life is the build up of mail in obscurely named mailboxes on different machines. While the typical aim is to have all hosts sending their local mail to a central point (for mass filtering and deleting^Wlogging) you - firstly - have to actually implement this change (normally on machines with lots of different mailservers - yum!) and then add a check to ensure that it never gets broken in the future.

I wrote a script that helps with both of these tasks, the Check Local Mail Nagios Script; which does what the name suggests. Once deployed and running with nagios it flags any mailboxes with contents and can both help pinpoint the noisiest machines and serve as a longer term configuration check, if you get the mail working and it gets broken in the future then the check’ll flag it up again and you can just follow the red spots in nagios. It’s not a complete solution (you also want to check where the machine thinks it’s mailing to remotely and that mail actually arrives) but it’s a simple first step.