Friday, February 5, 2010

Monitor windows server with Nagios - basic configuration

reference
http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html
http://nsclient.org/nscp/

According to the NSClient wiki NRPE is the recommended way to monitor windows. However, the preconfigured commands in Nagios is using check_nt. I will stick to check_net for the basic stuff, at least for the moment.


1) Install NSClient on remote windows server
http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html
The latest client have a different installation than in the instruction.

a) run setup .exe. Install all components. Skip configuration.
Firewall exception will give an error but never mind that.

b)in NSC.ini
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
CheckHelpers.dll
(and NRPEListener.dll id nrpe should be used)

add nagios server to allowed_hosts=

c) start service

??? More later. (already setup on test machine)

2) Configure Nagios
http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html
a) Enable the windows config file
sudo nano /usr/local/nagios/etc/nagios.cfg

Remove the leading pound (#) sign from the following line in the main configuration file:
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg

b) Define host
sudo gedit /usr/local/nagios/etc/objects/windows.cfg

Find

define host{
use windows-server ;
host_name winserver
alias My Windows Server
address 192.168.1.2
}

Change host_name, alias and address (dns name is ok as address)
(Add new host by copy example...)

c) sudo gedit /usr/local/nagios/etc/objects/windows.cfg
Change the host_name in the sample
define service{
and comment out the ones you do not need
(copy sample to adds service for new host)

d) If NSClient is set up to use password:
sudo nano /usr/local/nagios/etc/objects/commands.cfg

Change the definition of the check_nt command to include the "-s " argument (where PASSWORD is the password you specified on the Windows machine) like this:

define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s PASSWORD -v $ARG1$ $ARG2$
}

e) Check config and restart
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

sudo /etc/init.d/nagios restart

Now you should have basic monitoring of one win server!

No comments:

Post a Comment