Page 1 of 2

Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 1:19 pm
by spideyz30
Hi all,

I have successfully setup my nagios monitoring server and its works very good when i am monitoring disk space on several of our servers. However, recently, i was asked to monitor a specific service on one of our machines, and i followed the documentation. Strange thing is even with the correct syntax , i still get a message saying "C not found". I am not using the usediskspace from check_nt, so i dont know what else i should check.

Here is what i have in my windows.cfg file

define service{
host_name hostname.aimfire.net
service_description service ( values i changed for obvious reasons)
check_command check_nt!SERVICESTATE!-d SHOWALL -l service
max_check_attempts 1
check_period 24x7
notification_interval 60
notification_period 24x7
contact_groups admins
}

Any help is gladly appreciated.

Thanks

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 1:40 pm
by slansing
Before checking the results in the Nagios web UI, have you tried running the command from your Nagios server's CLI? Can you share how you are running the command manually?

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 1:57 pm
by spideyz30
Hi slansing

i didnt think of running the CLI first, i did and here is the result


./check_nt -H 192.168.1.22 -v SERVICESTATE -d SHOWALL -l service
Connection refused
could not fetch information from server


Weird, i am looking on the server itself, nsclient.ini seems to have the right config....

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 2:18 pm
by slansing
Verify the following:

- Verify that your Nagios server's IP is correctly defined in your NSC.ini file
- Ensure nsclientlistener.dll is not commented out in the modules section
- Ensure netstat -an shows windows is listening on port 5666, and 1248

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 2:40 pm
by spideyz30
Looks like 1248 is already in use as my server has a connection established on that port.

However 5666 is listening, and i see 12489 as well, im assuming this is the nagios service...?

Is there a way to change the nsclient to listen on a different port?

thanks for your help

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 2:44 pm
by slansing
Under the NSC.ini file look for a line titled similar to this:

Code: Select all

;# NSCLIENT PORT NUMBER
;  This is the port the NSClientListener.dll will listen to.
Here you can change the port, though the currently in use one may be being used by NSClient, try stopping the service then checking again.

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 3:22 pm
by spideyz30
In the nsclient.ini file, i see no such line.

Its not in the modules section. im using NSCP-0.4.1.61

Maybe its my version thats outdated?

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 3:26 pm
by slansing
No, you have one of the newest versions which can cause issues. 0.3.9 is the recommended release to use, however you should be able to compile for the additional options, if you look at the top of your NSC.ini file you should see a command to run from the CLI to enable these options. The command may be different than the one I have so if it is not there let me know.

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 3:40 pm
by spideyz30
I have downloaded and installd the 0.3.9 release,

i do find the information you mentionned, so i changed the port number, just not sure if i uncommented right

NSclient PORt number
This is the port the nsclientlistener.dll will listen to.
port=12489

So i just took out the ";" that were in front of that line?

Re: Monitoring a windows service with Nagios

Posted: Tue Jan 22, 2013 3:50 pm
by slansing
Yes the following line must be un-commneted, leave the two above it describing it commented:

Code: Select all

port=12489
Most admins have changed the port from 12489 to 5666 because it is easier to manage and is close to 5667 which is what NSCA uses, just make sure once you place 5666 in the configuration file that you unblock it from your Windows firewall on both incoming and outgoing, and the same for your nagios server.