Modify Date of a Router Configuration file

Discussion in 'Cisco' started by kiranreddyd, Jan 11, 2005.

  1. kiranreddyd

    kiranreddyd Guest

    Hi All,

    This is regarding Cisco Routers. I need to find out updated or
    modified date and time of the running config file. I have to get that
    in my program and check against another date.

    Connection to the Cisco router is through SSH or TELNET.

    How can I get the modified date? Any Idea?
    Thanks in Advance

    Kiran
     
    kiranreddyd, Jan 11, 2005
    #1
    1. Advertisements

  2. Hi,


    | How can I get the modified date? Any Idea?

    In enable mode, just set it manually:
    clock set 2005 jan 11 12:20:00

    Or by a NTP Server:
    ntp <IP address from a NTP Server>
    maybe your router doesn´t understand "ntp", just use "sntp" <IP adress>

    Maybe you find a ntp server from this link:
    http://ntp.isc.org/bin/view/Servers/NTPPoolServers
    or just google for ntp server lists.

    If your router support "ntp master", then you can also use it as a ntp server for your own hosts.

    With the command clock timezone, you can specify a timezone, maybe "+" or "-" a few hours of UTC time. Or specify set the clock automaticcly when summer or wintertime starts.

    Regards

    Carsten Remien
     
    Remien, Carsten, Jan 11, 2005
    #2
    1. Advertisements

  3. That's a popular misconception. However, 'ntp master' is not needed for
    a Cisco router to serve time to clients. It will do that by default when
    it is synchronized to another NTP server.

    What it is for, is to have it serve time even if it itself is *not*
    synchronized to another NTP server.

    Regards,

    Marco.
     
    M.C. van den Bovenkamp, Jan 11, 2005
    #3
  4. Hi,


    | That's a popular misconception.

    Thank´s, I´ll try that out

    Regards

    Carsten Remien
     
    Remien, Carsten, Jan 11, 2005
    #4
  5. :| How can I get the modified date? Any Idea?

    :In enable mode, just set it manually:
    :clock set 2005 jan 11 12:20:00

    The OP was asking about the modification date of the configuration
    files, not about how to set the system clock.
     
    Walter Roberson, Jan 11, 2005
    #5
  6. kiranreddyd

    kiranreddyd Guest

    Excatly, I am referring to the modified date of the Running Config File
    and not how to set the system clock.

    That too I need to know that date in the program for my
    manipulations....
    Is there any command(s) for that purpose?

    Regards
    Kiran
     
    kiranreddyd, Jan 11, 2005
    #6
  7. :This is regarding Cisco Routers. I need to find out updated or
    :modified date and time of the running config file. I have to get that
    :in my program and check against another date.

    :Connection to the Cisco router is through SSH or TELNET.

    :How can I get the modified date? Any Idea?

    My IOS system isn't connected right at the moment, so I can't tell
    if there are easier methods, but one mechanism is to
    tftp the running config to a system, and then look at the first
    few lines of the output. For example,

    !
    ! Last configuration change at 22:35:26 CST Tue Dec 14 2004
    ! NVRAM config last updated at 22:07:56 CST Tue Dec 14 2004


    -Possibly- the same information would show up at the top of
    "show running-configuration", but I do not know for sure.
     
    Walter Roberson, Jan 11, 2005
    #7
  8. kiranreddyd

    kiranreddyd Guest

    Thanks!

    But I have to get the modified date programatically to do some
    manipulation.....

    Even if show running-config gives me the inforamtion...the whole
    config info has to be retrieved for this purpose...

    I have to retrieve the modfied date very frequently in my program
    and retrieving the whole config info every time will be a performance
    issue.

    Is there any better ways of retrieving the modified date?
    Regards
    Kiran
     
    kiranreddyd, Jan 11, 2005
    #8
  9. kiranreddyd

    spolifemo Guest

    The date is not stored outside of the file, if you do a "dir nvram:"
    you will see that the files have no date.

    If you dont want to get the config file, you could try to use the
    Expect application, to telnet to the device and get only the
    information you are looking for.
    Search for expect cisco as many scripts already exist.
     
    spolifemo, Jan 11, 2005
    #9
  10. kiranreddyd

    spolifemo Guest

    The date is not stored outside of the file, if you do a "dir nvram:"
    you will see that the files have no date.

    If you dont want to get the config file, you could try to use the
    Expect application, to telnet to the device and get only the
    information you are looking for.
    Search for expect cisco as many scripts already exist.
     
    spolifemo, Jan 11, 2005
    #10
  11. :But I have to get the modified date programatically to do some
    :manipulation.....

    :Even if show running-config gives me the inforamtion...the whole
    :config info has to be retrieved for this purpose...

    The examples on cisco.com indicated that 'show running-config'
    gives you the desired information, so you could set the terminal
    page length to very short before sending the command, and then quit out at
    the first pager prompt.

    :I have to retrieve the modfied date very frequently in my program
    :and retrieving the whole config info every time will be a performance
    :issue.

    :Is there any better ways of retrieving the modified date?

    For performance, up to roughly 50 times a second, you would
    be best off finding an SNMP OID that gave the required information.
    I do not know if there is one; if there is, it probably depends
    on the IOS version and the hardware model. But the existance of
    the OID is a moot point as you indicated that you would be using
    telnet or ssh for the programatic access.

    See also the fairly new changes documented at
    http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_feature_guide09186a00801d1e81.html

    Would it perhaps make more sense to be actively notified of
    configuration changes via an snmp trap? See the 'snmp-server' command.
     
    Walter Roberson, Jan 11, 2005
    #11
  12. :The date is not stored outside of the file, if you do a "dir nvram:"
    :you will see that the files have no date.

    The second clause of that sentance may be true but the first clause
    is not. If you show running-config then the system displays the
    two dates as one of the very first things. When you show running-config
    the system is not displaying an actual file: it is building
    up a representation of the in-memory configuration and printing
    that out in a human readable form. In order for it to be able
    to do that and show the change timestamps, the implication
    is that the date -is- stored somewhere on the system.
     
    Walter Roberson, Jan 11, 2005
    #12
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.