Monitoring Windows Services

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Monitoring Windows Services

Post by ahoward12 »

Hey Gents, I need some help monitoring some Windows Services. The concept is easy I just cannot understand the syntax correctly . I have searched all over and while I find many people have the issue I have not found any clear language on how this should be working. I am comfortable with the CLI however, I use the GUI to modify hosts and services. I am trying to generate an alert when this service is 'stopped' or 'not running', and an 'OK' when service is up. What am I missing?

No matter what I do I either get:
[[email protected] ~]$ /usr/local/nagios/libexec/check_nt -H 10.10.108.5 -s "" -p 12489 -v SERVICESTATE -l Oracleagent12c1Agent
OK: All services are in their appropriate state.

or

[[email protected] ~]$ /usr/local/nagios/libexec/check_nt -H 10.10.108.5 -s "" -p 12489 -v SERVICESTATE -l Oracleagent12c1Agent -d SHOWALL
Oracleagent12c1Agent: Started



Nagios XI 5.4.4
CentoOS 6.8
VMware
dwasswa

Re: Monitoring Windows Services

Post by dwasswa »

Hi @ahoward12,

To configure services from GUI follow:Using The Core Config Manager For Service Management

To configure notifications or alerts follow: How to Configure Email And Text Notifications

For information on how to use commands /plugins and syntax please follow: Nagios Plugins

Please let me know if you have any questions.
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Re: Monitoring Windows Services

Post by ahoward12 »

Thanks for links but I fully understand how to do all of that. I have had Nagios XI in production for quite sometime. I am having an issue with the syntax of the specific service below.
kyang

Re: Monitoring Windows Services

Post by kyang »

I think what you have is sufficient? When the service is not running it will return critical.
Here's something I spun up, so you can visualize it.

Code: Select all

/usr/local/nagios/libexec/check_nt -H 192.168.3.46 -s "welcome" -p 12489 -v SERVICESTATE -l nxlog
 OK: All 1 service(s) are ok.
This is when I turned off my nxlog service.

Code: Select all

[root@localhost libexec]# /usr/local/nagios/libexec/check_nt -H 192.168.3.46 -s "welcome" -p 12489 -v SERVICESTATE -l nxlog
 CRITICAL: nxlog: Stopped, delayed ()
error.PNG
I am trying to generate an alert when this service is 'stopped' or 'not running', and an 'OK' when service is up. What am I missing?
Is this what you wanted to see? I get alerts when my nxlog service is not running or "Stopped" and alerts when my service is running or "ok"
You do not have the required permissions to view the files attached to this post.
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Re: Monitoring Windows Services

Post by ahoward12 »

Yes, that was exactly what I was looking for, thank you. However that doesn't work for me for several reasons... While I am creating the command and I use the "Run Check Command" button I get this while the service is running on the server:

[[email protected] ~]$ /usr/local/nagios/libexec/check_nt -H 10.10.99.42 -s "" -p 12489 -v SERVICESTATE -l dnscache
OK: All services are in their appropriate state.

If I stop the service and run that exact same command I get this:

[[email protected] ~]$ /usr/local/nagios/libexec/check_nt -H 10.10.99.42 -s "" -p 12489 -v SERVICESTATE -l dnscache
dnscache: Stopped

It would like this is working..But it's not. It doesn't work when I save and apply the configuration. The service in Nagios always comes up as "Unknown" no matter if the Windows Service on the Server is running or not.

"View Attached Screenshot"

It appears it is looking for critical and warning defined, but I have tried every way I can think of with no luck.
You do not have the required permissions to view the files attached to this post.
kyang

Re: Monitoring Windows Services

Post by kyang »

I think I know what happened, but we can double check.

Can you show me how you check_nt command is defined?

And how you defined this service in XI?
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Re: Monitoring Windows Services

Post by ahoward12 »

Here is my check_nt
check_nt.png
Here is the check_xi_service_nsclient that is referencing the check_nt
Check_xi.png
Here is the template applied to the service
Service.png
You do not have the required permissions to view the files attached to this post.
kyang

Re: Monitoring Windows Services

Post by kyang »

This is how mine looks like, and it works just fine. I do have one less $ARG$, see if it works with it, but if not try deleting it and test it.

Next, I notice you don't have a password in your -s "". Did you delete this before taking a snapshot or was it not in there?

I do see that you don't have any hosts assigned or templates? I used the xiwziard_windowsdesktop_nsclient_service as the template

As always, make sure to apply your configuration and then force an immediate recheck on your service to see if it works.
template.PNG
service2.PNG
service.PNG
Let me know if this helps.
You do not have the required permissions to view the files attached to this post.
ahoward12
Posts: 137
Joined: Thu Jan 05, 2017 10:24 am

Re: Monitoring Windows Services

Post by ahoward12 »

So I had everything right from the beginning. It was just a bug, I deleted it and remade it and it works. What a headache...Thanks for help.
kyang

Re: Monitoring Windows Services

Post by kyang »

No problem! Sometimes it takes two haha.

Am I okay to close this thread?
Locked