This can be done with a custom script and the EXE/Script Advanced sensor. Following script needs to be saved as .ps1 file and stored in \Custom Sensors\EXEXML
param([string]$Path, [string[]]$Strings)
Write-Output "<prtg>"
foreach ($String in $Strings) {
$NumberString = Select-String -Path $Path -Pattern $String -AllMatches
$ValueString = $NumberString.Matches.Count
Write-Output "<result>
<channel>$String</channel>
<value>$valueString</value>
</result>"
}
Write-Output "</prtg>"
Afterwards you can add the sensor and add following in field Parameters:
-Path "C:\YourLocation\Logfile.txt" -Strings YourString1,YourString2,YourString3
Important: Please note that officially we do not support customization of any kind. If it's not working as expected, or if it stops working with newer PRTG versions, we won't be able to assist you further. Please also refer to the following article which explains why we can't officially offer any customization help for PRTG: https://kb.paessler.com/en/topic/78334
Add comment