3 Replies Latest reply: Jun 6, 2013 4:24 PM by foonly RSS

need help! asap! Linux Download and Uploading a config file

onewatcher

need help!

i need to back up all configuration on my Linux/Centos 5.7

i already created two(2) config file that can download

 

=====1===== this is the direct

 

<Configuration-Management Device="linuxtest" SystemOID="1.3.6.1.4.1.8072.3.2.10">

  <Commands>

    <Command Name="ALLOCATEPTY" Value="True" />

    <Command Name="MENUBASED" Value="False" />

    <Command Name="CUSTOMUSERNAMEPROMPT" Value="login as:" />

    <Command Name="eth0" Value="/etc/sysconfig/network-scripts/ifcfg-eth0" />

    <Command Name="lo" Value="/etc/sysconfig/network-scripts/ifcfg-lo" />

    <Command Name="Running" Value="/etc/snmp/testconfig" />

    <Command Name="snmpd" Value="/etc/snmp/snmpd.conf" />

    <Command Name="sshd" Value="/etc/ssh/sshd_config" />

    <Command Name="DOWNLOADCONFIG" Value="cat -vvv ${ConfigType}" />

    <Command Name="UPLOADCONFIG" Value="cat bank.txt>${ConfigType}${CRLF}echo '${ConfigText}'>${ConfigType}" /> 

  </Commands>

</Configuration-Management>

=============

The Upload script works like this.

1. it will removed the content of the ${ConfigType}

2. then put the content of the backup file to the ${ConfigType}

but it works for the Running configuration only

when i try to up load the sshd backup it will put on the /etc/snmp/testconfig because this is the value my running configuration

i just notice that when u download you can chose what type of configuration

but for upload it will just target the Running configuration

 

 

and i want to have another backup on my tftp server

======2======

<Configuration-Management Device="linuxtest" SystemOID="1.3.6.1.4.1.8072.3.2.10">

  <Commands>

    <Command Name="ALLOCATEPTY" Value="True" />

    <Command Name="MENUBASED" Value="False" />

    <Command Name="CUSTOMUSERNAMEPROMPT" Value="login as:" />

    <Command Name="eth0" Value="/etc/sysconfig/network-scripts/ifcfg-eth0" />

    <Command Name="lo" Value="/etc/sysconfig/network-scripts/ifcfg-lo" />

    <Command Name="Running" Value="/etc/snmp/testconfig" />

    <Command Name="snmpd" Value="/etc/snmp/snmpd.conf" />

    <Command Name="sshd" Value="/etc/ssh/sshd_config" />

    <Command Name="DOWNLOADCONFIG" Value="tftp -vvv 192.168.243.148 -c put ${ConfigType} ${ConfigType}; cat -vvv ${ConfigType}" />

    <Command Name="UPLOADCONFIG" Value="tftp -vvv 192.168.243.148 -c get ${ConfigType} ${ConfigType}" />

  </Commands>

</Configuration-Management>

============

 

and again still same issue

if there is only like an option what ConfigType after right click + upload the backup file.

that would be nice. and my template will work 100% not 60% only 

 

Running,Start,(user defined) = ${ConfigType}

Content of the Backup Config File = ${ConfigText}

Backup Config File = ?????

 
  • Re: need help! asap! Linux Download and Uploading a config file
    cvachovecj

    Hi,

    what if we discuss via an on-line meeting? I tried to reach you via e-mail but received no response.

    Regards,

    Jiri

  • Re: need help! asap! Linux Download and Uploading a config file
    cvachovecj

    We have found a solution offline. Here is an example. Imagine you want to backup files /etc/snmp/file1.conf and /etc/ssh/file2.conf.

     

    FYI:

    Capture-Putty-Before.PNG

     

    Steps:

    1. (Optional) Delete all previously downloaded configs for the linux box (to have things in order).
    2. Add the files you want to backup as ConfigTypes in the Win32 application – see my example:
      Capture-Settings-ConfigTypes.PNG
    3. Add the device template (call it e.g. Linux-Test):

      <Configuration-Management Device="Linux-Test" SystemOID="1.3.6.1.4.1.8072.3.2.10">
      <Commands>
      <Command Name="ALLOCATEPTY" Value="True" />
      <Command Name="MENUBASED" Value="False" />
      <Command Name="/etc/snmp/file1.conf" Value="/etc/snmp/file1.conf" />
      <Command Name="/etc/ssh/file2.conf" Value="/etc/ssh/file2.conf" />
      <Command Name="DOWNLOADCONFIGINDIRECT" Value="cp -f ${ConfigType} ${StorageFilename}; echo put ${StorageFilename} |  ${TransferProtocol} ${StorageAddress}; rm -f ${StorageFilename}" RegEx="tftp"/>
      <Command Name="UPLOADCONFIGINDIRECT" Value="echo get ${StorageFilename} ${ConfigType} | ${TransferProtocol} ${StorageAddress}" RegEx="tftp"/>
      </Commands>
      </Configuration-Management>
      (Modify the tftp commands according to your syntax – this example uses interactive tftp, thus echo "command" is used.)

    4. Make sure the node is properly configured in NCM:
      Capture-Node-Settings.PNG

      Important note: when you change the template, choose some other one, click on some other field, then again choose that template you really want and again click on some other field. In this way NCM takes the changes into account.

    5. Download the configs:
      Capture-Download-Config.PNG
      Capture-Download-Config2.PNG
      Result:
      Capture-Download-Config-Result.PNG
    6. You can upload a changed version:
      Capture-Upload1.PNG
      Capture-Upload2.PNG
      Result:
      Capture-Putty-After.PNG

     

    Regards,

    Jiri