Wednesday 9 March 2016

Setup a Windows server with NAGIOS Core

Setting up the windows agent for NAGIOS allows us to monitor components such as memory, cpu, services etc. that would otherwise not be possible.

We should firstly ensure that the 'check_nt' plugin is installed:

ls -l /usr/local/nagios/libexec | grep check_nt

We have to do a few pre-requisites - firstly enabling the Windows object definitions:

sudo vi /usr/local/nagios/etc/nagios.cfg

and uncomment:

#cfg_file=/usr/local/nagios/etc/objects/windows.cfg

Download the latest NSClient++ client from:

https://sourceforge.net/projects/nscplus/

Install it on the Windows server - follow the wizard and ensure that you add the IP address of the NAGIOS server for the 'Allowed Hosts' section and also ensure the following is ticked:

'Enable common check plugins'
'Enable nsclient server (check_nt)'
'Enable check_nrpe server'

Now to go 'Services' and ensure the NCCClient service has started. If we need to make any further changes to the Windows client we can simply edit 'nsclient.ini' within the NCCClient directory and restart the service.

Note: If you would like to pass arguments with the NRPE client on the NAGIOS server you should add the following to nsclient.ini on the host with NSClient++ installed:

[/settings/NRPE/server]
allow arguments=1

and then restart the NSClient++ service.

We should now create the object definition on the NAGIOS server:

sudo vi /usr/local/nagios/etc/objects/windows.cfg

We can define a host as follows:

define host{
use windows-server ; Inherit default values from a Windows server template (make sure you keep this line!)
host_name winserver
alias My Windows Server
address 192.168.1.2
}

and then add the relevent service definitions:

define service{
use generic-service
host_name winserver
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}

define service{
use generic-service
host_name winserver
service_description Uptime
check_command check_nt!UPTIME
}

Check your config with:

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

Finally restart the nagios server with:

sudo service nagios restart
sudo service httpd restart

0 comments:

Post a Comment