Windows services with spaces


#1

I’m working on adding my critical windows services into Nagios so I know their state. For Services that are all one word it’s fine, but I’m not sure how to have it check on the services where there are spaces in it’s name.

The services description is as follows:

define service{
use generic-service
host_name hermes
service_description Apache Tomcat ADAM
check_command check_nt!SERVICESTATE!-d SHOWALL -l ‘Apache Tomcat ADAM’
}

I’ve tried putting double quotes, single quotes, and nothing around the service name but nothing works. I know at the windows CLI I would just do a net stop “Apache Tomcat Adam” to shut the service down. So what would I have to put here so it could check the state of that service?

Thanks in advance!
–Aric


#2

Here is an example of how I do it. I always use the actual service name and not the display name. (They are not always the same and sometimes the service name is shorter and has no spaces.) In this example, they are both the same.

Create a service for monitoring the BEA Web Service

define service{
contact_groups +bea
use windows-service
hostgroup_name bea
service_description BEA Web Service
check_command check_nt!SERVICESTATE!-d SHOWALL -l ‘beasvc mydomain_myserver’