Re: code to tftp download cisco configs.
Ajay Chenampara <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Dave, I think it works now... I set the OID to $OID = "1.3.6.1.4.1.9.9.96.1.1.1.1.14"; and my $vb = new SNMP::Varbind([$OID,'1000','6','INTEGER']); my $var = $session->set($vb); and the output is clean. but now i need to know how to check for the response from the router and look for the "6" . Ajay Chenampara <[email protected]> wrote: Hi there, I know im overlooking something here and i hope someone here will be able to point it out... Im writing a script to download our s/w and router configs via tftp using snmp commands. the snmpset command from the command prompt works, but my perl script is not. What am i goofing up? As always, all help is very much appreciated! from the unix prompt: ]$ snmpset -v3 <IP> 1.3.6.1.4.1.9.9.96.1.1.1.1.14.1000 i 6 SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.14.1000 = INTEGER: 6 I get the expected response of INTEGER: 6 (the auth params are stored in ~/.snmp/snmp.conf) and my perl script is : my %session_opts = (Community => $snmp_community, DestHost => $snmp_host, RemotePort => '161', Timeout => '2000000', Retries => '5', Version => $version, AuthProto => $AuthProto, PrivProto => $PrivProto, AuthPass => $AuthPass, PrivPass => $PrivPass, SecName => $SecName, SecLevel => $SecLevel, UseNumeric => 1, UseLongNames => 1); my $session = new SNMP::Session(%session_opts); my $vb = new SNMP::Varbind([$OID,'0','6','INTEGER']); my $var = $session->set($vb); warn("set original vals=[$vars], oidvalue=[$OID], errNo=[$session->{ErrorNum}], errStr=[$session->{ErrorStr}]\n"); which i execute to get : set original vals=[], oidvalue=[1.3.6.1.4.1.9.9.96.1.1.1.1.14.1000], errNo=[11], errStr=[noCreation (that table does not support row creation)] My Router debug output is: Jun 25 21:35:00.408: v3 packet security model: v3 security level: noauth Jun 25 21:35:00.408: username: Jun 25 21:35:00.408: snmpEngineID: 800000090300001759DF1AB0 Jun 25 21:35:00.408: snmpEngineBoots: 0 snmpEngineTime: 0 Jun 25 21:35:00.408: SNMP: Report, reqid 285558921, errstat 0, erridx 0 internet.6.3.15.1.1.4.0 = 230 Jun 25 21:35:00.412: SNMP: Packet sent via UDP to <unix box IP> Jun 25 21:35:00.416: SNMP: Packet received via UDP from <unix box IP> on FastEthernet0/0 Jun 25 21:35:00.416: SNMP: Get request, reqid 285558922, errstat 0, erridx 0 ccCopyTable.1.14.1000 = NULL TYPE/VALUE Jun 25 21:35:00.424: Incoming SNMP packet Jun 25 21:35:00.424: v3 packet security model: v3 security level: auth Jun 25 21:35:00.424: username: <username> Jun 25 21:35:00.424: snmpEngineID: 800000090300001759DF1AB0 Jun 25 21:35:00.424: snmpEngineBoots: 4 snmpEngineTime: 977502 Jun 25 21:35:00.424: SNMP: Response, reqid 285558922, errstat 0, erridx 0 ccCopyTable.1.14.1000 = NO_SUCH_INSTANCE_EXCEPTION Jun 25 21:35:00.432: SNMP: Packet sent via UDP to <unix box IP> Jun 25 21:35:00.584: SNMP: Packet received via UDP from <unix box IP> on FastEthernet0/0 Jun 25 21:35:00.584: Incoming SNMP packet Jun 25 21:35:00.584: v3 packet security model: v3 security level: noauth Jun 25 21:35:00.588: username: Jun 25 21:35:00.588: snmpEngineID: 800000090300001759DF1AB0 Jun 25 21:35:00.588: snmpEngineBoots: 0 snmpEngineTime: 0 Jun 25 21:35:00.588: SNMP: Report, reqid 285558923, errstat 0, erridx 0 internet.6.3.15.1.1.4.0 = 231 Jun 25 21:35:00.592: SNMP: Packet sent via UDP to <unix box IP> Jun 25 21:35:00.592: SNMP: Packet received via UDP from <unix box IP> on FastEthernet0/0 Jun 25 21:35:00.596: SNMP: Set request, reqid 285558924, errstat 0, erridx 0 ccCopyTable.1.14.1000.0 = 6 Jun 25 21:35:00.600: Incoming SNMP packet Jun 25 21:35:00.600: v3 packet security model: v3 security level: auth Jun 25 21:35:00.600: username: <username> Jun 25 21:35:00.600: snmpEngineID: 800000090300001759DF1AB0 Jun 25 21:35:00.600: snmpEngineBoots: 4 snmpEngineTime: 977502 Jun 25 21:35:00.600: SNMP: Response, reqid 285558924, errstat 11, erridx 1 ccCopyTable.1.14.1000.0 = 6 Jun 25 21:35:00.608: SNMP: Packet sent via UDP to <unix box IP> --------------------------------- Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users --------------------------------- Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users