Friday, October 05, 2012

How to monitor Windows machine using NAGIOS - NRPE

For monitoring system parameters of a windows computer using NAGIOS or Icinga , the best tool available is NSClient++ ( Visit http://nsclient.org)

 Here I demonstrate NSClient++ isntallation to monitor Windows Vista machine using NAGIOS installed on a Ubuntu server. Without  NAGIOS or Icinga , NSclient++ is meaningless .

Step 1 :  Download NSClient++ tool in your Windows PC . (http://files.nsclient.org/x-0.4.x/NSCP-0.4.0.183-Win32.msi is the latest one as of now. )

Step 2 : Install it . Type your NAGIOS server IP as allowed hosts . Also enable common check and NRPE server during installation .
 Step 3 :  Finish the installation . Installation directory will be C:\Program Files\NSClient++ . Go to that directory and find the configuration file .  In NSClient++ version 0.4 , it is nsclient.ini   . In version 0.3 it is NSC.ini  .

Step 4:  Make sure that in the [modules] section contains lines NRPEListener.dll , CheckExternalScripts.dll and some checks like CheckSystem.dll , CheckDisk.dll , CheckEventLog.dll , CheckHelpers.dll

My modules section is as follows:

[modules]
NRPEListener.dll
NSClientListener.dll
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
CheckEventLog.dll
CheckHelpers.dll
CheckExternalScripts.dll

Step 5: For NSClient++ version 0.4 ,  In the section [/settings/NRPE/server]

Add these lines.
allowed hosts=10.52.2.41(This is my NAGIOS server IP , give yours here!)
allow arguements=1
port=5666
allow nasty characters=1

For NSClient++  version 0.3  , In the section  [NRPE]

Uncomment these options .
port=5666
allow_arguments=1
allow_nasty_meta_chars=1
allowed_hosts=10.52.2.41

Step 6: Go to Run and type services.msc . Find the NSClient++ service and restart that .


Now we have finished the configuration in Windows machine . Now in the ubuntu machine running nagios , try to get the NRPE check statuses in the command line . If it is working fine , we will add services in NAGIOS .

Step 1 :  Check whether you installed nagios-nrpe-plugin . If not , install it . You can use the command  "dpkg -L nagios-nrpe-plugin " to check it .

Step 2 .  Now try to get some status from the windows machine(IP address is 10.52.20.3 ) by command
"/usr/lib/nagios/plugins/check_nrpe  -H 10.52.20.3  -c alias_cpu" .  If this gives
OK CPU Load ok.|'5m'=4%;80;90 '1m'=5%;80;90 '30s'=5%;80;90  as the output, you configured NSClient++ properly .

If not working please check whether the port you mentioned is not blocked .

Step 3 : If working ,  you can add the commands to NAGIOS .
For the host you want to monitor , add a service .

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       vistamachine
        service_description             Drive Usage
        check_command                   check_nrpe!alias_disk
        }



2 comments:

  1. Thanks for the post..It really works!

    ReplyDelete
  2. Thank you for this. Very little current documentation for 0.4 with nrpe.

    One thing, I don't load my modules on a fresh install with *.dll

    I use CheckSystem = 1

    ReplyDelete