04-01-2019 10:27 PM - edited 04-01-2019 10:35 PM
I am trying to automate a backup solution for the Cisco RFGW-1 devices that we currently have in our network using SNMP from a Python script. My issue is that whenever I set a value for an OID I end up with an "illegal value" entry in the RFGW-1 logs. I believe that these OIDs were working in an older perl script that used to be part of a larger backup solution we used, so I'm pretty sure that they are valid.
Either the values I am using are getting mangled someplace, or the wrong OIDs are being used. I tried to look the OIDs up in the Cisco SNMP Object Navigator, but they could not be found.
The OIDs I am using can be found below, in the python code snippet.
# Execute SNMP to backup the running configuration errorIndication, errorStatus, errorIndex, varBinds = next( setCmd(SnmpEngine(), CommunityData(snmpCommunity, mpModel=1), UdpTransportTarget((device,161), timeout=2), ContextData(), ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.12.0"), Integer(1)) , ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.13.0"), OctetString(ftpServer)) , ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.14.0"), OctetString(ftpUser)) , ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.15.0"), OctetString(ftpPassword)) , ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.17.0"), OctetString(backupFile)) , ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.16.0"), OctetString("CMTS-Data/{}".format(device))) , ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.1.0"), Integer(8)) ) )
The values are pretty simple strings...
"backuser" for the ftpUser, "20190401_Config" for the backupFile, "CMTS-Data/devicename" for the backup path.
... yet they generate an Illegal value on the RFGW-1 when set.
Do these values need to be encoded in any way for the RFGW-1 to accept them?
How can I verify my OIDs if they are not found in the Cisco SNMP Object Navigator?
Any idea why the values are not being accepted?
[edit] I should add that the configuration backup DOES work if I don't try to specify most of the OIDs values (see below). The RFGW-1 uses its currently configured values instead. Unfortunately, I cannot depend on these being set correctly on all of our devices.
# Execute SNMP to backup the running configuration errorIndication, errorStatus, errorIndex, varBinds = next( setCmd(SnmpEngine(), CommunityData(snmpCommunity, mpModel=1), UdpTransportTarget((device,161), timeout=2), ContextData(), ObjectType(ObjectIdentity(".1.3.6.1.4.1.1429.1.12.1.2.20.1.0"), Integer(8)) ) )
Solved! Go to Solution.
04-02-2019 10:47 PM
Well... I was able to determine my issue and get my script working... I'm not sure if the issue is with the RFGW-1 or pysnmp.
You cannot set values for multiple OIDs in one snmp set request. I broke my script into a separate set command for each value and now it is working well.
04-01-2019 11:21 PM
- It's a bit unclear whether this device supports all CISCO standard MIBS , I am a lit worried when I have a look at the link below , look for the strings 'MIBS are supported' ; I it seems rather limited and it doesn't list the CISCO-COPY-CONFIG-MIB either. Also does your device run a fairly recent software version ?
https://www.cisco.com/c/dam/en/us/td/docs/video/OVP/RFGW_1/4039214_A.pdf
M.
04-02-2019 01:28 PM - edited 04-02-2019 01:31 PM
The software revision is 06.04.07.
I'm fairly certain that there are OIDs to use to backup the configuration on the RFGW-1 as we used that method before in a perl script that ran on one of our old hosts, which is now decommissioned.
Another reason this might be difficult to verify is that the Enterprise identified by these OIDs (.1.3.6.1.4.1.1429) is Scientific-Atlanta, not Cisco. This is definitely a Cisco device.
04-02-2019 01:51 PM - edited 04-02-2019 03:27 PM
...Looking online I came across this file, "RFGW_1-MIBS-06_04_07.zip" located at https://software.cisco.com/download/home/281229746/type/284625276/release/06.04.07
In this file I found the following text:
REVISION "200908191500Z"
DESCRIPTION
"Modified description for rfgw1TrapCommunityString,
rfgw1FileMgmtUsername, rfgw1FileMgmtPassword,rfgw1FileMgmtFilePath,
rfgw1FileMgmtConfigUsername, rfgw1FileMgmtConfigPassword,
rfgw1FileMgmtConfigFilePath, rfgw1FileMgmtFileName,
rfgw1FileMgmtConfigFileName."
[edit] Using a MIB browser I was able to verify that I am using the correct OIDs... and that there is a second set of OIDs that could also be used - neither seem to work though.
04-02-2019 03:58 PM - edited 04-02-2019 04:21 PM
... and more trouble...
OID ".1.3.6.1.4.1.1429.1.12.1.2.1.6" appears to be ignored by the RFGW-1 as well. This corresponds to " rfgw1GeneralSaveConfiguration", which SHOULD cause the RFGW-1 to save the running configuration to the startup configuration when the value of 1 is set. According to the device logs, this is not happening.
At this point I don't know what I should be doing... I just know that it doesn't work as designed.
[edit] ...fixed this one. Net::SNMP needs to have ".0" appended to the OID for it to work, so now the running configuration is being saved to NVRAM successfully.
Still no luck with the copying of NVRAM config to the FTP server.
Just to clarify...My logs show the following when I copy running config to nvram and then try to backup the nvram configuration to an FTP server:
02 APR 19 16:08:05.372 Configuration Error Auto Save Based on SNMP Set Failed. 02 APR 19 16:08:04.072 SNMP Error SNMP TEST failed for rfgw1FileMgmtFileName. Error: Illegal values 02 APR 19 16:08:04.072 SNMP Error SNMP TEST failed for rfgw1FileMgmtFilePath. Error: Illegal values 02 APR 19 16:08:04.072 SNMP Error SNMP TEST failed for rfgw1FileMgmtPassword. Error: Illegal values 02 APR 19 16:08:04.072 SNMP Error SNMP TEST failed for rfgw1FileMgmtUsername. Error: Illegal values 02 APR 19 16:08:01.272 Configuration Warning Data base has been saved
...and the OIDs I am trying to use are those in my first post OR the ones found below:
.1.3.6.1.4.1.1429.1.12.1.2.20.2.0 - FTP server address type = 1 .1.3.6.1.4.1.1429.1.12.1.2.20.3.0 - FTP server address = 10.0.1.2 .1.3.6.1.4.1.1429.1.12.1.2.20.4.0 - FTP server username = backuser .1.3.6.1.4.1.1429.1.12.1.2.20.5.0 - FTP server password = password .1.3.6.1.4.1.1429.1.12.1.2.20.6.0 - File path on FTP server = CMTS-Data/devicename .1.3.6.1.4.1.1429.1.12.1.2.20.7.0 - File name on FTP server = 20190401_Config.gz .1.3.6.1.4.1.1429.1.12.1.2.20.1.0 - File management command = 8 , which means execute backup.
...at this point I'm hoping someone can tell me that I need to format my values in a specific way, such as adding quotation marks around them, or something similar.
04-02-2019 10:47 PM
Well... I was able to determine my issue and get my script working... I'm not sure if the issue is with the RFGW-1 or pysnmp.
You cannot set values for multiple OIDs in one snmp set request. I broke my script into a separate set command for each value and now it is working well.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide