Switches, Hubs, and Modems
cancel
Showing results for 
Search instead for 
Did you mean: 

Backup Procurve-Config via SNMP?

Peter Escher
Occasional Advisor

Backup Procurve-Config via SNMP?

Hi,

is it possible to get the complete configuration of a procurve-switch via SNMP? or is there a better way to backup the config via script/automatic?

Regards,
Oliver
21 REPLIES
Les Ligetfalvy
Esteemed Contributor

Re: Backup Procurve-Config via SNMP?

PCM will do it for you. If you wanted to use a scripted telnet, you could go that route as well.
Peter Escher
Occasional Advisor

Re: Backup Procurve-Config via SNMP?

PCM? sorry, I dont know what you mean :)
Les Ligetfalvy
Esteemed Contributor

Re: Backup Procurve-Config via SNMP?

PCM = ProCurve Manager, a free poor cousin to PCM+. I think it ships on CD with every switch you buy.
http://www.hp.com/rnd/software/network_management.htm
Peter Escher
Occasional Advisor

Re: Backup Procurve-Config via SNMP?

Hm, this is a Windows-Application - we dont use Windows in our production environment. Is there another way to get the switch-config?

But one question: is it possible to get the configs automatic via PCM?

Regards,
Peter
Mohamed Hamedi
Respected Contributor

Re: Backup Procurve-Config via SNMP?

hi Peter,

If i remember correctly it is not possible to pull the config file via SNMP. The MIBs are designed to do this, but i think this feature has been disabled.

Unless this has been changed in the latest firmware builds, your option is to create a script to telnet and send the config to your tftp server.
Mohamed Hamedi
Respected Contributor

Re: Backup Procurve-Config via SNMP?

On the PCM question, yes PCM can be scheduled to download the config files.
Les Ligetfalvy
Esteemed Contributor

Re: Backup Procurve-Config via SNMP?

Peter,
I run PCM+ on an XP box so for me, I have the configs automatically collected from all the switches. I can copy/paste the config to another switch using either PCM or TelNet/XMODEM/TFTP.

I played around with a scriptable telnet program but it lacked some features that I require to auto-genterate filenames that incude the IP and date, so I ended up using AutoIT and HyperTerm but those too are WIntel based.

You did not mention what platform you are using, only that it is not WIntel. I know there is the Perl::TelNet module so if you are proficient in Perl and it runs on your platform, you should be able to cobble together a script.

I am sure there are other NMS apps as well that run on non-WIntel to do the job that are either free or worth the money.
Peter Escher
Occasional Advisor

Re: Backup Procurve-Config via SNMP?

We use Gentoo Linux - thx for your help!

Best regards,
Peter
Regnar Bang Lyngsø_2
Frequent Advisor

Re: Backup Procurve-Config via SNMP?

We use Rancid.

<>

Regnar
John Griffith (Bucks Un
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

You can perform the following steps (same thing PCM does)

1. Set tftp SNMPv2 OID to 2

# snmpset -v 2c -c "RWCOMMUNITY" HOSTNAME 1.3.6.1.4.1.11.2.14.11.5.1.7.1.5.6.0 i 2

2. tftp running config file from switch

# tftp HOSTNAME -c get running-config LOCALFILENAME

3. Reset OID to disable tftp

# snmpset -v 2c -c "RWCOMMUNITY" HOSTNAME 1.3.6.1.4.1.11.2.14.11.5.1.7.1.5.6.0 i 1


Hope that helps,
John
yoda_1
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

Hi!
I set in CLI:
setmib 1.3.6.1.4.1.11.2.14.11.5.1.7.1.5.6.0 -i 2

My source 'command-file':
no ip access-list extended "199"
ip access-list extended "199"
permit ip 192.168.1.3 0.0.0.0 0.0.0.0 255.255.255.255
exit

How to put command-file to switch via tftpd?
If i put his then in logs switch:
01/02/90 00:13:11 tftp: SENT error:2, msg: Access violation

Help please.


PabloFiasko
Occasional Advisor

Re: Backup Procurve-Config via SNMP?

hello Peter,

I saw serious problems with PCM+ managing a large environment.
Thus I developed a q'n'd bash script, which uses expect and scp. This script backs up all our switch configs (currently >500).
If you like I could give it to you.

Steffen
Life is what you make it
Rupertt
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

Hello,

i am looking for an scripted backup solution.
Can you provide us your script PabloFiasko?
We have only Linux server and usually use rsync/scp/mysqldump for our backups.

greetings

Rupertt
Evgueni Pesliak
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

Hi,

I am looking for the exact same thing - script that will pull backup configurations on a large number of Procurves using SCP or SFTP (every 5 days?). If anyone could share the script, i would greatly appreciate.

Thank you,
Evgueni
Andreas Svensson
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

PabloFiasko / Steffen.
Please send the script you use for backup.
I've been looking for this.
Thanks.
PabloFiasko
Occasional Advisor

Re: Backup Procurve-Config via SNMP?

okay, here we go. Note - this is as is and I take no guarantee if it does not work for you! Comments welcome.

You need: a linux box, with perl and expect installed. Maybe you need some additional perl modules.

Copy the following into a file and chmod +x:
<script>

#!/usr/bin/expect -f
#Expect Skript zum automatisierten Abziehen einer Konfig vom HP Switch
#per scp und password auth
#v 0.1 20080630 Steffen M. Steck pablofiasko@gmail.com
#

#Usage ./scpconfigsaver.exp hostname|IP

set user "manager"
set pass "managers_passwd"
set host [lindex $argv 0]
set timeout 60
set date [exec date +%Y%m%d%H%M]
set output "$host\_$date"
set dstdir /home/bkup/hpswitche

proc ssh_failed { } {
send_user "ERROR: SSH LOGIN FAILED\n"
exit
}

proc scp_ok { } {
send_user "SCP SUCCEEDED\n"
}

spawn scp $user@$host:/cfg/running-config $dstdir\/$output.cfg

#check if login is successful and import ssh key if not yet in known_hosts
expect {
"Connection refused" { ssh_failed }
"No route to host" { ssh_failed }
"Permission denied" { ssh_failed }
"bad password." { ssh_failed }
"(yes/no)?" { send "yes\r";
exp_continue }
"password:" { send "$pass\r";
exp_continue }
"Password:" { send "$pass\r";
exp_continue }
"100% " { scp_ok }
default { ssh_failed }
}

wait
expect eof
</script>

This backs up ***one*** switch. Maybe you need to play around with the last two lines "wait" and "expect eof" to get you prompt back. I have been seeing different behaviours on Suse and on Ubuntu. The above sequence works on Suse 9/10/11, it does not on Ubuntu 9.04 - you do not get your prompt back. Don't know why - comments welcome.

If you tried it successfully against a lab switch the only thing you need is all your devices' hostnames or IPs in a file, 1 per line.
Then easily use it like
steffen@T400> for i in `cat devices` ; do ./scpconfigsaver.exp $i ; done
Then have a look at what you set as dstdir, you find files named hostname_datetime.cfg.

Of course this is very basic and does not take care about how many backups are there...
Maybe someone here has time to build something around and share...
Life is what you make it
PabloFiasko
Occasional Advisor

Re: Backup Procurve-Config via SNMP?

okay, now as I took a closer look into this script again (haven't looked for quite a while) I see that there is no need for perl and modules here... My memory mixed it up with some other scripts...
Life is what you make it
Andreas Svensson
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

Hi again.
I get this from a Procurve 2626 trying manually.
scp admin@10.0.2.12:/cfg/running-config test.cfg
We'd like to keep you up to date about:
* Software feature updates
* New product announcements
* Special events

Please register your products now at: www.ProCurve.com

admin@10.0.2.12's password:
exec request failed on channel 0

Or in the script:
/root/switch.sh 10.0.2.12
spawn scp admin@10.0.2.12:/cfg/running-config /home/bkup/hpswitche/10.0.2.12_200905131508.cfg
We'd like to keep you up to date about:
* Software feature updates
* New product announcements
* Special events

Please register your products now at: www.ProCurve.com

admin@10.0.2.12's password:
exec request failed on channel 0
ERROR: SSH LOGIN FAILED

Looks like the switch doesn't allow us to get the file.
Software revision H.10.74
SSH terminal works fine.
Any ideas?
/Andreas
PabloFiasko
Occasional Advisor

Re: Backup Procurve-Config via SNMP?

hm I do not remember having ever seen this exec request error.
My first idea is the switches' config - firmware should be no prob, our switches are all running 10.67 code, most of them 2650B, some 2600-8-PwR, some 2610s...

Do you have
ip ssh
ip ssh filetransfer
in your configs? I think the latter is missing ;-)
Life is what you make it
Andreas Svensson
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

Missing the ip ssh file-transfer
Thanks!
I'm trying Rancid also.
Looks nice.
Sevenood
Occasional Visitor

Re: Backup Procurve-Config via SNMP?

Hey, 

we are using expect and scp to backup our switches configuration, but looking for some way to do it via snmp. 

 

Is there now any way to do so? 

 

Thanks for any help.