Hi Skyline team,
I’m implementing SNMP traps in a connector to reduce reliance on polling.
However, the traps returned by the device use different severity codes from those used in the parameter.
For example:
The parameter reports: 0 = Locked, 1 = Unlocked
The trap reports: 2 = Locked, 3 = Unlocked
Because of this mismatch, I can’t simply use setBindings to update the parameter directly.
Is there a way to map incoming trap values to custom values (e.g. 2→0 and 3→1) without using a QAction?
Alternatively, is there a way to achieve this using Trigger + Action (for example, to set a literal value based on a trap message)?
I considered chaining increment and copy actions, but that gets messy, and using a QAction feels overkill for such a simple conversion.
Let me know if you have any ideas that could help my use case.
Hi Wade,
Although the docs states to only use it on polled parameters (which you could argue is the case for a trap), you could use a Sequence with a modulo operation 'rest:2' or '%:2'. This will end up setting 0 for all even values and 1 for all odd values, which would work in the case you explained.
If that does not work as expected, You could also mimic the logic that you would do in a QAction by doing something like below. It is however not fullproof (see at the end)
Let's assume the original param is (A)
Make a 'fixed' (B) param with value 0 to represent the Locked value
Make a 'fixed' (C) param with value 1 to represent the Unlocked value
Make a new param to receive the value of the trap binding (D)
Create an action to 'copy' value from (B) to (A) = (Set Locked)
Create an action to 'copy' value from (C) to (A) = (Set Unlocked)
Create a trigger 'on change' for param (D) with a condition to check value in (D) for 2 or 3 and 'execute next' either action (Set Locked) or (Set Unlocked) accordingly.
The issue with the last method is that the chain will only trigger if the received value on D is different than the previous value. However, in this case you might not need to update A anyway.
Hi Wade,
I do not know of a way to combine both the increment and copy in a single action. As for QActions, in this case I do not see a problem with doing it in a QAction. I would even see it as a better solution than the chaining of triggers and actions in this case. The Sequence might be the quickest solution in this specific case but as you highlighted, it might not apply to other situations so you could say going with a QAction is a better 'standard' approach, instead of a workaround.
Hi Robin,
Thanks for the feedback. I'll use a QAction in this case.
It would be very useful to have the ability to return a custom value to a parameter on receiving an SNMP trap, think setbinding but setparam instead. Perhaps a feature request?
Hi Wade, feel free to create a feature request indeed
Hi Robin,
Thanks for your helpful reply.
I'll experiment with the sequence function, perhaps that could work in this use case but may have limitations elsewhere.
I also thought about the same logic wrt trigger + action but wondered if it would just be simpler to call a QAction instead. From an efficiency point of view, and not to overload the agent, would the trigger + action be preferred over a QAction?
I also tried another method with using copy + increment, but this resulted in the wrong value to be in the parameter until the increment action had completed. Is there a way to combine two actions into the same Action?
<Action id="1">
<Name>AsiStatusTrapAction1</Name>
<On id="2002">parameter</On>
<Type id="10004">copy</Type>
</Action>
<Action id="2">
<Name>AsiStatusTrapAction2</Name>
<On id="2002">parameter</On>
<Type value="-1">increment</Type>
</Action>