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!
Hello,
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!
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
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
Hello,
I had the same problem and all I had to do is to comment line 32. Now it works.
P.