summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2016-04-01 01:02:36 +0200
committerIlya Etingof <etingof@gmail.com>2016-04-01 01:02:36 +0200
commit18f39e2228d370a336500c5ecc539658d890f06d (patch)
tree411284e32cd015d4d18215013284f785a14088dd /examples
parent002bb632e888e90577c87111f99674be153f79d0 (diff)
downloadpysnmp-git-18f39e2228d370a336500c5ecc539658d890f06d.tar.gz
brief description added
Diffstat (limited to 'examples')
-rw-r--r--examples/smi/agent/custom-managed-object.py9
-rw-r--r--examples/smi/agent/operations-on-managed-objects.py16
-rw-r--r--examples/smi/manager/mib-tree-inspection.py10
-rw-r--r--examples/smi/manager/var-binds-mib-resolution.py10
4 files changed, 38 insertions, 7 deletions
diff --git a/examples/smi/agent/custom-managed-object.py b/examples/smi/agent/custom-managed-object.py
index 87dea364..0b175193 100644
--- a/examples/smi/agent/custom-managed-object.py
+++ b/examples/smi/agent/custom-managed-object.py
@@ -1,4 +1,11 @@
-# Managed Objects implementation
+"""
+Implementing MIB objects
+++++++++++++++++++++++++
+
+This script explains how SNMP Agent application could model
+real-world data as Managed Objects defined in MIB.
+
+"""#
from pysnmp.smi import builder
# MIB Builder is normally pre-created by SNMP engine
diff --git a/examples/smi/agent/operations-on-managed-objects.py b/examples/smi/agent/operations-on-managed-objects.py
index 13d31494..b2373829 100644
--- a/examples/smi/agent/operations-on-managed-objects.py
+++ b/examples/smi/agent/operations-on-managed-objects.py
@@ -1,10 +1,18 @@
+"""
+Agent operations on MIB
++++++++++++++++++++++++
+
+This script explains how SNMP Agent application manipulates
+its MIB possibly triggered by SNMP Manager's commands.
+
+"""#
# SNMP agent backend e.g. Agent access to Managed Objects
from pysnmp.smi import builder, instrum, exval
print('Loading MIB modules...'),
mibBuilder = builder.MibBuilder().loadModules(
'SNMPv2-MIB', 'SNMP-FRAMEWORK-MIB', 'SNMP-COMMUNITY-MIB'
- )
+)
print('done')
print('Building MIB tree...'),
@@ -20,9 +28,9 @@ print('done')
print('Create/update SNMP-COMMUNITY-MIB::snmpCommunityEntry table row: ')
varBinds = mibInstrum.writeVars(
- ( (snmpCommunityEntry.name+(2,)+instanceId, 'mycomm'),
- (snmpCommunityEntry.name+(3,)+instanceId, 'mynmsname'),
- (snmpCommunityEntry.name+(7,)+instanceId, 'volatile') )
+ ((snmpCommunityEntry.name + (2,) + instanceId, 'mycomm'),
+ (snmpCommunityEntry.name + (3,) + instanceId, 'mynmsname'),
+ (snmpCommunityEntry.name + (7,) + instanceId, 'volatile'))
)
for oid, val in varBinds:
print('%s = %s' % ('.'.join([str(x) for x in oid]), val.prettyPrint()))
diff --git a/examples/smi/manager/mib-tree-inspection.py b/examples/smi/manager/mib-tree-inspection.py
index 549ea360..cff34b00 100644
--- a/examples/smi/manager/mib-tree-inspection.py
+++ b/examples/smi/manager/mib-tree-inspection.py
@@ -1,4 +1,12 @@
-# SNMP manager-side MIB management
+"""
+SNMP MIB browser
+++++++++++++++++
+
+This script explains how Python application (typically SNMP Manager)
+could load SNMP MIB modules into memory and introspect Managed Objects
+defined in MIB.
+
+"""#
from pysnmp.smi import builder, view, compiler, error
# Create MIB loader/builder
diff --git a/examples/smi/manager/var-binds-mib-resolution.py b/examples/smi/manager/var-binds-mib-resolution.py
index 69bb7dc0..ffbd2f92 100644
--- a/examples/smi/manager/var-binds-mib-resolution.py
+++ b/examples/smi/manager/var-binds-mib-resolution.py
@@ -1,4 +1,12 @@
-# SNMP variables MIB resolution
+"""
+SNMP var-binds MIB resolution
++++++++++++++++++++++++++++++
+
+This script explains how Python application (typically pysnmp-based SNMP Manager)
+could enrich SNMP PDU variable-bindings with MIB information or convert MIB objects
+into variable-bindings.
+
+"""#
from pysnmp.smi import builder, view, rfc1902, error
# MIB Builder manages pysnmp MIBs