Here i a script to pull backups in bash our aim is to intigrate with rancid
#! /bin/bash # targeting is the ishue ip=$'x.x.x.x' #this bash script gets and downloads a backup file for epmp1000 #this command sets a backup file on the target device snmpset -v2c -c Redacted $ip .1.3.6.1.4.1.17713.21.6.4.10.0 i 1 #ths gets then stores the location of the backup file in a variable result121=`snmpget -v2c -OvU -c Redacted $ip .1.3.6.1.4.1.17713.21.6.4.13.0` #gets mac address macget=`snmpget -v2c -c Redacted $ip 1.3.6.1.4.1.17713.21.1.1.5.0` #gets device name devnameget=`snmpget -v2c -c Redacted $ip 1.3.6.1.4.1.17713.21.3.6.1.2.0` #variable to remove any instance of STRING: removestring='STRING:' #variable to clean up Device name by removing OID removenamestring='iso.3.6.1.4.1.17713.21.3.6.1.2.0 = STRING: ' #variable to cleanup mac by removing OID removemacstring='iso.3.6.1.4.1.17713.21.1.1.5.0 = STRING: ' #variable remove Quotations from a result removeq='"' #variable to remove witespace from results removespace=' ' #clean up results for location of backup file for wget result221=${result121//$removestring/} result321=${result221//$removeq/} #clean up mac and device name for naming file in wget macrstring=${macget//$removemacstring/} devnamerstring=${devnameget//$removenamestring/} devnamerq=${devnamerstring//$removeq/} devname=${devnamerq//$removespace/} mac=${macrstring//$removeq/} #format date for naming wget now=$(date +'%m-%d-%y') #create name for backup in wget bkupname=$devname'-'$mac'-'$now'.json' #get the backup may need to spesifi location for file wget $result321 -O $bkupname