I am running SNMP-TrapDirector to handle Interface Up/Down traps.
The handler sets the state of a switch’s service definition to OK (Up) or WARNING (Down).
Whenever a port comes up, we run an automation comparing the MAC on the switch port with the one in our documentation (Netbox). We created a simple EventCommand for this which calls a Webhook in an Ansible automation.
The Request should only fire if:
service_state = OK
service_state_type = HARD
service_last_state != OK
service_long_output ends in " Up"
Unfortunatly, our Backend always receives two identical automation requests
I guess what I am looking for is a state-machine for the service state - ideally I want to filter in the first “Up” event.
It’s a while since I did anything with the event handler.
If I remember correctly, I also passed the previous state and it worked.
Can you post the config of your EventCommand and the filter code at the top in the script you call?