Cisco: Copy the running config to a TFTP server
I needed to backup (copy) the running config on a Cisco router to a TFTP server and I wanted to do it via SNMP. You'll be best served by getting CISCO-CONFIG-COPY-MIB.
num=$(expr $RANDOM % 250)
num2=$(expr $num + 1)
# Write the config (copy running to startup)
snmpset -On -m 'CISCO-CONFIG-COPY-MIB' -c writeme -v 2c 10.0.0.5
ccCopySourceFileType.$num = 4
ccCopyDestFileType.$num = 3
ccCopyEntryRowStatus.$num = 4;
sleep 30
# Copy to TFTP
snmpset -On -m 'CISCO-CONFIG-COPY-MIB' -c writeme -v 2c 10.0.0.5
ccCopyProtocol.$num2 = 1
ccCopySourceFileType.$num2 = 3
ccCopyDestFileType.$num2 = 1
ccCopyServerAddress.$num2 = "10.0.0.1"
ccCopyFileName.$num2 s 'config-backup.txt'
ccCopyEntryRowStatus.$num2 = 4