Debian Packages Requiring Updates - Via Nagios

I’ve recently needed a way to see, via the Nagios web front end, which Debian machines need their packages updating. So I wrote the check_debian_updates.sh Nagios plugin. This is the initial release (which hasn’t been hit too hard yet) so be careful about deploying it anywhere but your testing environment for now. I’ve played with it in my small test environment and it seems to work so feel free to have a look at it. I’ll be stressing it, and possibly tidying the code up a little, next week.

In its basic operation, the script just reports how many packages (if any) need updating and returns a CRIT or a WARN to Nagios based upon your thresholds. If you call the script with a -v it will also output the name of all packages that need updating. Which may consume a lot of Nagios front end screen real estate. Due to it running apt-get update it needs some root privileges. I’ll be setting up sudo to let the Nagios user run this as root with no password for both the apt-get update and apt-get upgrade -s (note the ‘-s’ for simulation.) And only for those!