I'm using a powershell script to generate XML output for a custom sensor (EXE/Script Advanced), and it seems I've found a small issue. I'm unable to mix float and non-float channels in the same sensor - if I have any channels where the value returned "looks like" a float but the channel is not set with float=1, then the value is ignored and channel is set to 0.

For example, my XML contains: <prtg> <result> <channel>Test1</channel> <value>212894.00</value> <unit>Custom</unit> <customUnit>#</customUnit> </result> <result> <channel>Test2</channel> <value>257160.00</value> <unit>Custom</unit> <customUnit>#</customUnit> <float>1</float> </result> <result> <channel>Test3</channel> <value>257160</value> <unit>Custom</unit> <customUnit>#</customUnit> </result> </prtg>

In the above set, channel "Test1" displays as "0" in PRTG, Test2 is ok (displays as a float), and Test3 is also ok (displays as an integer).

It seems PRTG cannot convert the string "212894.00" to an integer even though it should be able to convert it...

Is this a known issue? I have put in a (fairly ugly) workaround in my powershell script to get around this, but would like to know if there's a better approach.

Thanks.


Article Comments

This is intended. The return value must be in the proper format. An integer value which contains a decimal point is not considered an integer even if the decimal places are all zero.

If the value cannot be parsed because it is not an integer by format, the default ("0") will be used.


Mar, 2014 - Permalink