Go to All Forums

Monitor for individual Windows services

by it11

Hello,

We've seen this mentioned before by others but we want to request again: Can you give us the ability to create a monitor for an individual Windows service? This would be very helpful if you have critical services that you want to view independently in a Status page. We have several such Windows services that we would like to see the health of on our Status page regardless of the status of the server itself.

 

We especially want to group these Windows services (from different servers) into Monitor Groups so we can organize our Status pages into Applications or Products. Everyone at our company wants to view our infrastructure by Application or Product -- not by server. Thank you for your consideration of this new feature!

Reply 3
Replies (6)

Re: Monitor for individual Windows services

Hello,

We would suggest you to write plugins to be able to create individual monitors for the services as a temporary work around as we do not have the feature to have a separate service monitor at present.
 
Once added as plugins, they can also be grouped and displayed in the status page with their performance attributes. 
 
We shall add this request to our product roadmap and prioritize it based on the community response for the same.
 
Thanks,
Saranya
Reply 0

Re: Re: Monitor for individual Windows services

by it11

Thank you! That is a good work-around. We successfully added a custom Windows Server plug-in and added it as a subgroup to our status page. Everything looks good!

 

However, we need a Powershell script (or any other format script) which simply queries Up/Down status of the Windows service and alerts when Down. Do you have an example of a script which tells Up/Down status of Windows service? Thank you very much!

Reply 0

Re: Re: Re: Monitor for individual Windows services

Hello,

Please follow the below steps to monitor a Windows service with a plugin. 

1. Find attached a zip file named ServicePlugin.zip.

2. Unzip the file under "<Agent installed directory>\Site24x7\WinAgent\monitoring\Plugins" folder.  

3. Now, open the script ServicePlugin.ps1, present under the directory "ServicePlugin".

4. In the script, replace the string "<Enter your Service name>" with the service name which you would like to monitor.

5. The server monitoring agent will automatically detect the plugin and mark it for monitoring. 

 

Hope this helps. Please write to us for further queries.

 

Thanks!

Muralikrishnan

Attachments
ServicePlugin.zip
Size: 0.79 KB
Reply 0

Re: Re: Re: Re: Monitor for individual Windows services

by it11

Thank you so much for the sample custom plugin for a Windows service. We edited it to monitor the Windows Power service (see below) but receive a "Plugin output is empty or not in Json format" error.

We have tried re-registering the plugin and incrementing the version # but we continue to get the same error. FYI, we are using the Version 18.0.4 of the Windows Server monitor. Thank you for any help you can offer!

 

Function Add-Data
([string]$json,[string]$key,[string]$value,[bool]$isobj)
{
if($key -ne $null -and $value -ne $null)
{
if($json.Length -gt 0)
{
$json = $json -replace "(.*)}(.*)", '$1,$2'
}
else
{
$json = $json + "{"
}
if($isobj -eq $true)
{
$json = $json + [char]34 + $key + [char]34 + " : " + $value +"}"
}
else
{
$json = $json + [char]34 + $key + [char]34 + " : " + [char]34 + $value + [char]34 +"}"
}
}
return $json
}

$version = "1"

$heartbeat = "True"

$servicename = "Power" #service name
$serviceObj = Get-Service | Where-Object {$_.Name -eq $servicename}
$serviceObj.Status
$status = 1
$data = ""
if($serviceObj.Status -eq "Running")
{
$status = 0
}
$data = Add-Data $data "status" $status

$mainJson = ""
$mainJson = Add-Data $mainJson "version" $version
$mainJson = Add-Data $mainJson "data" $data $true
$mainJson = Add-Data $mainJson "heartbeat" $heartbeat
$mainJson = Add-Data $mainJson "displayname" $serviceObj.Displayname
if($msg.Length -gt 0)
{
$mainJson = Add-Data $mainJson "msg" $msg
}

return $mainJson

Reply 0

Re: Re: Re: Re: Re: Monitor for individual Windows services

Hello,

I had the same problem and all I had to do is to comment line 32. Now it works.

 

P.

Reply 1

Re: Re: Re: Re: Re: Re: Monitor for individual Windows services

by it11

That fixed it, Philippe! Thank you very much!

Reply 0