EEM: how to add the current date&time to a filename

Hi All,

For an automated backup of a running config I try to use EEM. But cant figure out how to add the current date and time to the filename.

event manager environment mybackuploc tftp://192.168.200.11/ event manager environment myfilename cr-u1-cfgbkp event manager environment myfilenameext .txt event manager environment dash - event manager applet bkp_when_changed trap event cli pattern "wr" sync no skip no action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "file prompt quiet" action 4.0 cli command "end" action 5.0 cli command "copy running $mybackuploc$myfilename$myfilenameext" action 6.0 cli command "config t" action 7.0 cli command "no file prompt quiet" action 8.0 cli command "end"

Is there a way to read the current time and use it as a env-variable? somethink like: event manager environment currdate $$$date$$$ event manager environment currtime $$$time$$$

so, that the $mybackuploc$myfilename$dash$currdate$dash$currtime$myfilenameext

creates a file like cr-u1-cfgbkp-02-11-2010-21.37.txt on the tftp-srvr?

Any help would be very much appreciated.

stephan

Reply to
stephan
Loading thread data ...
12.02.10 8:40, stephan ÐÉÛÅÔ:

maybe a bad answer, but try to use RANCID - Really Awesome New Cisco confIg Differ

formatting link
i use it for two years, about hundred of different devices - 26xx,

28xx, 29xx, 72xx, etc very good soft

--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---

Reply to
Alexander Romanov

Hi Alexander

No, its a good answer. As good as Kiwi-CatTools. Thats the app I used.

My idea was to work with a built-in feature then using an external app.

Thanks anyway. /s

Reply to
stephan

If you switch to using tcl scripts from EEM then you can do anything you want.

For example, as a way to learn a bit about tcl I worte a "game of life" in tcl that I could run by pasting the code into the router. (Of course the code could have been put in a file on the flash, but I have still not got the necesary round tuits.)

Was way cool seeing the evolving lifescape scrolling up the console screen.

Sadly, it was not enough to get me a job as a test engineer chez cisco:)

formatting link
I got the idea from a game of life written in postscript that you could run on a printer.

The lifescape emerged on pieces of paper:-)))

If your router does tcl, you can see some nice sample scripts as follows:-

router#show event manager policy available No. Type Time Created Name

1 system Thu Feb 7 06:28:15 2036 ap_perf_test_base_cpu.tcl 2 system Thu Feb 7 06:28:15 2036 no_perf_test_init.tcl 3 system Thu Feb 7 06:28:15 2036 sl_intf_down.tcl 4 system Thu Feb 7 06:28:15 2036 tm_cli_cmd.tcl 5 system Thu Feb 7 06:28:15 2036 tm_crash_reporter.tcl 6 system Thu Feb 7 06:28:15 2036 tm_fsys_usage.tcl

router# show event manager policy available detailed ap_perf_test_base_cpu.tcl

or whatever the script you want to view is called.

There are also sample scripts here -

formatting link
EEM info -
formatting link

Reply to
bod43

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.