Hey,

I would like to know, where I can set a value to update the "Last report" after a warning occured, if even possible...

To explain a bit more: I am using a powershell script to monitor large files. The script checks for files larger than 50GB in a certain directory. After the directory is processed the script also outputs my thresholds (hardcoded, just so I can see some lines in the PRTG graphs. pink is warnung, olive is error, teal is filesize, blue is runtime

ForEach{
Write-Host "<result>"
Write-Host "<Channel>$filename</Channel>"
Write-Host "<Value>$filesize</Value>"
Write-Host "</result>"
}
# threshold warning @ 55GB
Write-Host "<result>"
Write-Host "<Channel>Grenzwert Warnung</Channel>"
Write-Host "<Value>59055800320</Value>"
Write-Host "<CustomUnit>MB</CustomUnit>"
Write-Host "<VolumeSize>MegaByte</VolumeSize>"
Write-Host "</result>"
# threshold error @ 60GB
Write-Host "<result>"
Write-Host "<Channel>Grenzwert Fehler</Channel>"
Write-Host "<Value>64424509440</Value>"
Write-Host "<CustomUnit>MB</CustomUnit>"
Write-Host "<VolumeSize>MegaByte</VolumeSize>"
Write-Host "</result>"

I wrote the thresholds at the end, so I can see the largest file as primary channel in PRTG

Everything works as intended and I get the following warning once a file got above 55GB

Now here is the problem: After shrinking the file below 50GB I of course get "no value" for the channel that was created for the former large file.
But the "last report" from the seconds screenshot persists!

I noticed I can get rid of the warning by switching primary channel to e.g. "Laufzeit" and back again, but would like to know:

-> Would there be a programmable solution for this? Can I tell PRTG that if the value for a channel is "no data / no value" the last report should change to OK:


Article Comments

Hi there,

Thanks for your extensive explanation. Is it possible that you have set certain limits in the channel settings of the alerting channel (the one that is censored)? If so, then please disable them.

Please note that the "Keine Daten" indicates that no data is offered for this channel.

Best regards.


Apr, 2018 - Permalink

Hey Dariusz,

yes I am using limits for each created channel, sorry that I forgot to mention that

ForEach{
Write-Host "<result>"
Write-Host "<Channel>$filename</Channel>"
Write-Host "<Value>$filesize</Value>"
Write-Host "<LimitMode>1</LimitMode>"
Write-Host "<LimitMaxWarning>59055800320</LimitMaxWarning>"
Write-Host "<LimitMaxError>64424509440</LimitMaxError>"
Write-Host "</result>"
}

I really would like use that feature to get a warning/error once the filesize is exceeded...


"Keine Daten" is ok because the channel for the file that once was too big, now is showing "Keine Daten" because the file is not above 50GB anymore...


My only problem basically is; - once a channel shows "No Data" (because of the reason stated above) the warning for that channel won't disappear. I could manually fix this by switching primary channel for the sensor which is a bit inconvenient



here the complete script:

Write-Host "<?xml version="1.0" encoding="UTF-8" ?>"
Write-Host "<prtg>"

# Schleife auslesen .NSF Dateien größer 50 GB und Ausgabe in XML Format
$runtime = (Measure-Command {
Get-ChildItem "\\path-to-directory\" -Recurse -include *.nsf | Where-Object {($_.Length -gt "53687091200")} | Sort-Object -Descending Length | ForEach-Object {
[string]$filename = $_.Name
[float]$filesize = $_.Length
Write-Host "<result>"
Write-Host "<Channel>$filename</Channel>"
Write-Host "<Value>$filesize</Value>"
# Einheit Kanal innerhalb von PRTG
Write-Host "<CustomUnit>MB</CustomUnit>" 
# Umwandlung innerhalb von PRTG in GigaByte
Write-Host "<VolumeSize>MegaByte</VolumeSize>" 
Write-Host "<Float>1</Float>"
Write-Host "<DecimalMode>Auto</DecimalMode>"
# Aktivierung eigener Grenzwerte für Kanal
Write-Host "<LimitMode>1</LimitMode>"
Write-Host "<LimitMaxWarning>59055800320</LimitMaxWarning>"
Write-Host "<LimitMaxError>64424509440</LimitMaxError>"
Write-Host "</result>" 
}
}).totalseconds

# Ausgabe Laufzeit Skript
Write-Host "<result>"
Write-Host "<Channel>Laufzeit</Channel>"
Write-Host "<Value>$runtime</Value>"
Write-Host "<SpeedTime>Second</SpeedTime>"
Write-Host "<CustomUnit>Sek.</CustomUnit>"
Write-Host "<Float>1</Float>"
Write-Host "<DecimalMode>Auto</DecimalMode>"
Write-Host "</result>"

# fester Grenzwert Warnung @ 55GB für Darstellung im Graph
Write-Host "<result>"
Write-Host "<Channel>Grenzwert Warnung</Channel>"
Write-Host "<Value>59055800320</Value>"
Write-Host "<CustomUnit>MB</CustomUnit>"
Write-Host "<VolumeSize>MegaByte</VolumeSize>"
Write-Host "</result>"
# fester Grenzwert Fehler @ 60GB für Darstellung im Graph
Write-Host "<result>"
Write-Host "<Channel>Grenzwert Fehler</Channel>"
Write-Host "<Value>64424509440</Value>"
Write-Host "<CustomUnit>MB</CustomUnit>"
Write-Host "<VolumeSize>MegaByte</VolumeSize>"
Write-Host "</result>"

Write-Host "</prtg>"


Best regards
~ lukas_sch


Apr, 2018 - Permalink

Hi Lukas,

Would it be possible to always offer a value, even for the empty channel? As the limits are only for the Max, you can offer the value "0" for the missing channel.

Best regards.


Apr, 2018 - Permalink

I guess this won't be possible because I only want files above 50GB to be listed. I don't want something like "if filesize lower than 50GB, set value OK!" because I want my script just to detect files above 50GB as this significantly decreases runtime...

Maybe an option to auto delete channels with "No Data" - this would solve my problem.

Or an option where I can set a trigger (e.g. each run) for the "last report" to be updated, since this only seems to update once <LimitMaxWarning>59055800320</LimitMaxWarning> or <LimitMaxError>64424509440</LimitMaxError> get exceeded...
The last report showed the FileSize and not "Keine Daten"...



I hope you get what I am trying to explain :D


Apr, 2018 - Permalink