Menu

Feature request: backup switch running config to a local directory

2015-01-29
2015-03-24
  • Gene Mosley

    Gene Mosley - 2015-01-29

    I'm not talking about versioning or a repository of older configs of any kind, just a 'sh ru' saved to a file with the name of the switch in some directory.

     
  • Jonathan Yantis

    Jonathan Yantis - 2015-01-29

    Gene,

    I only have this sort of functionality for cisco devices. If you feed the devicelist.csv to the netdb/sendjob/sendjob script, you can drop configs in a directory like this:

    mkdir /opt/netdb/configs/
    /opt/netdb/sendjob/sendjob.pl -df /opt/netdb/data/devicelist.csv -cf /opt/netdb/configs/

    One day I would like to expand this sort of functionality to all devices, but have not had the time.

    Jonathan

     
  • Gene Mosley

    Gene Mosley - 2015-01-29

    Very cool! But I can't get it to work.
    It looks like:
    -df is the device file to read
    -cf is the command file - the list of commands to execute on the devices
    -cd is the directory to save the output to (no trailing / apparently)
    It launches childsendjob.pl and the command line looks good (debug 5)
    It is passing -conf, -d, -cf and -cnf command line variables
    It seems to stop there.
    In the command file I just have the following: sh run
    I am thinking maybe the command list needs to be stated diffrently?

     
  • Gene Mosley

    Gene Mosley - 2015-01-29

    Okay, I guess I wasn't waiting long enough. I cut the test devicelist down to one device and let it sit ... after about 3 minutes an error popped up then it tried again and that worked.
    Total time to grab a config from one switch was 6 minutes - due to the initial failure.
    Looks like it is trying to open a file named after the device then fails :
    Permission denied at ./childsendjob.pl line 401.
    I guess because the file does not exist?

     
  • Gene Mosley

    Gene Mosley - 2015-02-03

    I get this (debug 5):

    [netdb@midgard netdb]$ /opt/netdb/sendjob/sendjob.pl -debug 5 -df /opt/netdb/datadevicelist.txt -cd /opt/netdb/configs
    |DEBUG|: Helper Loading Alternate Config File: /etc/netdb.conf
    Tue Feb 3 11:27:51 2015: sendjob(25419): Running Sendjob
    Tue Feb 3 11:27:51 2015: sendjob(25419): sendjob.pl(25419): Parent spawning 20 processes with 0.5s delay
    |DEBUG|: Device: svl-fa-4506l1001, fqdn: svl-fa-4506l1001, mac: 1, wifi: , arp: , vrfs: , ipv6: , devtype: , authgroup:
    |DEBUG|: Device: svl-fa-4506l1001, fqdn: svl-fa-4506l1001, mac: 1, wifi: , arp: , vrfs: , ipv6: , devtype: , authgroup:
    Tue Feb 3 11:27:51 2015: sendjob(25420): Child svl-fa-4506l1001 starting
    Tue Feb 3 11:27:51 2015: sendjob(25420): Child executing: ./childsendjob.pl -debug 5 -conf /etc/netdb.conf -d svl-fa-4506l1001 -cnf /opt/netdb/configs/svl-fa-4506l1001-confg
    Can't exec "./childsendjob.pl": No such file or directory at /opt/netdb/sendjob/sendjob.pl line 304.
    Couldn't execute ./childsendjob.pl -debug 5 -conf /etc/netdb.conf -d svl-fa-4506l1001 -cnf /opt/netdb/configs/svl-fa-4506l1001-confg: No such file or directory at /opt/netdb/sendjob/sendjob.pl line 306.
    Tue Feb 3 11:27:51 2015: sendjob(25419): Parent waiting on final processes to finish: 0
    Tue Feb 3 11:27:51 2015: sendjob(25419): Parent Complete

     
  • Jonathan Yantis

    Jonathan Yantis - 2015-02-06

    Gary,

    I am absolutely swamped at the moment dealing with an outage incident. It looks like to me I have some file directory issues. Try changing in to the /opt/netdb/sendjob/ directory and then running ./sendjob from there. See how that goes.

    This code is mainly used internally and isn't nearly as refined as the rest of the program. I included it to see if anyone could get some use out of it, but I haven't been able to promote it or bring it to the level of the rest of the code base yet.

    Let me know how changing directories goes. Once I have some time, maybe we can flesh this out some more and I can introduce you to some of the features we have enabled internally for inventory management. There's a GUI component as well I'm sure you would benefit from.

    Jonathan

     

Log in to post a comment.