Nagios: Monitoring Windows


image

* Install the NSClient++ on remote Windows server

1) Download the NSClient++ from its offical download page. Make sure you use the right version for the server processor 32bit/ 64bit. In this sample, I use NSClient++-0.3.8-Win32.zip.

2) Unzip NSClient++-0.3.8-Win32.zip to C:\nsclient++.

3) Open a command prompt and change the path to C:\nsclient++, then run ‘NSclient++.exe –install’ to install it.

4) Edit the C:\nsclient++\ncs.ini file 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).

5) In the command prompt type ‘NSclient++.exe –start’. a green corss icon image will show in the system tray.

* The following configurations need to be made on the Nagios server

1) Uncomment windows.cfg in nagios.cfg

vi /usr/local/nagios/etc/nagios.cfg uncomment the follwing line:

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

2) Define the host and services in the windows.cfg file

define host{
	use		windows-server	; Inherit default values from a Windows server template (make sure you keep this line!)
	host_name		win2003-02
	alias		My Windows Server
	address		10.1.1.104
	}
define service{
	use			generic-service
	host_name			win2003-02 
	service_description	CPU Load
	check_command		check_nt!CPULOAD!-l 5,80,90
	}
define service{
	use			generic-service
	host_name			win2003-02 
	service_description	Memory Usage
	check_command		check_nt!MEMUSE!-w 80 -c 90
	}
define service{
	use			generic-service
	host_name			win2003-02 
	service_description	C:\ Drive Space
	check_command		check_nt!USEDDISKSPACE!-l c -w 80 -c 90
	}

3) If you set a password in NSclient++ (mentioned in the 1st part). You need to include the password in the check_nt command definition.

vi /usr/local/nagios/etc/objects/commands.cfg

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

4) Verify the nagios configuration file (use verinagios command which I mentioned in my previous post).

5) Reload the nagios service.

service nagios reload
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s