Nagios - NRPE

Il demone Nagios che esegue controlli su macchine remote in NRPE (Nagios Remote Plugin Executor). Ti permette di eseguire i plugin Nagios su altre macchine da remoto. È possibile monitorare le metriche della macchina remota come l'utilizzo del disco, il carico della CPU, ecc. Può anche controllare le metriche delle macchine Windows remote tramite alcuni componenti aggiuntivi dell'agente Windows.

Vediamo come installare e configurare NRPE passo dopo passo sulla macchina client che deve essere monitorata.

Step 1 - Esegui il comando seguente per installare NRPE sulla macchina Linux remota da monitorare.

sudo apt-get install nagios-nrpe-server nagios-plugins

Step 2 - Ora, crea un file host all'interno della directory del server e inserisci tutte le definizioni necessarie per l'host.

sudo gedit /usr/local/nagios/etc/servers/ubuntu_host.cfg
# Ubuntu Host configuration file

define host {
   use linux-server
   host_name ubuntu_host
   alias Ubuntu Host
   address 192.168.1.10
   register 1
}

define service {
   host_name ubuntu_host
   service_description PING
   check_command check_ping!100.0,20%!500.0,60%
   max_check_attempts 2
   check_interval 2
   retry_interval 2
   check_period 24x7
   check_freshness 1
   contact_groups admins
   notification_interval 2
   notification_period 24x7
   notifications_enabled 1
   register 1
}

define service {
   host_name ubuntu_host
   service_description Check Users
   check_command check_local_users!20!50
   max_check_attempts 2
   check_interval 2
   retry_interval 2
   check_period 24x7
   check_freshness 1
   contact_groups admins
   notification_interval 2
   notification_period 24x7
   notifications_enabled 1
   register 1
}

define service {
   host_name ubuntu_host
   service_description Local Disk
   check_command check_local_disk!20%!10%!/
   max_check_attempts 2
   check_interval 2
   retry_interval 2
   check_period 24x7
   check_freshness 1
   groups admins
   notification_interval 2
   notification_period 24x7
   notifications_enabled 1
   register 1
}

define service {
   host_name ubuntu_host
   service_description Check SSH
   check_command check_ssh
   max_check_attempts 2
   check_interval 2
   retry_interval 2
   check_period 24x7
   check_freshness 1
   contact_groups admins
   notification_interval 2
   notification_period 24x7
   notifications_enabled 1
   register 1
}

define service {
   host_name ubuntu_host
   service_description Total Process
   check_command check_local_procs!250!400!RSZDT
   max_check_attempts 2
   check_interval 2
   retry_interval 2
   check_period 24x7
   check_freshness 1
   contact_groups admins
   notification_interval 2
   notification_period 24x7
   notifications_enabled 1
   register 1
}

Step 3 - Eseguire il comando mostrato di seguito per la verifica del file di configurazione.

sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Step 4 - Riavvia NRPE, Apache e Nagios se non ci sono errori.

service nagios-nrpe-server restart
service apache2 restart
service nagios restart

Step 5- Apri il tuo browser e vai all'interfaccia web di Nagios. Puoi vedere che l'host che deve essere monitorato è stato aggiunto al servizio principale di Nagios. Allo stesso modo, puoi aggiungere più host che devono essere monitorati da Nagios.