Switches, Hubs, and Modems
1754407 Members
3198 Online
108813 Solutions
New Discussion юеВ

Backup Procurve-Config via SNMP?

 

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

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

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

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

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

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