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

Discussion in 'Cisco' started by stephan, Feb 11, 2010.

  1. stephan

    stephan Guest

    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
    stephan, Feb 11, 2010
    #1
    1. Advertising

  2. 12.02.10 8:40, stephan ÐÉÛÅÔ:
    > 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.


    maybe a bad answer, but
    try to use RANCID - Really Awesome New Cisco confIg Differ
    http://www.shrubbery.net/rancid/

    i use it for two years, about hundred of different devices - 26xx,
    28xx, 29xx, 72xx, etc
    very good soft

    --- news://freenews.netfront.net/ - complaints: ---
    Alexander Romanov, Feb 13, 2010
    #2
    1. Advertising

  3. stephan

    stephan Guest

    Hi Alexander

    > maybe a bad answer, but
    > try to use RANCID - Really Awesome New Cisco confIg Differ
    > http://www.shrubbery.net/rancid/


    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
    stephan, Feb 13, 2010
    #3
  4. stephan

    bod43 Guest

    On 13 Feb, 16:51, stephan <> wrote:
    > Hi Alexander
    >
    > > maybe a bad answer, but
    > > try to use RANCID - Really Awesome New Cisco confIg Differ
    > >http://www.shrubbery.net/rancid/

    >
    > 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


    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:)

    http://en.wikipedia.org/wiki/Conway's_Game_of_Life

    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 -
    http://forums.cisco.com/eforum/servlet/EEM?page=search_results&fn=topdownloads&catId=0&count=20

    EEM info -
    http://www.cisco.com/en/US/products/ps6815/products_ios_protocol_group_home.html
    bod43, Feb 16, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sean darcy

    make filename with date from exif info?

    sean darcy, Aug 20, 2004, in forum: Digital Photography
    Replies:
    7
    Views:
    1,070
    Big Bill
    Aug 25, 2004
  2. ixgor
    Replies:
    1
    Views:
    1,363
    unholy
    Oct 15, 2006
  3. Replies:
    1
    Views:
    1,276
    Digital Photography Now
    Oct 4, 2005
  4. Lars-Erik Østerud

    How to add EXIF date from file-date

    Lars-Erik Østerud, Feb 18, 2008, in forum: Digital Photography
    Replies:
    21
    Views:
    963
    Father Kodak
    Mar 8, 2008
  5. Replies:
    0
    Views:
    476
Loading...

Share This Page