Make an item depend on other items' values (i.e. current percentage of max capacity) with snmp binding

I’m trying to make an item that derives its values from other items. In particular, I have a laser printer, for which I read the current and the max capacity of the toner cartridge via SNMP. Now, I want to create a new item, which holds the current capacity in % of the full capacity.

Here are the items that I have so far:

Number Dell_Toner_K_MaxCapacity "Toner Black Current [%d]" <rgb> (Dell_Printer) { snmp="<[]"}
Number Dell_Toner_K_Capacity "Toner Black Max [%d]" <rgb> (Dell_Printer) { snmp="<[]"}
Number Dell_Toner_K "Toner Black [%d%%]" <rgb> (Dell_Printer) { snmp="<[]"}

In the item definition of Dell_Toner_K, how can I access the values of Dell_Toner_K_Capacity and Dell_Toner_k_MaxCapacity and derive its walue by division (and multiplication by 100)?
I.e. Dell_Toner_K should be =Dell_Toner_K_Capacity/Dell_Toner_K_MaxCapacity*100

So far, the best I could find is to use a JS transformation with a hardcoded max capacity. Whenever I install a new toner cartridge, I have to remember to change the transformation to the actual capacity of the new cartridge.


The usual approach would be to trigger a simple rule from a change in either of your ‘real’ Items, and postUpate a newly calculated value to your virtual Item (which is not bound to anything)

1 Like