Monitoraggio di sistemi Windows con Nagios

From RVM Wiki
Revision as of 12:10, 12 June 2008 by Gabriele.vivinetto (talk | contribs) (New page: Configurazione dell'agente sulla macchina Windows da monitorare: * Da prompt di DOS (su suppone Cygwin installato con wget e unzip) * Scaricare il client Windows ed installarlo: cd %TEM...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Configurazione dell'agente sulla macchina Windows da monitorare:

  • Da prompt di DOS (su suppone Cygwin installato con wget e unzip)
  • Scaricare il client Windows ed installarlo:
cd %TEMP%
wget http://files.nakednuns.org/x-0.3.x/NSClient%2B%2B-Win32-0.3.2.zip
mkdir %SYSTEMDRIVE%/NSClient++
unzip NSClient++-Win32-0.3.2.zip -d %SYSTEMDRIVE%/NSClient++
DEL NSClient++-Win32-0.3.2.zip
cd %SYSTEMDRIVE%/NSClient++
nsclient++ /install

  • Open the services manager and make sure the NSClientpp service is allowed to interact with the desktop (see the 'Log On' tab of the services manager). If it isn't already allowed to interact with the desktop, check the box to allow it to.
  • Edit the NSC.INI file (located in the C:\NSClient++ directory) and make the following changes:
    • Uncomment all the modules listed in the [modules] section, except for CheckWMI.dll and RemoteConfiguration.dll
    • Optionally require a password for clients by changing the 'password' option in the [Settings] section.
    • Uncomment the 'allowed_hosts' option in the [Settings] section. Add the IP address of the Nagios server to this line, or leave it blank to allow all hosts to connect.
    • Make sure the 'port' option in the [NSClient] section is uncommented and set to '12489' (the default port).
  • Avviare l'agente in test
nsclient++.exe /test

Se non ci sono messaggi di errore, digitare

exit
  • Avviare l'agente
nsclient++.exe /start

Si deve vedere l'icona nella Systray

Configurazione dell'agente monitorante Linux

SI suppone di voler monitorare il tutto da una macchina linux, la quale è interrgata poi via NRPE da un server centrale Nagios.

  • Verificare che si stata completata la configurazione dei NRPE
  • Testare il ping
/usr/lib/nagios/plugins/check_fping 192.168.1.100
FPING OK - 192.168.1.100 (loss=0%, rta=0.380000 ms)|loss=0%;;;0;100 rta=0.000380s;;;0.000000
  • Testare che NSClient++ sia accessibile da questa macchina Linux:
/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -v CLIENTVERSION -p 12489
NSClient++ 0.3.2.9 2008-05-17

Testare anche i comandi che si vorranno monitorare:

  • Per verificare che l'agente sia attivo:
/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -v CLIENTVERSION -p 12489 
NSClient++ 0.3.2.9 2008-05-17
  • Per l'Uptime
/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -v UPTIME -p 12489
System Uptime - 85 day(s) 16 hour(s) 34 minute(s)
  • Per il CPU Load
/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v CPULOAD -l 5,80,90
CPU Load 14% (5 min average) |   '5 min avg Load'=14%;80;90;0;100
  • Per l'utilizzo di memoria
/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v MEMUSE -w 80 -c 90
Memory usage: total:1255.98 Mb - used: 651.92 Mb (52%) - free: 604.06 Mb (48%) | 'Memory usage'=651.92Mb;1004.78;1130.38;0.00;1255.98
  • Per lo spazio sul disco C:
/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v USEDDISKSPACE -l c -w 80 -c 90
c:\ - total: 4.88 Gb - used: 4.48 Gb (92%) - free 0.40 Gb (8%) | 'c:\ Used Space'=4.48Gb;3.90;4.39;0.00;4.88
  • Per lo spazio sul disco D:
/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v USEDDISKSPACE -l d -w 80 -c 90
d:\ - total: 29.00 Gb - used: 22.10 Gb (76%) - free 6.90 Gb (24%) | 'd:\ Used Space'=22.10Gb;23.20;26.10;0.00;29.00
  • Se tutto è corretto, aggiungere i comandi in nrpe_local.cfg

sudoedit /etc/nagios/nrpe_local.cfg

command[check-manserver-ping]=/usr/lib/nagios/plugins/check_fping 192.168.1.100 command[check-manserver-ping]=/usr/lib/nagios/plugins/ command[check-manserver-nsclient]=/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v CLIENTVERSION command[check-manserver-uptime]=/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v UPTIME p 12489 command[check-manserver-cpuload]=/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v CPULOAD -l 5,80,90 command[check-manserver-memuse]=/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v MEMUSE -w 80 -c 90 command[check-manserver-disk-c]=/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v USEDDISKSPACE -l c -w 80 -c 90 command[check-manserver-disk-d]=/usr/lib/nagios/plugins/check_nt -H 192.168.1.100 -p 12489 -v USEDDISKSPACE -l d -w 80 -c 90

  • Riavviare nrpe

sudo /etc/init.d/nagios-nrpe-server restart

Configurazione del Server Nagios

Dato che l'host Windows da monitorare non è raggiungibile, si deve definire l'host con un comando di monitoraggio diverso:

sudoedit /etc/nagios/hosts.cfg

define host{
        use                     generic-host
        host_name               manserver.mannesmann.priv
        alias                   Mannesmann Server
        address                 man.rvmgroup.it
        check_command           check-nrpe!check-manserver-ping
        }