23 July 2015

monitor remote windows host using nagios

  1. setup nsclient++

    1. download the latest version

    2. install

    3. config. modules setction check how to monitor windows servers using nagios and nsclient

       # edit `C:\Porgram Files\NSClient++\nsclient.ini`
       [/settings/default]
       allowed hosts = 192.168.120.151,192.168.120.155
      
       [/settings/NRPE/server]
       allowed hosts = 192.168.120.151,192.168.120.155
       allow arguments = 1
       allow nasty characters = false
       port = 5666
       use SSL = 1
       insecure = true
      
       [/modules]
       NRPEListener.dll
       NSClientListener.dll
       FileLogger.dll
       CheckSystem.dll
       CheckDisk.dll
       CheckEventLog.dll
       CheckHelpers.dll
       CheckExternalScripts.dll
       NRPEServer = 1
      
    4. check use netstat

       > netstat -ano | findstr 5666
      
    5. check use telnet

       $ telnet localhost 5666
      
    6. check use check_nrpe if CHECK_NRPE: Error - Could not complete SSL handshake.

       $ /usr/lib/nagios/plugins/check_nrpe -H node1
       I (0.4.3.143 2015-04-29) seem to be doing fine...
      
       # fixed
       [/settings/NRPE/server]
       insecure = true
      
  2. add host in nagios

    1. add node1.cfg to /usr/local/nagios/etc/servers

       $ sudo pico node1.cfg
       define hostgroup{
           hostgroup_name        windows-servers
           alias                 windows-servers
       }
      
       define host{
           use                   windows-server
           host_name             node1
           alias                 node1
           address               192.168.120.151
           max_check_attempts    5
           check_period          24x7
           notification_interval 30
           notification_period   24x7
       }
      
       define service {
           host_name             node1
           service_description   PING
           check_command         check_ping!100.0,20%!500.0,60%
           check_interval        1
           check_interval        2
           max_check_attempts    4
           retry_interval        2
           notification_interval 2
       }
      
    2. restart nagios

       $ sduo service nagios restart
      
    3. visit http://node5/nagios/

  3. fixed

    1. check uptime

       define service{
           use                   generic-service
           host_name             node1
           service_description   uptime
           check_command         check_nt!UPTIME
       }
      
       connect to address 192.168.120.151 and port 12489: Connection refused 
      


blog comments powered by Disqus