- Gold, 750 points or more
Community Spotlight Award,
Small Business, November 2015
So the following script works well on the Catalyst, it backs up the config via TFTP as soon as somebody enters and exits conf t mode.
event manager session cli Username
event manager applet Backup-Running-Config-To-TFTP
event syslog pattern "%SYS-5-CONFIG_I: Configured from"
action 0 info type routername
action 1.0 cli command "enable"
action 1.1 cli command "copy run tftp" pattern "Address"
action 1.2 cli command "x.x.x.x" pattern "filename"
action 1.3 cli command "$_info_routername-config_$_event_pub_sec"
action 2.0 syslog priority informational msg "Configuration change detected. Write to TFTP succesfully executed!"
However it doesn't seem to work so well on the Nexus 5k.
The session cli command is not accepted and I just get hundreds of the following in the log:
2017 Jan 22 20:19:33 HOSTNAME %VSHD-5-VSHD_SYSLOG_CONFIG_I: Configured from vty by LOCALADMIN on vsh.8681
As soon as I do conf t and exit it, the above message appears in the log multiple times a second and seems to loop.
This applet won't work on NX-OS. First, the syslog message for config change is different. Second, unless you are on 7.3 code, the syntax for the applet is very different on NX-OS. Third, even on the latest code, the "info" action is not supported on NX-OS. Finally, I haven't tried to use variables like _event_pub_sec. I am not certain they work on NX-OS. For NX-OS (and I've only done this on the 7K), Python is a better alternative.