Open Luth1ng opened 6 months ago
I cannot use constant in snmp leef oid with snmp collection mode
Try to replace an OID with a constant
with this json file :
{ "mapping": {}, "constants": { "ifIndex": "167837696" }, "snmp": { "leefs": [ { "name": "opticalIfLaserTxPower", "oid": ".1.3.6.1.4.1.4746.2.6.1.2.1.2.167837696" } ] }, "selection": [ { "name": "myLeefs1", "expand": { "leefvalue": "%(snmp.leefs.opticalIfLaserTxPower)" }, "formatting": { "printf_msg": "Status is %s.", "printf_var": [ "%(leefvalue)" ], "display_ok": true } } ], "selection_loop": [], "formatting": {} }
result is : OK: Status is -24. .1.3.6.1.4.1.4746.2.6.1.2.1.2.167837696 = -24
With this json file :
{ "mapping": {}, "constants": { "ifIndex": "167837696" }, "snmp": { "leefs": [ { "name": "opticalIfLaserTxPower", "oid": ".1.3.6.1.4.1.4746.2.6.1.2.1.2.[%(constants.ifIndex)]" } ] }, "selection": [ { "name": "myLeefs1", "expand": { "leefvalue": "%(snmp.leefs.opticalIfLaserTxPower)" }, "formatting": { "printf_msg": "Status is %s.", "printf_var": [ "%(leefvalue)" ], "display_ok": true } } ], "selection_loop": [], "formatting": {} }
Result is :
OK: Status is . ======> variables Status is .
My goal here is to call a json find to check a particular OID with an input parameter. I don't want to request all the table and filter with this OID.
I know I could use the table and filter the oid with a selection_loop, but I would like to minimize the SNMP requests sent to the equipment.
How can I achieve this ?
Hi @Luth1ng, I have recently faced the exact same limitation and at the moment I see no reason why we wouldn't support it. We'll try to improve that.
Quick description
I cannot use constant in snmp leef oid with snmp collection mode
How to reproduce
Try to replace an OID with a constant
Expected result
with this json file :
result is : OK: Status is -24. .1.3.6.1.4.1.4746.2.6.1.2.1.2.167837696 = -24
Actual result
With this json file :
Result is :
OK: Status is . ======> variables Status is .
Questions
My goal here is to call a json find to check a particular OID with an input parameter. I don't want to request all the table and filter with this OID.
I know I could use the table and filter the oid with a selection_loop, but I would like to minimize the SNMP requests sent to the equipment.
How can I achieve this ?