04-04-2023 11:35 AM
Scenario:
I want to use track object utilizing rtr reachability with an ipsla object to set an interface to err-disable. Unfortunately (at least on the code version we're currently on (6.5.3)) you can't err-disable a sub-interface, only a physical interface.
This log message comes in when the track goes down:
object_tracking[373]: %PKT_INFRA-ERRDIS-6-ERROR_DISABLE : Bundle-Ether355.3081: Error disabling due to reason: ot-track-state-change
the err-disable just doesn't actually happen to the subinterface (be355.3081)
I'd like to have an off box automation that could intake this log message, parse out the interface and log in and shut down the referenced interface. I'm open to this being ansible or python, or anything really. I do have some familiarity with ansible and python, so those would be preferred.
I'm pretty new to automation, so any assistance is very much appreciated on how to get started on this.
04-04-2023 11:47 AM
In order to do that, you would need to have the logs/alerts go into say Teams or monitoring platform, then based on that message login and shut the interface. What are you using for this? Ive done this with BGP and shutting neighbours which flap too many times per X amount of time over exchanges. It might be easier to have on-box code instead such as EEM or on-box python perform such task. What platform is this XR, NX, XE?
04-04-2023 12:00 PM
This is on XR - from the research we've done, it seems that python on box is barely supported on 6.5.3. If possible I'd like this to be off box, so I can use the same centralized platform for multiple routers - I suppose that does make it a bit more complicated.
04-05-2023 05:02 AM
Something simple like this with Netmiko would work, which would be easy to put into a event based CI workflows in GitLab
log_message = "[add]"
log_error = "[add]"
log_command = "show logging | include '{}'".format(log_message)
error_command = "show logging | include '{}'".format(log_error)
shutdown_command = "interface {} ; shutdown"
There is a good blog post (few years old now) which has a whole solution for Event-driven Automation https://pynet.twb-tech.com/blog/stackstorm-nagios-event-driven-automation-part-1.html
04-20-2023 02:03 PM
Is there a good way to do this on the router vs having something off box execute? Maybe with EEM/TCL? Reading around it seems like this might be possible, just not sure how to go about getting started.
04-21-2023 12:03 AM
Yes, but check your version support for this, here is an example https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/asr9k-r7-3/programmability/configuration/guide/b-programmability-cg-asr9000-73x/m-ops-eem-scripts.html
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide