Sie sind hier

Event Handlers and Multiple Windows Services via Host Attributes

3 posts / 0 new
Letzter Beitrag
jfarr2008
Bild des Benutzers jfarr2008
Event Handlers and Multiple Windows Services via Host Attributes

I monitor multiple Windows Server Services by using host attributes.  My check for a windows service looks like this:

check_nrpe -H $HOSTADDRESS$ -c nsc_checkservicestate -a 'ShowAll "%WINDOWS_SERV%=started"'

I have several services that I check on each host and when they don't start I'd like them to be restarted.  

On the Service Check that I use on the Advanced tab I've entered in the following for Event Handler:

windows_service_restart $SERVICESTATE$ $HOSTADDRESS$ %WINDOWS_SERV%

It doesn't seem to work with the attribute in there but does work if i specify the service like 'spooler' or another specific one.  Any ideas on how i can have it restart multiple services?

 

 

jfarr2008
Bild des Benutzers jfarr2008
Re: Event Handlers and Multiple Windows Services via Host ...
I went back and created a specific check for a few services as a work around because I felt like my services with spaces in the names weren't passing.     Here is what I'm attempting from the command line of my opsview server:   ./windows_service_restart CRITICAL servername '\"Windows Service with Spaces\"'   This isn't working and it seems it's due to the spaces in the service name.  I can successfully run the restart if the service is one word or has no spaces ie spooler   How can pass that service with no spaces?  I tried using the Macro for the service description ($SERVICEDESC$) and putting it in the event handler like so:   windows_service_restart $SERVICESTATE$ $HOSTADDRESS$ $SERVICEDESC$    Still no luck.  I'm probably missing something obvious here.  Any help is much appreciated.    
jfarr2008
Bild des Benutzers jfarr2008
Re: Event Handlers and Multiple Windows Services via Host ...

Well I have one issue resolved and that's with the services with spaces in the name.  I had to use the following event handler:

windows_service_restart $SERVICESTATE$ $HOSTADDRESS$ '"Service with Spaces"'

Using the provided syntax from the blog post and the Opsview Wiki didn't work.  As for now I can create service checks for those specific services I desperately need to be able to restart if they stop.