Difference between revisions of "Nagios"

Jump to navigation Jump to search
4,861 bytes added ,  18:00, 27 January 2012
Added NRPE
(Added "Ubuntu Software Updates Monitor")
(Added NRPE)
Line 219: Line 219:
  }
  }


== NRPE ==
The Nagios Remote Plugin Executor allows Nagios checks to completed on remote servers in a similar fashion to performing checks on the Nagios server.  Whilst its not always necessary, as many remote checks can be performed by probing remotely accessible services such as SNMP or HTTP, there are times when such checks are not suitable, for example...
* Running checks that aren't easily achievable via SNMP
* Checking services such as MySQL that should only be accessible local to the server
* Running HTTP checks to test your web servers from more than one location
** EG local to server to ensure the web-server itself is OK, and remotely to check that access is likely to OK for global users
The NRPE server that runs on remote monitored machines does require quite a few additional packages to be installed (see below for in-exhaustive list), and if you are concerned you try the alternative approach of getting data back from your remote server via SNMP as described in this example [[#Ubuntu_Software_Updates_Monitor|Ubuntu Software Updates Monitor]].  This can make for a more lightweight solution, but will require you to write your own monitoring scripts to be called by the SNMP daemon.  Swings and roundabouts.
* radiusclient1
* samba-common
* smbclient
* snmp
The procedures below will get NRPE running to monitor disk space, load and MySQL service availability on a remote server.
# '''Install the NRPE Plugin''' on the main Nagios server
#* <code>apt-get install nagios-nrpe-plugin</code>
# '''Install the NRPE Server''' on the remote/monitored server
#* <code>apt-get install nagios-nrpe-server</code>
# '''On the remote/monitored server update the config''' <code> /etc/nagios/nrpe.cfg </code> for
#* Nagios communications...
#** EG <code> server_port=5700 </code> change the port if your monitored server is on the internet
#** EG <code> allowed_hosts=192.168.1.25 </code> change to the address of your Nagios server
#* Checks (some may already exist in config)...
#** Load: <code> command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 </code>
#** Disk space: <code> command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1 </code>
#** MySQL: <code> command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -H 127.0.0.1 -u nagios -p poller </code>
#*** Assumes you have added the <code> nagios </code> user to MySQL, EG <code> mysql -u root -p -e "create user nagios identified by 'poller';" </code>
# '''Restart service on remote/monitored server''' to apply config
#* <code> service nagios-nrpe-server restart </code>
# If necessary (if you're using the server's firewall), open the NRPE port on the remote/monitored server
#* <code> ufw allow proto tcp from 192.168.1.25 to any port 5700 </code>
# On the Nagios server '''create a hostgoup for the checks''' (see Nagios Hostgroup below)
#* Edit <code> hostgroups_nagios2.cfg </code> file
# On the Nagios server '''create a custom NRPE command''' (see Nagios Command below)
#* Edit <code> commands.cfg </code> file
# On the Nagios server '''create a NRPE service file''' (see NRPE Services below)
#* Edit <code> services_nrpe.cfg </code> file
# On the Nagios server, validate the config, and assuming all OK, '''restart service to apply'''
#* <code> nagios3 -v /etc/nagios3/nagios.cfg </code>
#* <code> service nagios3 restart  </code>
* '''Nagios Hostgroup''' (<code> hostgroups_nagios2.cfg </code>)
define hostgroup {
        hostgroup_name          nrpe-std
                alias          NRPE Standard servers
                members        wiki
        }
* '''Nagios Command''' (<code> commands.cfg </code>)
define command {
        command_name    check_nrpe_port
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -p 5700 -c $ARG1$
}
* '''NRPE Services''' (<code> services_nrpe.cfg </code>)
# NRPE Standard checks
define service {
        hostgroup_name                  nrpe-std
        service_description            Load
        check_command                  check_nrpe_port!check_load
        use                            generic-service
        notification_interval          0 ; set > 0 if you want to be renotified
}
define service {
        hostgroup_name                  nrpe-std
        service_description            Disk Space
        check_command                  check_nrpe_port!check_disks
        use                            generic-service
        notification_interval          0 ; set > 0 if you want to be renotified
}
define service {
        hostgroup_name                  nrpe-std
        service_description            MySQL
        check_command                  check_nrpe_port!check_mysql
        use                            generic-service
        notification_interval          0 ; set > 0 if you want to be renotified
}


[[Category:Nagios]]
[[Category:Nagios]]

Navigation menu