I would like to transform data fetched by SNMP binding from my ups.
Data should be divided by 10. It comes from UPS as a number but knowing that js transform returns string i changed number to stirng in thing and item def.
Tried adding transform in thing file, items file and both. Nothing works and there is no errors in the logs. Data is still showing as original without transformation.
I am pretty sure that this transforms worked with v1 binding.
Here are my files:
divide_by_10.js
(function(i) {
return parseFloat(i) / 10;
})(input)
snmp.items
String UPS_HighPrecOutputEfficiency "Output eff. [JS(divide_by_10.js):%s]" { channel="snmp:target:apc_ups:UPSHighPrecOutputEfficiency" }
snmp.things
Type string : UPSHighPrecOutputEfficiency [ oid=".1.3.6.1.4.1.318.1.1.1.4.3.5.0", mode="READ", readTransform="JS(divide_by_10.js)" ]
Any help would be appreciated.