I want to display a calculated value.
One value is a modbus query value.
This is what this item looks like in Zabbix:
Name: Active energy
Type: Zabbix agent
Key: modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,24576,,float]
Type of information: Numeric (float)
Units: !kWh
The current value of this measurement is 1410.27002
I want to subtract the other value from this value.
The other value is in a file:
zabbix_get -s 127.0.0.1 -p 10050 -k vfs.file.contents[/tmp/powermeter_daily_beginning.txt]
1400.310059
I don’t want to measure this other value continuously in Zabbix, it’s just needed for subtraction.
I created a new item:
Name: Daily active energy
Type: Calculated
Key: daily.active.energy
Type of information: Numeric (float)
But the "Formula" .... has a problem with that.
I tried this:
(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])
Result:
Cannot parse formula: item query must be first argument of a historical function at "//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])"
last(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])
Result:
Cannot parse formula: item query must be first argument of a historical function at "//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])"
last(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-last(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])
Result:
Cannot evaluate function: item "/Pro1-mod_native/modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float]" does not exist at "last(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-last(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])".
How could I implement this subtraction?
One value is a modbus query value.
This is what this item looks like in Zabbix:
Name: Active energy
Type: Zabbix agent
Key: modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,24576,,float]
Type of information: Numeric (float)
Units: !kWh
The current value of this measurement is 1410.27002
I want to subtract the other value from this value.
The other value is in a file:
zabbix_get -s 127.0.0.1 -p 10050 -k vfs.file.contents[/tmp/powermeter_daily_beginning.txt]
1400.310059
I don’t want to measure this other value continuously in Zabbix, it’s just needed for subtraction.
I created a new item:
Name: Daily active energy
Type: Calculated
Key: daily.active.energy
Type of information: Numeric (float)
But the "Formula" .... has a problem with that.
I tried this:
(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])
Result:
Cannot parse formula: item query must be first argument of a historical function at "//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])"
last(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])
Result:
Cannot parse formula: item query must be first argument of a historical function at "//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])"
last(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-last(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])
Result:
Cannot evaluate function: item "/Pro1-mod_native/modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float]" does not exist at "last(//modbus.get[rtu://{$MBPORT}:{$MBBAUDRATE}:{$MBDATABITS}{$MBPARITY}{$ MBSTOPBIT},{$MBID},3,20514,,float])-last(//vfs.file.contents[/tmp/powermeter_daily_beginning.txt])".
How could I implement this subtraction?
Comment