diff options
-rw-r--r-- | examples/smi/agent/custom-managed-object.py | 9 | ||||
-rw-r--r-- | examples/smi/agent/operations-on-managed-objects.py | 16 | ||||
-rw-r--r-- | examples/smi/manager/mib-tree-inspection.py | 10 | ||||
-rw-r--r-- | examples/smi/manager/var-binds-mib-resolution.py | 10 |
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 |