Page 1 of 2

Windows Service Check not working

Posted: Sun May 27, 2018 5:54 pm
by kwhogster
Nagios Core 4.3.4
NSClient 4.4.23
Windows 2012 R2 Servers
SQL 2014

I have 2 Windows 2012 R2 Cluster Servers with SQL 2014 Both are VM;s on VMWare 6.5
I have three SQL instances running.

MSSQLSERVER
MSSQLSERVER$PROD1
MSSQLSERVER$PROD2
I set up Windows Service checks for the services so that the services that use the databases have a dependency for that sql service.

Both MSSQLSERVER$PROD1 and MSSQLSERVER$PROD2 work fine I get this error for MSSQLSERVER


MSSQLSERVER

This service has 2 comments associated with it This service problem has been acknowledged This service is currently in a period of scheduled downtime

CRITICAL 05-27-2018 18:40:10 0d 0h 7m 15s 10/10 SERVICE CRITICAL - 1 service(s).

My Define services are like this

Code: Select all

define service{
        use                     generic-service
        host_name               SERV014-N1
        service_description     MSSQLSERVER
        servicegroups           Services
        check_command           check_nrpe!check_winservice! -a "--service mssqlserver --state stopped,paused --critical 0"
        check_period            backup_WIN12
        notification_period     backup_WIN12
        }
define service{
        use                     generic-service
        host_name               SERV014-N1
        service_description     MSSQLWRESTLING
        servicegroups           Services
        check_command           check_nrpe!check_winservice! -a '--service MSSQLWRESTLING --state stopped,paused --critical 0'
        check_period            backup_WIN12
        notification_period     backup_WIN12
        }
define service{
        use                     generic-service
        host_name               SERV014-N1
        service_description     MSSQLSHAREPOINT
        servicegroups           Services
        check_command           check_nrpe!check_winservice! -a '--service MSSQLSHAREPOINT --state stopped,paused --critical 0'
        check_period            backup_WIN12
        notification_period     backup_WIN12
        }
My ini file entry

; Check Windows Service
check_winservice = scripts\\check_winservice.exe $ARG1$ $ARG2$ $ARG3$

Using this plugin works for all others except for this one service very strange.

You would think I would have an issue with the ones with the $ sign



https://www.itefix.net/check_winservice

Any ideas or thoughts


Thank you

Tom

Re: Windows Service Check not working

Posted: Mon May 28, 2018 8:19 pm
by kwhogster
Update

I tried the command from the Nagios server command line and it works.

root:/usr/local/nagios/etc/objects/windowsservers# /usr/local/nagios/libexec/./check_nrpe -H x.x.x.x -c check_winservice -a '--service mssqlserver --state stopped --critical 0'
SERVICE OK - 0 service(s).|'services'=0;;0

On the web page I see this now on all three services


MSSQLSERVER

This service has 2 comments associated with it This service problem has been acknowledged This service is currently in a period of scheduled downtime

UNKNOWN 05-28-2018 21:12:08 0d 3h 30m 12s 10/10 Unknown command(s): check_winservice


MSSQLSHAREPOINT

This service has 1 comment associated with it This service is currently in a period of scheduled downtime

UNKNOWN 05-28-2018 21:11:03 0d 3h 35m 2s 10/10 Unknown command(s): check_winservice


MSSQLWRESTLING

This service has 1 comment associated with it This service is currently in a period of scheduled downtime

UNKNOWN 05-28-2018 21:04:00 0d 3h 33m 8s 10/10 Unknown command(s): check_winservice


All three work from command line as above

My INI and this is NSCLIENT 5.144 the other server is 4.4.23 both have the same problem I have other services using the same define service and they are working.

Code: Select all

; Check Windows Service 
check_winservice = scripts\\check_winservice.exe $ARG1$ $ARG2$ $ARG3$

Re: Windows Service Check not working

Posted: Tue May 29, 2018 4:14 pm
by scottwilkerson
So if they work from the command line then the windows nsclient setup should be fine.

Can you share your check_nrpe definition so we can make sure the check_command in your services will produce the same line as you showed that works from the CLI

Re: Windows Service Check not working

Posted: Tue May 29, 2018 6:52 pm
by kwhogster
Scott

Code: Select all

define service{
        use                     generic-service
        host_name               SERV014-N1
        service_description     MSSQLSERVER
        servicegroups           Services
        check_command           check_nrpe!check_winservice! -a "--service mssqlserver --state stopped,paused --critical 0"
        check_period            backup_WIN12
        notification_period     backup_WIN12
        }
define service{
        use                     generic-service
        host_name               SERV014-N1
        service_description     MSSQLWRESTLING
        servicegroups           Services
        check_command           check_nrpe!check_winservice! -a '--service MSSQLWRESTLING --state stopped,paused --critical 0'
        check_period            backup_WIN12
        notification_period     backup_WIN12
        }
define service{
        use                     generic-service
        host_name               SERV014-N1
        service_description     MSSQLSHAREPOINT
        servicegroups           Services
        check_command           check_nrpe!check_winservice! -a '--service MSSQLSHAREPOINT --state stopped,paused --critical 0'
        check_period            backup_WIN12
        notification_period     backup_WIN12
        }
I changed them to remove the " --state stopped,paused --critical 0'" cause they are on both cluster servers and they are set to manual startup

with the --state stopped,paused --critical 0' the command fails

Thanks

Tom

Re: Windows Service Check not working

Posted: Wed May 30, 2018 7:29 am
by scottwilkerson
kwhogster wrote: I changed them to remove the " --state stopped,paused --critical 0'" cause they are on both cluster servers and they are set to manual startup

with the --state stopped,paused --critical 0' the command fails

Thanks

Tom
I was actually looking for the command definition for nrpe , not the service definitions, however, are they working now? Based on your statement they are working and if that is the can we done need to see any further configurations.

Re: Windows Service Check not working

Posted: Wed May 30, 2018 8:57 am
by kwhogster
Scott,

my nrpe command

Code: Select all

define command{
        command_name    check_nrpe
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 120 -c $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
this is use by all my other services and they all are working.

Re: Windows Service Check not working

Posted: Wed May 30, 2018 10:56 am
by scottwilkerson
What error are you getting for the services that are not working?

Re: Windows Service Check not working

Posted: Wed May 30, 2018 1:21 pm
by kwhogster
This is the error:

CRITICAL 05-27-2018 18:40:10 0d 0h 7m 15s 10/10 SERVICE CRITICAL - 1 service(s).

Re: Windows Service Check not working

Posted: Wed May 30, 2018 2:12 pm
by scottwilkerson
That just means the service isn't running (or is running depending on your command)

Re: Windows Service Check not working

Posted: Wed May 30, 2018 2:26 pm
by kwhogster
Ths service is running

Is there another way for check_nrpe to check services a plugin or internal command?