summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorelie <elie>2005-06-17 14:24:51 +0000
committerelie <elie>2005-06-17 14:24:51 +0000
commit1b36e858ed76642f76a70169b10b9c98665027cd (patch)
tree93507c2e48deb10de9dca92edcdc22b3b70c216e /README
parentfc6af3ee72b47d1df4d3281758fdf1c858ba8c36 (diff)
downloadpysnmp-1b36e858ed76642f76a70169b10b9c98665027cd.tar.gz
example updated
Diffstat (limited to 'README')
-rw-r--r--README21
1 files changed, 12 insertions, 9 deletions
diff --git a/README b/README
index 0c61ffb..e262ff5 100644
--- a/README
+++ b/README
@@ -67,26 +67,29 @@ protocol-oriented and, in particular, requires application to manage
transport failures, access issues and so on.
The second model supported by PySNMP resembles the SNMPv3 architecture,
-as specified in [4]. Here is an example on querying an SNMP agent
-for arbitrary value (sysDescr):
+as specified in [4]. Here is an example on querying SNMP agent
+for arbitrary value (sysDescr) over SNMP v3 with authentication and
+privacy enabled:
8X---------------- cut here --------------------
from pysnmp.entity.rfc3413.oneliner import cmdgen
-errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CmdGen().snmpGet(
- cmdgen.UsmUserData('test-user', 'authkey1', 'privkey1'),
- cmdgen.UdpTransportTarget(('localhost', 161)),
- 'SNMPv2-MIB::sysDescr.0'
+userData = cmdgen.UsmUserData('test-user', 'authkey1', 'privkey1')
+targetAddr = cmdgen.UdpTransportTarget(('localhost', 161))
+
+errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CmdGen().getCmd(
+ userData, targetAddr, (('sysDescr', 'SNMPv2-MIB'), 0)
)
-if errorIndication:
+if errorIndication: # SNMP engine errors
print errorIndication
else:
- if errorStatus:
+ if errorStatus: # SNMP agent errors
print '%s at %s\n' % (errorStatus, varBinds[errorIndex-1])
else:
- print varBinds
+ for varBind in varBinds: # SNMP agent values
+ print '%s = %s' % varBind
8X---------------- cut here --------------------