Difference between revisions of "Nagios"

Jump to navigation Jump to search
2,806 bytes added ,  18:21, 13 January 2012
Added "Ubuntu Software Updates Monitor"
(Added "Ubuntu Software Updates Monitor")
Line 106: Line 106:




== Create Services ==
=== Create Services ===
Services are used to define a generic check command within the bounds of a specific service.  So for example, you could define two separate disk space checks, using the same command definition, but with different alerting thresholds depending on your requirements.
Services are used to define a generic check command within the bounds of a specific service.  So for example, you could define two separate disk space checks, using the same command definition, but with different alerting thresholds depending on your requirements.


Line 154: Line 154:




== Create Hostgroup ==
=== Create Hostgroup ===
The hostgroup definition allows you to group one or more hosts together, in order to have service checks run against them.  So in the above I created services that would apply to hosts in the <code>qnap-nas</code> hostgroup. I can then add my NAS server to this hostgroup in order for it to be monitored (hostgroup definitions are normally found in <code>/etc/nagios3/conf.d/hostgroups_nagios2.cfg</code>
The hostgroup definition allows you to group one or more hosts together, in order to have service checks run against them.  So in the above I created services that would apply to hosts in the <code>qnap-nas</code> hostgroup. I can then add my NAS server to this hostgroup in order for it to be monitored (hostgroup definitions are normally found in <code>/etc/nagios3/conf.d/hostgroups_nagios2.cfg</code>


Line 171: Line 171:
         address                192.168.1.200
         address                192.168.1.200
         }
         }
== Ubuntu Software Updates Monitor ==
This check uses some scripts developed by Michal Ludvig, I've downloaded the scripts to my site, but the originals, complete with his supporting notes can be found here - http://www.logix.cz/michal/devel/nagios.  Though note that I've updated the <code>check_snmp_extend.sh </code> script (didn't work for me, suspect Nagios file locations have changed since script was originally written), all kudos should still go to Michal.
To summarise how it works...
# Nagios uses a local script to SNMP query a remote server you want to check
# The SNMP query triggers another script to be run on the remote server which queries whether there are any updates to install
# The result is returned via SNMP to the calling script on the Nagios server, which in turn passes the data to Nagios
To set it up...
# '''On your Nagios server...'''
## Download <code>check_snmp_exec.sh</code> to <code>/usr/lib/nagios/plugins </code>
##* EG when in folder <code>/usr/lib/nagios/plugins</code> do <code> wget http://dl.sandfordit.com/scripts/check_snmp_extend.sh </code>
## Make the the script executable
##* EG <code> chmod +x check_snmp_extend.sh </code>
## Define a command for the check in <code> /etc/nagios3/conf.d/commands.cfg </code> (see below - Nagios command)
# '''On your monitored servers (do one 1st to test)...'''
## Download <code>check-apt-upgrade.pl</code> to <code>/usr/local/bin/ </code>
##* EG when in folder <code>/usr/local/bin/</code> do <code> wget http://dl.sandfordit.com/scripts/check-apt-upgrade.pl </code>
## Make the the script executable
##* EG <code> chmod +x check-apt-upgrade.pl </code>
## Make the server's SNMP daemon aware of it, edit <code> /etc/snmp/snmpd.conf </code>, add the following
##* <code> extend sw-updates /usr/local/bin/check-apt-upgrade.pl --run </code>
## Restart the SNMP daemon
##* <code> service snmpd restart </code>
# '''Back on the Nagios server...'''
## Define a service for the check in <code> /etc/nagios3/conf.d/services_nagios2.cfg </code> (see below - Nagios service)
## Check your Nagios config is valid
##* <code> nagios3 -v /etc/nagios3/nagios.cfg </code>
## Restart Nagios
##* <code> service nagios3 restart </code>
* nagios command...
define command{
        command_name    check_snmp_extend
        command_line    /usr/lib/nagios/plugins/check_snmp_extend.sh $HOSTADDRESS$ $ARG1$
}
* nagios service...
# SNMP check for Ubuntu server package updates
define service {
        hostgroup_name                  ubuntu-servers
        service_description            Updates SNMP
        check_command                  check_snmp_extend!sw-updates
        use                            generic-service
        notification_interval          0 ; set > 0 if you want to be renotified
}




[[Category:Nagios]]
[[Category:Nagios]]
[[Category:Ubuntu]]
[[Category:SNMP]]
[[Category:SNMP]]
[[Category:QNAP]]
[[Category:QNAP]]

Navigation menu