check updates via nagios

On your clients you have to modify /etc/snmp/snmpd.conf:

#com2sec paranoid default public
com2sec readonly default public
exec .1.3.6.1.4.1.2021.8.3 aptupdate /usr/local/bin/nagios-check-apt-updates

Get the check script to the client:

# wget –no-check-certificate \
https://kosh.ganneff.de/ganneffutils/nagios/nagios-check-apt-updates \
-O /usr/local/bin/nagios-check-apt-updates
# chmod +x /usr/local/bin/nagios-check-apt-updates

Allow the snmp user to make use of apt-get:

# echo “snmp ALL=(ALL) NOPASSWD: /usr/bin/apt-get update” >> /etc/sudoers
# echo “snmp ALL=(ALL) NOPASSWD: /usr/bin/apt-get –simulate upgrade” >> /etc/sudoers

Restart the snmpd:

# /etc/init.d/snmpd restart
Restarting network management services: snmpd.

On the nagios monitoring system you have to run something like this:

# /usr/lib/nagios/plugins/check_snmp -H <client> -t30 \
-C public -o .1.3.6.1.4.1.2021.8.3.101.1 \
-r “No updates available”
SNMP CRITICAL - *”Security updates (1): libkrb53; “* | iso.3.6.1.4.1.2021.8.3.101.1=”Security updates (1): libkrb53; ”

After upgrading the client you should get:

# /usr/lib/nagios/plugins/check_snmp -H <client> -t30 \
-C public -o .1.3.6.1.4.1.2021.8.3.101.1 \
-r “No updates available”
SNMP OK - “No updates available” | iso.3.6.1.4.1.2021.8.3.101.1=”No updates available”

Creative Commons License
The check updates via nagios by Cyconet Blog, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Terms and conditions beyond the scope of this license may be available at blog.waja.info.

2 Responses to “check updates via nagios”


  1. 1 sean finney

    hey jan

    you know that there’s a check_apt in nagios-plugins, don’t you? :)

  2. 2 cyco

    Hi Sean,

    thanks for the hint … so the solution is much easier. :)

    Drop all changes from /etc/sudoers and remove /usr/local/bin/nagios-check-apt-updates.
    Exchange “/usr/local/bin/nagios-check-apt-updates” with “/usr/lib/nagios/plugins/check_apt” in /etc/snmp/snmpd.conf and search for “APT OK” in the response of check_snmp.

Leave a Reply




Too Cool for Internet Explorer