example powershell script
You can easily configure the SysOrb agent to execute powershell scripts. Get the result presented in a graph in SysOrb and configure the threshold for the check. Below is provided an example for inspiration on how to do it.
In custom.conf:
# # Custom check configuration for the SysOrb agent. # [System uptime] type=real command=powershell -NoLogo "C:\Get-UpTime.ps1" result_pattern=TotalDays: ([[:digit:]]+\.?[[:digit:]]*) timeout=120
In C:\Get-UpTime.ps1
## # Powershell script for getting system uptime in days ## # Helper Function - convert WMI date to TimeDate object function WMIDateStringToDate($Bootup) { [System.Management.ManagementDateTimeconverter]::ToDateTime($Bootup) } # Main script $Computer = "." # adjust as needed $computers = Get-WMIObject -class Win32_OperatingSystem -computer $computer foreach ($system in $computers) { $Bootup = $system.LastBootUpTime $LastBootUpTime = WMIDateStringToDate($Bootup) $now = Get-Date $Uptime = $now - $lastBootUpTime "TotalDays: {0}" -f [string]$Uptime.TotalDays } # End script