vROps Telegraf check Windows Service
Want to check if a Windows service is running with the new vROps Telegraf agent? I won’t discuss how to install the Application Remote Collector in order to install the Telegraf agent.
This blog picksup right after the prerequisites for installation are met and completed.
I use the following script to check whether a Windows service is running or not. The script can check that on the localhost or on a remote host (depending on your firewall settings).
<#
Author: Kabir Ali - info@kablog.nl
Scriptname: CheckWindowsService.ps1
Version: 1.0 (Tested)
Date: April 21 2020
Why: Customer needs to know if a service is running
Remark: Test setup
vROPs Version 8.0.1.15331180
Example: .\CheckWindowsService.ps1 -Service "wuauserv" -RemHost "192.168.18.10"
#>
<#
The whole idea behind this script is to return a 1 if a service is running and 0 for any other status
#>
### Define Defaults ###
Param (
[Parameter(Mandatory = $true)][string]$Service,
[Parameter(Mandatory = $true)][string]$RemHost
)
# Bypass SSL certificate verification
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
try {
if ((get-service $Service -ComputerName $RemHost).status -eq "Running") {
write-host 1
}
else {
write-host 0
}
}
catch {
Exit
}
Next all you need to do is create a custom script. In order to do so follow these steps:
In vROps go to Administration – Inventory – Manage Agents – Select a VM – Manage Service (8th button from the left) – Custom script.
Here is my example how I check a Citrix service.
Hope this helps!

