05-24-2021 03:02 AM
Is it possible to use the NSO SNMP notification receiver to trigger a sync-from operation? If so, does anyone have any example code they can share?
05-24-2021 06:59 AM
Yes with a little bit of work you can. Setup NSO to receive the traps you want
https://developer.cisco.com/docs/nso/guides/#!snmp-notification-receiver/snmp-notification-receiver
and then setup a kicker that monitors those alarms. Something like
admin@ncs% show kickers
data-kicker out-of-sync-alarm {
monitor /al:alarms/alarm-list/alarm;
trigger-expr "type='al:out-of-sync' and is-cleared='false'";
kick-node xxxx;
action-name xxxxx;
}
Of course you need to change the trigger-expression to trigger on your SNMP trap and also create a new nice action to parse the device name from the alarm etc so you can execute the sync-from action on the right device :).
05-24-2021 07:44 AM
Is it possible to use python for the code for the SNMP notification receiver and the kicker? The docs only appear to mention java for this, and unfortunately I don't speak java.
05-24-2021 11:16 AM
Kicker is NSO specific and you can write you action in python if you like. The only thing that is in java in the trap stuff and you should be able to handle that piece even if you don't write java. I think the only thing you need to worry about is the one where you match the oid.
if (vb.getOid().toString().equals("1.3.6.1.6.3.1.1.4.1.0")) etc
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: