Hello,
I can't seem to enable "Enable alerting based on limits" via my script.
As far as I'm concerned, you have to set <LimitMode>1</LimitMode> to do so. LimitMaxWarnings and LimitMaxError are written to the channel just fine.
Here is my script:
Write-Host "<?xml version="1.0" encoding="UTF-8" ?>"
Write-Host "<prtg>"
Get-ChildItem "MY PATH" -Recurse -include *.nsf | Where-Object {($_.Length -gt "5e+10")} | ForEach-Object {
[string]$filename = $_.Name
[float]$filesize = $_.Length
Write-Host "<result>"
Write-Host "<Channel>$filename</Channel>"
Write-Host "<Value>$filesize</Value>"
Write-Host "<CustomUnit>GB</CustomUnit>"
Write-Host "<VolumeSize>GigaByte</VolumeSize>"
Write-Host "<Float>1</Float>"
Write-Host "<DecimalMode>Auto</DecimalMode>"
Write-Host "<LimitMode>1</LimitMode>"
Write-Host "<LimitMaxWarning>53687091200</LimitMaxWarning>"
Write-Host "<LimitMaxError>64424509440</LimitMaxError>"
Write-Host "</result>"
}
Write-Host "</prtg>"
As a result I get separate channels for all .NSF files above 50 GB with their filesize in GB as value for the given PATH.
e.g.:
But in the channel settings Value Lookup and Limits is set to
Although when I manually switch it to Enable alerting based on limits LimitMaxWarning and LimitMaxError are set correctly:
My question is, how can I Enable alerting based on limits by default via my script?
Thanks in advance! lukas_sch
Hi there,
I am sorry for all the work you put into the explanation above, but the answer is simple. It is currently a bug due to the change of the alerting. So in the next version which will be released in the next weeks, the Limits will work again from Custom Scripts.
Sorry for the hassle. :(
Best regards.
Mar, 2018 - Permalink