Dear Sirs,
Disclaimer: please read thoroughly and maybe several times, because this is very strange and might be hard to comprehend the first time that you read it.
Ever since I upgraded to version 20.1.56.1547 (im on v20.1.57.1745 now by the way), I have a strange issue with an XMLEXE sensor that I use to fetch Temperature and Humidity data from a collection of sensors. The Powershell script that the sensor uses reads a text file that the sensor-software generates every minute. The temperature and humidity values are then shown in PRTG. This has been working fine for many years.
Recently, I noticed that the temperature that PRTG displays is sometimes exactly 1 Degree Celsius higher than the value from the script.
The powershell script runs under a Windows AD account ("prtg") on the probe. If I run powershell as that "prtg" user and run the script manually, the variable "temp" is say, 23.4 degrees. In PRTG however, it either shows 23.4 degrees OR 24.4 degrees (exactly 1 degree higher).
It gets worse. The problem is not always present. I've been trying to see pattern for weeks now but I cannot find one. PRTG can show the correct temperature one moment, and an hour later, the value which is exactly 1 degree higher. Never more than 1 degree. Never less. Exactly 1 degree higher (when it happens).
In other words, when the problem is there, somehow PRTG does a "+1" to the value that it ingested from the script.
Remember, this setup has worked flawlessly for years. I started seeing these strange elevated (+1) temperatures after upgrading to version 20.1.56.1547
This is what the scripts looks like:
============================================ Write-Host "Fetching data from KlimaLogg.dat1 file..." $currenttemp = Get-Content p:\KlimaLogg.dat1 | Select -First 11 | Select -Last 1 $currenttemp = $currenttemp | Foreach-Object {$_ -Replace '^deg_C="*"'} $currenttemp = $currenttemp -Replace ".$" $currenthumid = Get-Content p:\KlimaLogg.dat1 | Select -First 15 | Select -Last 1 $currenthumid = $currenthumid | Foreach-Object {$_ -Replace '^percent="*"'} $currenthumid = $currenthumid -Replace ".$" Write-Host "<?xml version=`"1.0`" encoding=`"UTF-8`" ?>" Write-Host "<prtg>" Write-Host "<result>" Write-Host "<channel>Temp</channel>" Write-Host "<float>1</float>" Write-Host "<value>$currenttemp</value>" Write-Host "<Unit>Custom</Unit>" Write-Host "<CustomUnit>°C</CustomUnit>" Write-Host "<ShowChart>0</ShowChart>" Write-Host "<ShowTable>0</ShowTable>" Write-Host "</result>" Write-Host "<result>" Write-Host "<channel>Humidity</channel>" Write-Host "<float>1</float>" Write-Host "<value>$currenthumid</value>" Write-Host "<Unit>Custom</Unit>" Write-Host "<CustomUnit>%</CustomUnit>" Write-Host "<ShowChart>0</ShowChart>" Write-Host "<ShowTable>0</ShowTable>" Write-Host "</result>" Write-Host "</prtg>" Remove-Variable currenttemp -Force Remove-Variable currenthumid -Force ==============================================
Again, this script has been running like this for years. Nothing has changed. The sensor software is still the same version as in 2016.
The output the script shows when I run the script as that PRTG user looks like this:
============================================== PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> .\GetKlimaLoggPro-TempV2.ps1 <?xml version="1.0" encoding="UTF-8" ?> <prtg> <result> <channel>Temp</channel> <float>1</float> <value>25.2</value> <Unit>Custom</Unit> <CustomUnit>°C</CustomUnit> <ShowChart>0</ShowChart> <ShowTable>0</ShowTable> </result> <result> <channel>Humidity</channel> <float>1</float> <value>28</value> <Unit>Custom</Unit> <CustomUnit>%</CustomUnit> <ShowChart>0</ShowChart> <ShowTable>0</ShowTable> </result> ================================================
As you can see, the temperature is 25.2 and the humidity is 28 and this corresponds with the content inside that sensor-data file.
Since version 20.1.56.1547, randomly, PRTG will either show "25.2" (correct) OR "26.2" (incorrect). It can show the correct values for hours, and then start displaying the incorrect (increased) values for hours. The when and how long are all random. I cannot find any pattern so far.
It NEVER happens with the humidity. PRTG always shows the correct value a it has done for years. The temperature often has a value with 1 decimal (example, 25.2) The humidity is always a round number (never has a decimal).
The values that the script extracts are of type "string" (i checked with GetType() I cannot use INT (float=0) because then I lose the decimals in the temperature.
My temperature solution in PRTG has become unreliable since the upgrade. I don't know what to do.
Add comment