What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Strange bug in XMLEXE sensor - Values from Powershell script wrong

Votes:

0

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>&#xb0;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>&#x25;</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>&#xb0;C</CustomUnit>
<ShowChart>0</ShowChart>
<ShowTable>0</ShowTable>
</result>
<result>
<channel>Humidity</channel>
<float>1</float>
<value>28</value>
<Unit>Custom</Unit>
<CustomUnit>&#x25;</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.

humidity powershell script temperature xmlexe

Created on Mar 26, 2020 11:00:22 AM

Last change on Mar 26, 2020 11:36:37 AM by  Moritz Heller [Paessler Support]



7 Replies

Votes:

0

Hi there,

In which scanning interval runs the corresponding XML Sensor?

Created on Mar 26, 2020 12:07:25 PM by  Moritz Heller [Paessler Support]



Votes:

0

Interval 60 Seconds (the sensor-software updates it's file every 60 seconds. The script is actually larger that the code snippet I included in my post. It reads 6 temperature and 6 humidity values so it generates 12 channels.

The only thing I tried is using a mutex to serialise but it has no influence what so ever. The prtg server is not under heavy load anyway. Plus it worked fine since 2016. The script really outputs the correct values. PRTG is where the change to the value happens (and randomly). I removed the mutex, returning these 12 sensors to their old config.

I need the 12 values displayed on the webpage, which forces me to use 12 sensors. I realise that every sensor runs the same script. This is insanely inefficient but again, it has been running like this for years.

Created on Mar 26, 2020 12:31:28 PM



Votes:

0

Please increase the scanning interval to 5min. Afterwards, please check whether the issue occurs again.

Created on Mar 26, 2020 12:58:20 PM by  Moritz Heller [Paessler Support]



Votes:

0

will do.

Created on Mar 26, 2020 1:04:46 PM



Votes:

0

Update. Interval has been 5 minutes for hours now, but the problem is still there. 22.3 in reality, PRTG shows 23.3

Created on Mar 26, 2020 4:25:55 PM



Votes:

0

To analyse the issue in more detail, please enable the option "Write Results to Disk" in the Sensor settings. Afterwards, please forward the files (located in PRTG Data Directory > Logs > Sensors) via email to [email protected]

Please mention the case number PAE1330556 in the email subject.

Created on Mar 27, 2020 12:34:42 PM by  Moritz Heller [Paessler Support]



Votes:

0

Email sent. Thank you for analysing.

Created on Mar 27, 2020 3:19:39 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.