├── .github └── FUNDING.yml ├── .gitignore ├── .travis.yml ├── CHANGES.txt ├── LICENSE.rst ├── MANIFEST.in ├── README.md ├── THANKS.txt ├── TODO.txt ├── devel-requirements.txt ├── docs ├── Makefile ├── README.txt ├── mibs │ ├── PYSNMP-MIB.txt │ ├── PYSNMP-SOURCE-MIB.txt │ └── PYSNMP-USM-MIB.txt ├── net-snmpd.conf ├── net-snmptrapd.conf └── source │ ├── .static │ ├── css │ │ └── rtdimproved.css │ ├── favicon.ico │ └── logo.svg │ ├── changelog.rst │ ├── conf.py │ ├── contents.rst │ ├── development.rst │ ├── docs │ ├── api-reference.rst │ ├── hlapi │ │ ├── v1arch │ │ │ └── asyncore │ │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ └── notification.rst │ │ │ │ ├── manager │ │ │ │ └── cmdgen │ │ │ │ │ ├── bulkcmd.rst │ │ │ │ │ ├── getcmd.rst │ │ │ │ │ ├── nextcmd.rst │ │ │ │ │ └── setcmd.rst │ │ │ │ └── sync │ │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ └── notification.rst │ │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── bulkcmd.rst │ │ │ │ ├── getcmd.rst │ │ │ │ ├── nextcmd.rst │ │ │ │ └── setcmd.rst │ │ └── v3arch │ │ │ ├── asyncio │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ └── notification.rst │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── bulkcmd.rst │ │ │ │ ├── getcmd.rst │ │ │ │ ├── nextcmd.rst │ │ │ │ └── setcmd.rst │ │ │ ├── asyncore │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ └── notification.rst │ │ │ ├── manager │ │ │ │ └── cmdgen │ │ │ │ │ ├── bulkcmd.rst │ │ │ │ │ ├── getcmd.rst │ │ │ │ │ ├── nextcmd.rst │ │ │ │ │ └── setcmd.rst │ │ │ └── sync │ │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ └── notification.rst │ │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── bulkcmd.rst │ │ │ │ ├── getcmd.rst │ │ │ │ ├── nextcmd.rst │ │ │ │ └── setcmd.rst │ │ │ └── twisted │ │ │ ├── agent │ │ │ └── ntforg │ │ │ │ └── notification.rst │ │ │ └── manager │ │ │ └── cmdgen │ │ │ ├── bulkcmd.rst │ │ │ ├── getcmd.rst │ │ │ ├── nextcmd.rst │ │ │ └── setcmd.rst │ ├── mib-object-instances.svg │ ├── nms-components.svg │ ├── oid-tree-mibs.svg │ ├── oid-tree.svg │ ├── pysnmp-architecture.rst │ ├── pysnmp-design.svg │ ├── pysnmp-hlapi-tutorial.rst │ ├── snmp-apps.svg │ ├── snmp-design.rst │ ├── snmp-engine.svg │ ├── snmp-history.rst │ └── tutorial.rst │ ├── download.rst │ ├── examples │ ├── contents.rst │ ├── hlapi │ │ ├── v1arch │ │ │ ├── asyncio │ │ │ │ ├── agent │ │ │ │ │ └── ntforg │ │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ │ └── common-notifications.rst │ │ │ │ ├── contents.rst │ │ │ │ └── manager │ │ │ │ │ └── cmdgen │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ ├── snmp-versions.rst │ │ │ │ │ └── walking-operations.rst │ │ │ └── asyncore │ │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ ├── common-notifications.rst │ │ │ │ │ └── evaluating-notification-type.rst │ │ │ │ ├── contents.rst │ │ │ │ ├── manager │ │ │ │ └── cmdgen │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ ├── mib-tweaks.rst │ │ │ │ │ ├── modifying-variables.rst │ │ │ │ │ ├── snmp-versions.rst │ │ │ │ │ ├── table-operations.rst │ │ │ │ │ ├── transport-tweaks.rst │ │ │ │ │ └── walking-operations.rst │ │ │ │ └── sync │ │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ ├── common-notifications.rst │ │ │ │ │ └── evaluating-notification-type.rst │ │ │ │ ├── contents.rst │ │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── advanced-topics.rst │ │ │ │ ├── mib-tweaks.rst │ │ │ │ ├── modifying-variables.rst │ │ │ │ ├── snmp-versions.rst │ │ │ │ ├── table-operations.rst │ │ │ │ ├── table-operations.rst- │ │ │ │ ├── transport-tweaks.rst │ │ │ │ └── walking-operations.rst │ │ └── v3arch │ │ │ ├── asyncio │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ └── common-notifications.rst │ │ │ ├── contents.rst │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── advanced-topics.rst │ │ │ │ ├── snmp-versions.rst │ │ │ │ └── walking-operations.rst │ │ │ ├── asyncore │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ └── common-notifications.rst │ │ │ ├── contents.rst │ │ │ ├── manager │ │ │ │ └── cmdgen │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ ├── snmp-versions.rst │ │ │ │ │ └── walking-operations.rst │ │ │ └── sync │ │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ ├── advanced-topics.rst │ │ │ │ │ ├── common-notifications.rst │ │ │ │ │ ├── evaluating-notification-type.rst │ │ │ │ │ └── snmp-v1-trap-variants.rst │ │ │ │ ├── contents.rst │ │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── advanced-topics.rst │ │ │ │ ├── mib-tweaks.rst │ │ │ │ ├── modifying-variables.rst │ │ │ │ ├── snmp-versions.rst │ │ │ │ ├── table-operations.rst │ │ │ │ ├── transport-tweaks.rst │ │ │ │ └── walking-operations.rst │ │ │ ├── trollius │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ └── common-notifications.rst │ │ │ ├── contents.rst │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── snmp-versions.rst │ │ │ │ └── walking-operations.rst │ │ │ └── twisted │ │ │ ├── agent │ │ │ └── ntforg │ │ │ │ ├── advanced-topics.rst │ │ │ │ └── common-notifications.rst │ │ │ ├── contents.rst │ │ │ └── manager │ │ │ └── cmdgen │ │ │ ├── advanced-topics.rst │ │ │ ├── snmp-versions.rst │ │ │ ├── transport-tweaks.rst │ │ │ └── walking-operations.rst │ ├── smi │ │ ├── agent │ │ │ └── implementing-mib-objects.rst │ │ └── manager │ │ │ └── browsing-mib-tree.rst │ ├── v1arch │ │ └── asyncore │ │ │ ├── agent │ │ │ ├── cmdrsp │ │ │ │ └── agent-side-mib-implementations.rst │ │ │ └── ntforg │ │ │ │ └── transport-tweaks.rst │ │ │ └── manager │ │ │ ├── cmdgen │ │ │ ├── fetching-variables.rst │ │ │ ├── modifying-variables.rst │ │ │ ├── transport-tweaks.rst │ │ │ └── walking-operations.rst │ │ │ └── ntfrcv │ │ │ └── transport-tweaks.rst │ └── v3arch │ │ ├── asyncio │ │ ├── agent │ │ │ └── cmdrsp │ │ │ │ └── snmp-versions.rst │ │ ├── contents.rst │ │ └── manager │ │ │ └── ntfrcv │ │ │ └── transport-tweaks.rst │ │ ├── asyncore │ │ ├── agent │ │ │ ├── cmdrsp │ │ │ │ ├── advanced-topics.rst │ │ │ │ ├── agent-side-mib-implementations.rst │ │ │ │ ├── snmp-versions.rst │ │ │ │ └── transport-tweaks.rst │ │ │ └── ntforg │ │ │ │ ├── advanced-topics.rst │ │ │ │ ├── common-notifications.rst │ │ │ │ ├── evaluating-notification-type.rst │ │ │ │ ├── multiple-managers-operations.rst │ │ │ │ ├── snmp-versions.rst │ │ │ │ └── transport-tweaks.rst │ │ ├── contents.rst │ │ ├── manager │ │ │ ├── cmdgen │ │ │ │ ├── advanced-topics.rst │ │ │ │ ├── mib-tweaks.rst │ │ │ │ ├── modifying-variables.rst │ │ │ │ ├── snmp-versions.rst │ │ │ │ ├── table-operations.rst │ │ │ │ ├── transport-tweaks.rst │ │ │ │ └── walking-operations.rst │ │ │ └── ntfrcv │ │ │ │ ├── advanced-topics.rst │ │ │ │ ├── snmp-versions.rst │ │ │ │ └── transport-tweaks.rst │ │ └── proxy │ │ │ └── command │ │ │ ├── protocol-conversion.rst │ │ │ └── transport-conversion.rst │ │ ├── trollius │ │ └── contents.rst │ │ └── twisted │ │ ├── agent │ │ └── cmdrsp │ │ │ ├── agent-side-mib-implementations.rst │ │ │ ├── snmp-versions.rst │ │ │ └── transport-tweaks.rst │ │ ├── contents.rst │ │ └── manager │ │ └── ntfrcv │ │ ├── snmp-versions.rst │ │ └── transport-tweaks.rst │ ├── faq.rst │ ├── faq │ ├── getting-peer-information.rst │ ├── how-to-implement-agent-mib.rst │ ├── ignored-snmp-packets.rst │ ├── listening-on-multiple-interfaces.rst │ ├── non-printable-snmp-values-apps.rst │ ├── non-printable-snmp-values-tools.rst │ ├── oids-not-increasing.rst │ ├── pass-custom-mib-to-manager.rst │ ├── py2exe-throws-error.rst │ ├── response-values-mib-resolution.rst │ ├── snmp-data-constraints-verification-failure.rst │ └── walk-whole-mib.rst │ ├── license.rst │ ├── oldsite.rst │ └── quick-start.rst ├── examples ├── hlapi │ ├── v1arch │ │ ├── asyncio │ │ │ ├── agent │ │ │ │ └── ntforg │ │ │ │ │ ├── default-v1-trap.py │ │ │ │ │ └── multiple-notifications-at-once.py │ │ │ └── manager │ │ │ │ └── cmdgen │ │ │ │ ├── getbulk-to-eom.py │ │ │ │ ├── multiple-concurrent-queries-over-ipv4-and-ipv6.py │ │ │ │ ├── multiple-sequential-queries.py │ │ │ │ └── v1-get.py │ │ └── asyncore │ │ │ ├── agent │ │ │ └── ntforg │ │ │ │ ├── generic-v1-trap.py │ │ │ │ ├── generic-v2c-trap.py │ │ │ │ ├── v2c-inform.py │ │ │ │ └── v2c-trap-with-notification-objects.py │ │ │ ├── manager │ │ │ └── cmdgen │ │ │ │ ├── multiple-concurrent-queries-over-ipv4-and-ipv6.py │ │ │ │ ├── pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py │ │ │ │ ├── pull-whole-mib.py │ │ │ │ ├── v1-getnext.py │ │ │ │ └── v2c-get.py │ │ │ └── sync │ │ │ ├── agent │ │ │ └── ntforg │ │ │ │ ├── generic-v1-trap.py │ │ │ │ ├── generic-v2c-trap.py │ │ │ │ ├── v2c-inform.py │ │ │ │ └── v2c-trap-with-notification-objects.py │ │ │ └── manager │ │ │ └── cmdgen │ │ │ ├── coerce-set-value-to-mib-spec.py │ │ │ ├── custom-asn1-mib-search-path.py │ │ │ ├── custom-pysnmp-mibs-search-path.py │ │ │ ├── custom-timeout-and-retries.py │ │ │ ├── enable-mib-lookup.py │ │ │ ├── fetch-variables-over-ipv6.py │ │ │ ├── get-table-object-by-index.py │ │ │ ├── get-table-object-by-multiple-indices.py │ │ │ ├── getbulk-fetch-scalar-and-table-variables-over-ipv6.py │ │ │ ├── getbulk-limit-number-of-packets.py │ │ │ ├── multiple-get-calls.py │ │ │ ├── preload-pysnmp-mibs.py │ │ │ ├── pull-whole-mib.py │ │ │ ├── pull-whole-snmp-table.py │ │ │ ├── query-agents-from-multuple-threads-over-ipv4-and-ipv6.py │ │ │ ├── set-multiple-scalar-values.py │ │ │ ├── v1-get.py │ │ │ └── v2c-get.py │ └── v3arch │ │ ├── asyncio │ │ ├── agent │ │ │ └── ntforg │ │ │ │ ├── default-v1-trap.py │ │ │ │ └── multiple-notifications-at-once.py │ │ └── manager │ │ │ └── cmdgen │ │ │ ├── getbulk-to-eom.py │ │ │ ├── multiple-concurrent-queries-over-ipv4-and-ipv6.py │ │ │ ├── multiple-sequential-queries.py │ │ │ └── v1-get.py │ │ ├── asyncore │ │ ├── agent │ │ │ └── ntforg │ │ │ │ ├── default-v1-trap.py │ │ │ │ ├── multiple-informs-at-once.py │ │ │ │ ├── multiple-traps-at-once.py │ │ │ │ └── running-multiple-snmp-engines-at-once.py │ │ ├── manager │ │ │ └── cmdgen │ │ │ │ ├── multiple-concurrent-queries-over-ipv4-and-ipv6.py │ │ │ │ ├── pull-mibs-from-multiple-agents-at-once-over-ipv4-and-ipv6.py │ │ │ │ ├── pull-whole-mib.py │ │ │ │ ├── query-multiple-snmp-engines-over-ipv4-and-ipv6.py │ │ │ │ └── v2c-get.py │ │ └── sync │ │ │ ├── agent │ │ │ └── ntforg │ │ │ │ ├── custom-contextengineid.py │ │ │ │ ├── custom-contextname.py │ │ │ │ ├── custom-v1-trap.py │ │ │ │ ├── default-v1-trap.py │ │ │ │ ├── send-notification-with-additional-varbinds.py │ │ │ │ ├── v2c-trap-with-notification-objects.py │ │ │ │ ├── v3-inform.py │ │ │ │ └── v3-trap.py │ │ │ └── manager │ │ │ └── cmdgen │ │ │ ├── coerce-set-value-to-mib-spec.py │ │ │ ├── custom-asn1-mib-search-path.py │ │ │ ├── custom-contextengineid-and-contextname.py │ │ │ ├── custom-contextengineid.py │ │ │ ├── custom-pysnmp-mibs-search-path.py │ │ │ ├── custom-timeout-and-retries.py │ │ │ ├── custom-v3-security-name.py │ │ │ ├── fetch-variables-over-ipv6.py │ │ │ ├── get-table-object-by-index.py │ │ │ ├── get-table-object-by-multiple-indices.py │ │ │ ├── getbulk-fetch-scalar-and-table-variables-over-ipv6.py │ │ │ ├── getbulk-limit-number-of-packets.py │ │ │ ├── getbulk-limit-number-of-variables.py │ │ │ ├── getnext-limit-number-of-variables.py │ │ │ ├── getnext-multiple-oids-to-eom.py │ │ │ ├── multiple-get-calls.py │ │ │ ├── preload-pysnmp-mibs.py │ │ │ ├── pull-whole-mib.py │ │ │ ├── pull-whole-snmp-table.py │ │ │ ├── query-agents-from-multuple-threads-over-ipv4-and-ipv6.py │ │ │ ├── set-multiple-scalar-values.py │ │ │ ├── specific-v3-engine-id.py │ │ │ ├── usm-localized-keys.py │ │ │ ├── usm-master-keys.py │ │ │ ├── usm-md5-des.py │ │ │ ├── usm-md5-none.py │ │ │ ├── usm-none-none.py │ │ │ ├── usm-sha-aes128.py │ │ │ ├── v1-get.py │ │ │ ├── v2c-get.py │ │ │ ├── v2c-getbulk.py │ │ │ └── waive-mib-lookup.py │ │ ├── trollius │ │ ├── agent │ │ │ └── ntforg │ │ │ │ └── default-v1-trap.py │ │ └── manager │ │ │ └── cmdgen │ │ │ ├── getbulk-to-eom.py │ │ │ └── v1-get.py │ │ └── twisted │ │ ├── agent │ │ └── ntforg │ │ │ ├── default-v1-trap.py │ │ │ ├── multiple-notifications-at-once.py │ │ │ └── v2c-trap-inline-callbacks.py │ │ └── manager │ │ └── cmdgen │ │ ├── custom-timeout-and-retries.py │ │ ├── getbulk-to-eom.py │ │ ├── multiple-concurrent-queries.py │ │ ├── pull-mibs-from-multiple-agents-at-once.py │ │ ├── pull-whole-mib.py │ │ └── v1-get.py ├── smi │ ├── agent │ │ ├── custom-managed-object.py │ │ └── operations-on-managed-objects.py │ └── manager │ │ ├── configure-mib-viewer-and-resolve-pdu-varbinds.py │ │ ├── convert-between-pdu-varbinds-and-mib-objects.py │ │ └── mib-tree-inspection.py ├── v1arch │ └── asyncore │ │ ├── agent │ │ ├── cmdrsp │ │ │ └── implementing-scalar-mib-objects-over-ipv4-and-ipv6.py │ │ └── ntforg │ │ │ ├── send-inform-over-ipv4-and-ipv6.py │ │ │ └── send-trap-over-ipv4-and-ipv6.py │ │ └── manager │ │ ├── cmdgen │ │ ├── broadcast-agent-discovery.py │ │ ├── fetch-scalar-value.py │ │ ├── getbulk-pull-whole-mib.py │ │ ├── getnext-pull-whole-mib.py │ │ ├── spoof-source-address.py │ │ └── v2c-set.py │ │ └── ntfrcv │ │ └── listen-on-ipv4-and-ipv6-interfaces.py └── v3arch │ ├── asyncio │ ├── agent │ │ └── cmdrsp │ │ │ └── multiple-usm-users.py │ └── manager │ │ └── ntfrcv │ │ └── multiple-interfaces.py │ ├── asyncore │ ├── agent │ │ ├── cmdrsp │ │ │ ├── alternative-mib-tree.py │ │ │ ├── custom-mib-controller.py │ │ │ ├── custom-snmp-engine-id.py │ │ │ ├── detailed-vacm-configuration.py │ │ │ ├── implementing-scalar-mib-objects.py │ │ │ ├── implementing-snmp-table.py │ │ │ ├── listen-on-ipv4-and-ipv6-interfaces.py │ │ │ ├── listen-on-multiple-interfaces.py │ │ │ ├── listening-on-virtual-network-interface.py │ │ │ ├── multiple-snmp-communities.py │ │ │ ├── multiple-snmp-contexts.py │ │ │ ├── multiple-snmp-engines.py │ │ │ ├── multiple-usm-users.py │ │ │ └── observe-request-processing.py │ │ └── ntforg │ │ │ ├── multiple-different-notifications-at-once.py │ │ │ ├── send-custom-pdu.py │ │ │ ├── send-inform-to-multiple-managers.py │ │ │ ├── send-notification-over-ipv4-and-ipv6.py │ │ │ ├── send-packet-from-specific-address.py │ │ │ ├── send-trap-to-multiple-managers.py │ │ │ ├── usm-md5-none.py │ │ │ ├── v1-trap.py │ │ │ ├── v2c-inform.py │ │ │ ├── v2c-trap-with-notification-objects.py │ │ │ ├── v2c-trap.py │ │ │ └── v3-trap.py │ ├── manager │ │ ├── cmdgen │ │ │ ├── custom-contextengineid-and-contextname.py │ │ │ ├── custom-timeout-and-retries.py │ │ │ ├── fetch-variables-over-ipv6.py │ │ │ ├── getbulk-fetch-scalar-and-table-variables.py │ │ │ ├── getbulk-multiple-oids-to-eom.py │ │ │ ├── getnext-multiple-oids-and-resolve-with-mib.py │ │ │ ├── getnext-multiple-oids-to-eom.py │ │ │ ├── observe-request-processing.py │ │ │ ├── pull-subtree.py │ │ │ ├── send-packets-from-specific-interface.py │ │ │ ├── set-multiple-scalar-values.py │ │ │ ├── spoof-source-address.py │ │ │ ├── usm-sha-aes128.py │ │ │ ├── usm-sha-none.py │ │ │ ├── v1-get.py │ │ │ └── v2c-set.py │ │ └── ntfrcv │ │ │ ├── determine-peer-network-address.py │ │ │ ├── multiple-network-interfaces.py │ │ │ ├── multiple-network-transports-incl-ipv4-and-ipv6.py │ │ │ ├── multiple-usm-users.py │ │ │ ├── observe-request-processing-over-ipv4-and-ipv6.py │ │ │ └── regexp-community-name.py │ └── proxy │ │ └── command │ │ ├── ipv6-to-ipv4-conversion.py │ │ ├── v2c-to-v1-conversion.py │ │ ├── v2c-to-v3-conversion.py │ │ └── v3-to-v2c-conversion.py │ └── twisted │ ├── agent │ └── cmdrsp │ │ ├── implementing-scalar-mib-objects.py │ │ ├── multiple-interfaces.py │ │ ├── multiple-snmp-communities.py │ │ └── multiple-usm-users.py │ └── manager │ └── ntfrcv │ ├── multiple-interfaces.py │ └── multiple-usm-users.py ├── extra-requirements.txt ├── pysnmp ├── __init__.py ├── cache.py ├── carrier │ ├── __init__.py │ ├── asyncio │ │ ├── __init__.py │ │ ├── base.py │ │ ├── dgram │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── udp.py │ │ │ └── udp6.py │ │ └── dispatch.py │ ├── asyncore │ │ ├── __init__.py │ │ ├── base.py │ │ ├── dgram │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── udp.py │ │ │ ├── udp6.py │ │ │ └── unix.py │ │ └── dispatch.py │ ├── base.py │ ├── error.py │ ├── sockfix.py │ ├── sockmsg.py │ └── twisted │ │ ├── __init__.py │ │ ├── base.py │ │ ├── dgram │ │ ├── __init__.py │ │ ├── base.py │ │ ├── udp.py │ │ └── unix.py │ │ └── dispatch.py ├── debug.py ├── entity │ ├── __init__.py │ ├── config.py │ ├── engine.py │ ├── observer.py │ └── rfc3413 │ │ ├── __init__.py │ │ ├── cmdgen.py │ │ ├── cmdrsp.py │ │ ├── config.py │ │ ├── context.py │ │ ├── ntforg.py │ │ └── ntfrcv.py ├── error.py ├── hlapi │ ├── __init__.py │ ├── transport.py │ ├── v1arch │ │ ├── __init__.py │ │ ├── asyncio │ │ │ ├── __init__.py │ │ │ ├── cmdgen.py │ │ │ ├── dispatch.py │ │ │ ├── ntforg.py │ │ │ └── transport.py │ │ ├── asyncore │ │ │ ├── __init__.py │ │ │ ├── cmdgen.py │ │ │ ├── dispatch.py │ │ │ ├── ntforg.py │ │ │ ├── sync │ │ │ │ ├── __init__.py │ │ │ │ ├── cmdgen.py │ │ │ │ └── ntforg.py │ │ │ └── transport.py │ │ ├── auth.py │ │ └── dispatch.py │ ├── v3arch │ │ ├── __init__.py │ │ ├── asyncio │ │ │ ├── __init__.py │ │ │ ├── cmdgen.py │ │ │ ├── ntforg.py │ │ │ └── transport.py │ │ ├── asyncore │ │ │ ├── __init__.py │ │ │ ├── cmdgen.py │ │ │ ├── ntforg.py │ │ │ ├── sync │ │ │ │ ├── __init__.py │ │ │ │ ├── cmdgen.py │ │ │ │ └── ntforg.py │ │ │ └── transport.py │ │ ├── auth.py │ │ ├── context.py │ │ ├── lcd.py │ │ └── twisted │ │ │ ├── __init__.py │ │ │ ├── cmdgen.py │ │ │ ├── ntforg.py │ │ │ └── transport.py │ └── varbinds.py ├── nextid.py ├── proto │ ├── __init__.py │ ├── acmod │ │ ├── __init__.py │ │ ├── rfc3415.py │ │ └── void.py │ ├── api │ │ ├── __init__.py │ │ ├── v1.py │ │ ├── v2c.py │ │ └── verdec.py │ ├── cache.py │ ├── errind.py │ ├── error.py │ ├── mpmod │ │ ├── __init__.py │ │ ├── base.py │ │ ├── cache.py │ │ ├── rfc2576.py │ │ └── rfc3412.py │ ├── proxy │ │ ├── __init__.py │ │ └── rfc2576.py │ ├── rfc1155.py │ ├── rfc1157.py │ ├── rfc1901.py │ ├── rfc1902.py │ ├── rfc1905.py │ ├── rfc3411.py │ ├── rfc3412.py │ └── secmod │ │ ├── __init__.py │ │ ├── base.py │ │ ├── cache.py │ │ ├── eso │ │ ├── __init__.py │ │ └── priv │ │ │ ├── __init__.py │ │ │ ├── aes192.py │ │ │ ├── aes256.py │ │ │ ├── aesbase.py │ │ │ └── des3.py │ │ ├── rfc2576.py │ │ ├── rfc3414 │ │ ├── __init__.py │ │ ├── auth │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── hmacmd5.py │ │ │ ├── hmacsha.py │ │ │ └── noauth.py │ │ ├── localkey.py │ │ ├── priv │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── des.py │ │ │ └── nopriv.py │ │ └── service.py │ │ ├── rfc3826 │ │ ├── __init__.py │ │ └── priv │ │ │ ├── __init__.py │ │ │ └── aes.py │ │ └── rfc7860 │ │ ├── __init__.py │ │ └── auth │ │ ├── __init__.py │ │ └── hmacsha2.py └── smi │ ├── __init__.py │ ├── builder.py │ ├── compiler.py │ ├── error.py │ ├── exval.py │ ├── indices.py │ ├── instrum.py │ ├── mibs │ ├── ASN1-ENUMERATION.py │ ├── ASN1-REFINEMENT.py │ ├── ASN1.py │ ├── INET-ADDRESS-MIB.py │ ├── PYSNMP-MIB.py │ ├── PYSNMP-SOURCE-MIB.py │ ├── PYSNMP-USM-MIB.py │ ├── RFC1158-MIB.py │ ├── RFC1213-MIB.py │ ├── SNMP-COMMUNITY-MIB.py │ ├── SNMP-FRAMEWORK-MIB.py │ ├── SNMP-MPD-MIB.py │ ├── SNMP-NOTIFICATION-MIB.py │ ├── SNMP-PROXY-MIB.py │ ├── SNMP-TARGET-MIB.py │ ├── SNMP-USER-BASED-SM-3DES-MIB.py │ ├── SNMP-USER-BASED-SM-MIB.py │ ├── SNMP-USM-AES-MIB.py │ ├── SNMP-USM-HMAC-SHA2-MIB.py │ ├── SNMP-VIEW-BASED-ACM-MIB.py │ ├── SNMPv2-CONF.py │ ├── SNMPv2-MIB.py │ ├── SNMPv2-SMI.py │ ├── SNMPv2-TC.py │ ├── SNMPv2-TM.py │ ├── TRANSPORT-ADDRESS-MIB.py │ ├── __init__.py │ └── instances │ │ ├── __PYSNMP-USM-MIB.py │ │ ├── __SNMP-FRAMEWORK-MIB.py │ │ ├── __SNMP-MPD-MIB.py │ │ ├── __SNMP-TARGET-MIB.py │ │ ├── __SNMP-USER-BASED-SM-MIB.py │ │ ├── __SNMP-VIEW-BASED-ACM-MIB.py │ │ ├── __SNMPv2-MIB.py │ │ └── __init__.py │ ├── rfc1902.py │ └── view.py ├── requirements.txt ├── runtests.sh ├── setup.cfg ├── setup.py └── tox.ini /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: http://snmplabs.com/sponsorship.html 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Python stuff 2 | *.pyc 3 | __pycache__ 4 | 5 | # vim swapfiles 6 | *.sw? 7 | 8 | # python packaging 9 | MANIFEST 10 | dist/ 11 | build/ 12 | *.egg-info/ 13 | 14 | # PyCharm stuff 15 | .idea/ 16 | 17 | # Sphinx template 18 | docs/source/.templates/layout.html 19 | 20 | # Eclipse stuff 21 | .project 22 | .pydevproject 23 | 24 | # Virtual envs 25 | venv* 26 | 27 | # Tox 28 | .tox/ 29 | 30 | # Pyenv 31 | .python-version 32 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | cache: pip 3 | matrix: 4 | include: 5 | - python: '2.6' 6 | dist: trusty 7 | - python: '2.7' 8 | - python: '3.3' 9 | dist: trusty 10 | - python: '3.4' 11 | - python: '3.5' 12 | - python: '3.6' 13 | - python: '3.7' 14 | - python: '3.8' 15 | - python: 'nightly' 16 | - python: 'pypy' 17 | - python: 'pypy3' 18 | install: 19 | - pip install -r requirements.txt -r devel-requirements.txt -r extra-requirements.txt 20 | - pip install -e . 21 | script: 22 | - travis_wait 90 sh runtests.sh 23 | -------------------------------------------------------------------------------- /LICENSE.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005-2019, Ilya Etingof 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.rst *.txt *.md *.sh 2 | recursive-include examples *.py 3 | recursive-include docs/source *.rst *.svg *.py 4 | recursive-include docs/mibs *.txt 5 | recursive-include docs *.conf Makefile 6 | prune docs/build 7 | -------------------------------------------------------------------------------- /THANKS.txt: -------------------------------------------------------------------------------- 1 | Many people contributed to pysnmp by reporting problems, suggesting 2 | various improvements or submitting actual code. The list goes 3 | in a more-or-less chronological order: 4 | 5 | Cameron Laird 6 | Case Vanhorsen 7 | Jarkko Torppa 8 | Tim Kwiatkowski 9 | Carlos Ribeiro 10 | Chris Green 11 | Doobee R. Tzeck 12 | Jim Crumpler 13 | Roy Smith 14 | Mark Kilmartin 15 | Matthew W. Samsonoff 16 | John P Speno 17 | Mike C. Fletcher 18 | Wichert Akkerman 19 | Hernan Perez Masci 20 | Martin Jackson 21 | Ivan Zderadicka 22 | Randy Couey 23 | Brian Kyckelhahn 24 | Mark M Evans 25 | Filippo Giunchedi at Truelite Srl 26 | Matt Hooks 27 | Zachary Lorusso 28 | Floris Bruynooghe 29 | Laurelin of Middle Earth 30 | Robert Reese 31 | Olivier Verriest 32 | Eugene M. Kim 33 | Matt Bullock 34 | Thanks to Python Software Foundation for granting financial support 35 | for the project. 36 | -------------------------------------------------------------------------------- /devel-requirements.txt: -------------------------------------------------------------------------------- 1 | Sphinx <= 1.6; python_version < '2.7' 2 | Sphinx > 1.6; python_version >= '2.7' 3 | -------------------------------------------------------------------------------- /docs/README.txt: -------------------------------------------------------------------------------- 1 | You need Sphinx to build this documentation. Or you can read it in ASCII. ;) 2 | 3 | Better run: 4 | 5 | # pip install sphinx 6 | 7 | and once Sphinx is installed on your system, run: 8 | 9 | $ make html 10 | 11 | To build a copy of HTML'ed PySNMP documentation. 12 | -------------------------------------------------------------------------------- /docs/source/.static/css/rtdimproved.css: -------------------------------------------------------------------------------- 1 | @import url("../pygments.css"); 2 | @import url("theme.css"); 3 | 4 | /* fix horizontal padding to accomodate adsense banners */ 5 | .wy-nav-content { 6 | padding: 1.618em 2.236em; 7 | height: 100%; 8 | /* max-width: 800px; */ 9 | margin: auto; 10 | } 11 | -------------------------------------------------------------------------------- /docs/source/.static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etingof/pysnmp/becd15c79c9a6b5696928ecd50bf5cca8b1770a1/docs/source/.static/favicon.ico -------------------------------------------------------------------------------- /docs/source/changelog.rst: -------------------------------------------------------------------------------- 1 | 2 | Changelog 3 | ========= 4 | 5 | .. include:: ../../CHANGES.txt 6 | 7 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/agent/ntforg/notification.rst: -------------------------------------------------------------------------------- 1 | 2 | TRAP/INFORM notification 3 | ======================== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.asyncore.sendNotification 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/manager/cmdgen/bulkcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETBULK command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.asyncore.bulkCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/manager/cmdgen/getcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.asyncore.getCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/manager/cmdgen/nextcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETNEXT command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.asyncore.nextCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/manager/cmdgen/setcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | SET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.asyncore.setCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/sync/agent/ntforg/notification.rst: -------------------------------------------------------------------------------- 1 | 2 | TRAP/INFORM notification 3 | ======================== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.sendNotification 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/sync/manager/cmdgen/bulkcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETBULK command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.bulkCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/sync/manager/cmdgen/getcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.getCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/sync/manager/cmdgen/nextcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETNEXT command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.nextCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v1arch/asyncore/sync/manager/cmdgen/setcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | SET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v1arch.setCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncio/agent/ntforg/notification.rst: -------------------------------------------------------------------------------- 1 | 2 | TRAP/INFORM notification 3 | ======================== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncio.sendNotification 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncio/manager/cmdgen/bulkcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETBULK command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncio.bulkCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncio/manager/cmdgen/getcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncio.getCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncio/manager/cmdgen/nextcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETNEXT command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncio.nextCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncio/manager/cmdgen/setcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | SET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncio.setCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/agent/ntforg/notification.rst: -------------------------------------------------------------------------------- 1 | 2 | TRAP/INFORM notification 3 | ======================== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncore.sendNotification 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/manager/cmdgen/bulkcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETBULK command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncore.bulkCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/manager/cmdgen/getcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncore.getCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/manager/cmdgen/nextcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETNEXT command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncore.nextCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/manager/cmdgen/setcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | SET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.asyncore.setCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/sync/agent/ntforg/notification.rst: -------------------------------------------------------------------------------- 1 | 2 | TRAP/INFORM notification 3 | ======================== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.sendNotification 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/sync/manager/cmdgen/bulkcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETBULK command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.bulkCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/sync/manager/cmdgen/getcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.getCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/sync/manager/cmdgen/nextcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETNEXT command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.nextCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/asyncore/sync/manager/cmdgen/setcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | SET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.setCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/twisted/agent/ntforg/notification.rst: -------------------------------------------------------------------------------- 1 | 2 | TRAP/INFORM notification 3 | ======================== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.twisted.sendNotification 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/twisted/manager/cmdgen/bulkcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETBULK command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.twisted.bulkCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/twisted/manager/cmdgen/getcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.twisted.getCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/twisted/manager/cmdgen/nextcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | GETNEXT command 3 | =============== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.twisted.nextCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/hlapi/v3arch/twisted/manager/cmdgen/setcmd.rst: -------------------------------------------------------------------------------- 1 | 2 | SET command 3 | =========== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | .. autofunction:: pysnmp.hlapi.v3arch.twisted.setCmd 9 | -------------------------------------------------------------------------------- /docs/source/docs/tutorial.rst: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | /docs/snmp-history 9 | /docs/snmp-design 10 | /docs/pysnmp-architecture 11 | /docs/pysnmp-hlapi-tutorial 12 | 13 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncio/agent/ntforg/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Notification Originator 5 | -------------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncio/agent/ntforg/multiple-notifications-at-once.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncio/agent/ntforg/multiple-notifications-at-once.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncio/agent/ntforg/common-notifications.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Common notifications 5 | -------------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncio/agent/ntforg/default-v1-trap.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncio/agent/ntforg/default-v1-trap.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncio/manager/cmdgen/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Command Generator 5 | -------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/multiple-sequential-queries.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/multiple-sequential-queries.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncio/manager/cmdgen/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/v1-get.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/v1-get.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/getbulk-to-eom.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/getbulk-to-eom.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncio/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/getbulk-to-eom.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncio/manager/cmdgen/getbulk-to-eom.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Notification Originator 5 | -------------------------------- 6 | 7 | See also: :doc:`library reference `. 8 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/evaluating-notification-type.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Evaluating NOTIFICATION-TYPE 5 | ---------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/modifying-variables.rst: -------------------------------------------------------------------------------- 1 | 2 | .. toctree:: 3 | :maxdepth: 2 4 | 5 | Modifying variables 6 | ------------------- 7 | 8 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py 9 | :start-after: """ 10 | :end-before: """# 11 | 12 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py 13 | :start-after: """# 14 | :language: python 15 | 16 | :download:`Download` script. 17 | 18 | 19 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py 20 | :start-after: """ 21 | :end-before: """# 22 | 23 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py 24 | :start-after: """# 25 | :language: python 26 | 27 | :download:`Download` script. 28 | 29 | 30 | See also: :doc:`library-reference `. 31 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | .. comment 18 | 19 | .. include:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py 20 | :start-after: """ 21 | :end-before: """# 22 | 23 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py 24 | :start-after: """# 25 | :language: python 26 | 27 | :download:`Download` script. 28 | 29 | 30 | See also: :doc:`library reference `. 31 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/evaluating-notification-type.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Evaluating NOTIFICATION-TYPE 5 | ---------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/modifying-variables.rst: -------------------------------------------------------------------------------- 1 | 2 | .. toctree:: 3 | :maxdepth: 2 4 | 5 | Modifying variables 6 | ------------------- 7 | 8 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py 9 | :start-after: """ 10 | :end-before: """# 11 | 12 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py 13 | :start-after: """# 14 | :language: python 15 | 16 | :download:`Download` script. 17 | 18 | 19 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py 20 | :start-after: """ 21 | :end-before: """# 22 | 23 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py 24 | :start-after: """# 25 | :language: python 26 | 27 | :download:`Download` script. 28 | 29 | 30 | See also: :doc:`library-reference `. 31 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | SNMP versions 5 | ------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncio/agent/ntforg/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Notification Originator 5 | -------------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncio/agent/ntforg/multiple-notifications-at-once.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncio/agent/ntforg/multiple-notifications-at-once.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncio/agent/ntforg/common-notifications.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Common notifications 5 | -------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncio/agent/ntforg/default-v1-trap.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncio/agent/ntforg/default-v1-trap.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncio/manager/cmdgen/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Command Generator 5 | -------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-concurrent-queries-over-ipv4-and-ipv6.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-sequential-queries.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/multiple-sequential-queries.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncio/manager/cmdgen/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/v1-get.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/v1-get.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/getbulk-to-eom.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/getbulk-to-eom.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncio/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/getbulk-to-eom.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncio/manager/cmdgen/getbulk-to-eom.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/agent/ntforg/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Notification Originator 5 | -------------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-traps-at-once.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-traps-at-once.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-informs-at-once.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/multiple-informs-at-once.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | .. include:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py 30 | :start-after: """ 31 | :end-before: """# 32 | 33 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py 34 | :start-after: """# 35 | :language: python 36 | 37 | :download:`Download` script. 38 | 39 | 40 | See also: :doc:`library reference `. 41 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/agent/ntforg/common-notifications.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Common notifications 5 | -------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/default-v1-trap.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/agent/ntforg/default-v1-trap.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/manager/cmdgen/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/manager/cmdgen/v2c-get.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/manager/cmdgen/v2c-get.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-whole-mib.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-whole-mib.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-whole-mib.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/manager/cmdgen/pull-whole-mib.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Notification Originator 5 | -------------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextname.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextname.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextengineid.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextengineid.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | See also: :doc:`library reference `. 29 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/evaluating-notification-type.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Evaluating NOTIFICATION-TYPE 5 | ---------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/snmp-v1-trap-variants.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | SNMPv1 TRAP variants 5 | -------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/default-v1-trap.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/agent/ntforg/default-v1-trap.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/modifying-variables.rst: -------------------------------------------------------------------------------- 1 | 2 | .. toctree:: 3 | :maxdepth: 2 4 | 5 | Modifying variables 6 | ------------------- 7 | 8 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py 9 | :start-after: """ 10 | :end-before: """# 11 | 12 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py 13 | :start-after: """# 14 | :language: python 15 | 16 | :download:`Download` script. 17 | 18 | 19 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py 20 | :start-after: """ 21 | :end-before: """# 22 | 23 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py 24 | :start-after: """# 25 | :language: python 26 | 27 | :download:`Download` script. 28 | 29 | 30 | See also: :doc:`library-reference `. 31 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/trollius/agent/ntforg/common-notifications.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Common notifications 5 | -------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/trollius/agent/ntforg/default-v1-trap.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/trollius/agent/ntforg/default-v1-trap.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/trollius/manager/cmdgen/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/trollius/manager/cmdgen/v1-get.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/trollius/manager/cmdgen/v1-get.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/trollius/manager/cmdgen/getbulk-to-eom.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/trollius/manager/cmdgen/getbulk-to-eom.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/trollius/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v3arch/trollius/manager/cmdgen/getbulk-to-eom.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/trollius/manager/cmdgen/getbulk-to-eom.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/twisted/agent/ntforg/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Notification Originator 5 | -------------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/twisted/agent/ntforg/multiple-notifications-at-once.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/agent/ntforg/multiple-notifications-at-once.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/twisted/agent/ntforg/common-notifications.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Common notifications 5 | -------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/twisted/agent/ntforg/default-v1-trap.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/agent/ntforg/default-v1-trap.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | .. include:: /../../examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py 18 | :start-after: """ 19 | :end-before: """# 20 | 21 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/agent/ntforg/v2c-trap-inline-callbacks.py 22 | :start-after: """# 23 | :language: python 24 | 25 | :download:`Download` script. 26 | 27 | See also: :doc:`library reference `. 28 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/twisted/manager/cmdgen/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced Command Generator 5 | -------------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/multiple-concurrent-queries.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/pull-mibs-from-multiple-agents-at-once.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/twisted/manager/cmdgen/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/v1-get.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/v1-get.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/getbulk-to-eom.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/getbulk-to-eom.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/twisted/manager/cmdgen/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/custom-timeout-and-retries.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/custom-timeout-and-retries.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/hlapi/v3arch/twisted/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/getbulk-to-eom.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/getbulk-to-eom.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | .. include:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/pull-whole-mib.py 18 | :start-after: """ 19 | :end-before: """# 20 | 21 | .. literalinclude:: /../../examples/hlapi/v3arch/twisted/manager/cmdgen/pull-whole-mib.py 22 | :start-after: """# 23 | :language: python 24 | 25 | :download:`Download` script. 26 | 27 | See also: :doc:`library reference `. 28 | -------------------------------------------------------------------------------- /docs/source/examples/smi/agent/implementing-mib-objects.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Agent side 5 | ---------- 6 | 7 | .. include:: /../../examples/smi/agent/custom-managed-object.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/smi/agent/custom-managed-object.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/smi/agent/operations-on-managed-objects.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/smi/agent/operations-on-managed-objects.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/smi/manager/browsing-mib-tree.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Manager side 5 | ------------ 6 | 7 | .. include:: /../../examples/smi/manager/configure-mib-viewer-and-resolve-pdu-varbinds.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/smi/manager/configure-mib-viewer-and-resolve-pdu-varbinds.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/smi/manager/convert-between-pdu-varbinds-and-mib-objects.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/smi/manager/convert-between-pdu-varbinds-and-mib-objects.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | 30 | .. include:: /../../examples/smi/manager/mib-tree-inspection.py 31 | :start-after: """ 32 | :end-before: """# 33 | 34 | .. literalinclude:: /../../examples/smi/manager/mib-tree-inspection.py 35 | :start-after: """# 36 | :language: python 37 | 38 | :download:`Download` script. 39 | 40 | 41 | See also: :doc:`library reference `. 42 | -------------------------------------------------------------------------------- /docs/source/examples/v1arch/asyncore/agent/cmdrsp/agent-side-mib-implementations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Agent-side MIB implementations 5 | ------------------------------ 6 | 7 | .. include:: /../../examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects-over-ipv4-and-ipv6.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v1arch/asyncore/agent/cmdrsp/implementing-scalar-mib-objects-over-ipv4-and-ipv6.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v1arch/asyncore/agent/ntforg/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v1arch/asyncore/agent/ntforg/send-trap-over-ipv4-and-ipv6.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v1arch/asyncore/manager/cmdgen/fetching-variables.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Fetching variables 5 | ------------------ 6 | 7 | .. include:: /../../examples/v1arch/asyncore/manager/cmdgen/fetch-scalar-value.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v1arch/asyncore/manager/cmdgen/fetch-scalar-value.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v1arch/asyncore/manager/cmdgen/modifying-variables.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Modifying variables 5 | ------------------- 6 | 7 | .. include:: /../../examples/v1arch/asyncore/manager/cmdgen/v2c-set.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v1arch/asyncore/manager/cmdgen/v2c-set.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v1arch/asyncore/manager/cmdgen/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v1arch/asyncore/manager/cmdgen/spoof-source-address.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v1arch/asyncore/manager/cmdgen/spoof-source-address.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v1arch/asyncore/manager/cmdgen/broadcast-agent-discovery.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v1arch/asyncore/manager/cmdgen/broadcast-agent-discovery.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v1arch/asyncore/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | MIB walking operations 5 | ---------------------- 6 | 7 | .. include:: /../../examples/v1arch/asyncore/manager/cmdgen/getnext-pull-whole-mib.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v1arch/asyncore/manager/cmdgen/getnext-pull-whole-mib.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v1arch/asyncore/manager/cmdgen/getbulk-pull-whole-mib.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v1arch/asyncore/manager/cmdgen/getbulk-pull-whole-mib.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v1arch/asyncore/manager/ntfrcv/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncio/agent/cmdrsp/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncio/agent/cmdrsp/multiple-usm-users.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncio/agent/cmdrsp/multiple-usm-users.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncio/manager/ntfrcv/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncio/manager/ntfrcv/multiple-interfaces.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncio/manager/ntfrcv/multiple-interfaces.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/agent/cmdrsp/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/agent/cmdrsp/multiple-usm-users.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/cmdrsp/multiple-usm-users.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/agent/cmdrsp/multiple-snmp-communities.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/cmdrsp/multiple-snmp-communities.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/agent/cmdrsp/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/agent/cmdrsp/listen-on-ipv4-and-ipv6-interfaces.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/cmdrsp/listen-on-ipv4-and-ipv6-interfaces.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/agent/cmdrsp/listen-on-multiple-interfaces.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/cmdrsp/listen-on-multiple-interfaces.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | .. include:: /../../examples/v3arch/asyncore/agent/cmdrsp/listening-on-virtual-network-interface.py 30 | :start-after: """ 31 | :end-before: """# 32 | 33 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/cmdrsp/listening-on-virtual-network-interface.py 34 | :start-after: """# 35 | :language: python 36 | 37 | :download:`Download` script. 38 | 39 | 40 | See also: :doc:`library reference `. 41 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/agent/ntforg/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced topic 5 | -------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/agent/ntforg/send-custom-pdu.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/ntforg/send-custom-pdu.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/agent/ntforg/common-notifications.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Common notifications 5 | -------------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/agent/ntforg/v1-trap.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/ntforg/v1-trap.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | .. include:: /../../examples/v3arch/asyncore/agent/ntforg/v2c-trap.py 18 | :start-after: """ 19 | :end-before: """# 20 | 21 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/ntforg/v2c-trap.py 22 | :start-after: """# 23 | :language: python 24 | 25 | :download:`Download` script. 26 | 27 | .. include:: /../../examples/v3arch/asyncore/agent/ntforg/v2c-inform.py 28 | :start-after: """ 29 | :end-before: """# 30 | 31 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/ntforg/v2c-inform.py 32 | :start-after: """# 33 | :language: python 34 | 35 | :download:`Download` script. 36 | 37 | See also: :doc:`library reference `. 38 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/agent/ntforg/evaluating-notification-type.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Evaluating NOTIFICATION-TYPE 5 | ---------------------------- 6 | 7 | SNMP SMI defines notifications as a TRAP or INFORM PDU containing 8 | the indication of type (snmpTrapOID) and a set of MIB variables 9 | (Managed Objects Instances) fetched from Agent's MIB at the moment 10 | of notification. 11 | 12 | Consequently, sending specific NOTIFICATION-TYPE implies including certain 13 | set of OIDs into PDU. PySNMP offers this facility through NotificationType 14 | class. 15 | 16 | .. include:: /../../examples/v3arch/asyncore/agent/ntforg/v2c-trap-with-notification-objects.py 17 | :start-after: """ 18 | :end-before: """# 19 | 20 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/ntforg/v2c-trap-with-notification-objects.py 21 | :start-after: """# 22 | :language: python 23 | 24 | :download:`Download` script. 25 | 26 | 27 | See also: :doc:`library reference `. 28 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/agent/ntforg/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/agent/ntforg/send-notification-over-ipv4-and-ipv6.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/ntforg/send-notification-over-ipv4-and-ipv6.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/agent/ntforg/send-packet-from-specific-address.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/agent/ntforg/send-packet-from-specific-address.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/cmdgen/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced topics 5 | --------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/observe-request-processing.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/observe-request-processing.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/cmdgen/mib-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | MIB tweaks 5 | ---------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/getnext-multiple-oids-and-resolve-with-mib.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/getnext-multiple-oids-and-resolve-with-mib.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/cmdgen/modifying-variables.rst: -------------------------------------------------------------------------------- 1 | 2 | .. toctree:: 3 | :maxdepth: 2 4 | 5 | Modifying values 6 | ---------------- 7 | 8 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/set-multiple-scalar-values.py 9 | :start-after: """ 10 | :end-before: """# 11 | 12 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/set-multiple-scalar-values.py 13 | :start-after: """# 14 | :language: python 15 | 16 | :download:`Download` script. 17 | 18 | 19 | See also: :doc:`library reference `. 20 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/cmdgen/table-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Table operations 5 | ---------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/getbulk-fetch-scalar-and-table-variables.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/getbulk-fetch-scalar-and-table-variables.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/pull-subtree.py 18 | :start-after: """ 19 | :end-before: """# 20 | 21 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/pull-subtree.py 22 | :start-after: """# 23 | :language: python 24 | 25 | :download:`Download` script. 26 | 27 | 28 | See also: :doc:`library reference `. 29 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/cmdgen/walking-operations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Walking operations 5 | ------------------ 6 | 7 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/getbulk-multiple-oids-to-eom.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/getbulk-multiple-oids-to-eom.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/manager/cmdgen/getnext-multiple-oids-to-eom.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/cmdgen/getnext-multiple-oids-to-eom.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/ntfrcv/advanced-topics.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Advanced topics 5 | --------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/manager/ntfrcv/observe-request-processing-over-ipv4-and-ipv6.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/ntfrcv/observe-request-processing-over-ipv4-and-ipv6.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/manager/ntfrcv/regexp-community-name.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/ntfrcv/regexp-community-name.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/ntfrcv/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-network-interfaces.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-network-interfaces.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-usm-users.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-usm-users.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/manager/ntfrcv/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-network-interfaces.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-network-interfaces.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-network-transports-incl-ipv4-and-ipv6.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/ntfrcv/multiple-network-transports-incl-ipv4-and-ipv6.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | .. include:: /../../examples/v3arch/asyncore/manager/ntfrcv/determine-peer-network-address.py 30 | :start-after: """ 31 | :end-before: """# 32 | 33 | .. literalinclude:: /../../examples/v3arch/asyncore/manager/ntfrcv/determine-peer-network-address.py 34 | :start-after: """# 35 | :language: python 36 | 37 | :download:`Download` script. 38 | 39 | 40 | See also: :doc:`library reference `. 41 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/proxy/command/protocol-conversion.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Protocol conversion 5 | ------------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/proxy/command/v2c-to-v1-conversion.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/asyncore/proxy/command/v2c-to-v3-conversion.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/asyncore/proxy/command/v2c-to-v3-conversion.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | .. include:: /../../examples/v3arch/asyncore/proxy/command/v3-to-v2c-conversion.py 30 | :start-after: """ 31 | :end-before: """# 32 | 33 | .. literalinclude:: /../../examples/v3arch/asyncore/proxy/command/v3-to-v2c-conversion.py 34 | :start-after: """# 35 | :language: python 36 | 37 | :download:`Download` script. 38 | 39 | 40 | See also: :doc:`library-reference `. 41 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/asyncore/proxy/command/transport-conversion.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport conversion 5 | -------------------- 6 | 7 | .. include:: /../../examples/v3arch/asyncore/proxy/command/ipv6-to-ipv4-conversion.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/asyncore/proxy/command/ipv6-to-ipv4-conversion.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library-reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/trollius/contents.rst: -------------------------------------------------------------------------------- 1 | 2 | Asynchronous SNMP (trollius, v3arch) 3 | ==================================== 4 | 5 | `Trollius `_ framework offers 6 | infrastructure that allows you writing single-threaded, concurrent code 7 | using Python coroutines. 8 | 9 | Trollius is a backport of `asyncio `_ to Python versions older than 3.3. Trollius supports nearly the same 10 | API as asyncio. Full support of both asyncio and trollius modules is 11 | built into pysnmp. 12 | 13 | All SNMP-related functionality of Native PySNMP API to Standard SNMP 14 | Applications (`RFC3413 `_) 15 | remains available to asyncio-backed applications. 16 | 17 | We do not provide Command Generator and Notification Originator examples, 18 | as it is much easier to use 19 | :doc:`high-level interfaces ` instead. 20 | As for Command Responder and Notification Receiver, those could be use 21 | in the same way as with :doc:`asyncio `. 22 | 23 | For more details on PySNMP programming model and interfaces, please 24 | refer to the documentation 25 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/twisted/agent/cmdrsp/agent-side-mib-implementations.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Agent-side MIB implementations 5 | ------------------------------ 6 | 7 | .. include:: /../../examples/v3arch/twisted/agent/cmdrsp/implementing-scalar-mib-objects.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/twisted/agent/cmdrsp/implementing-scalar-mib-objects.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/twisted/agent/cmdrsp/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | ---------------------- 6 | 7 | .. include:: /../../examples/v3arch/twisted/agent/cmdrsp/multiple-snmp-communities.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/twisted/agent/cmdrsp/multiple-snmp-communities.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | .. include:: /../../examples/v3arch/twisted/agent/cmdrsp/multiple-usm-users.py 19 | :start-after: """ 20 | :end-before: """# 21 | 22 | .. literalinclude:: /../../examples/v3arch/twisted/agent/cmdrsp/multiple-usm-users.py 23 | :start-after: """# 24 | :language: python 25 | 26 | :download:`Download` script. 27 | 28 | 29 | See also: :doc:`library reference `. 30 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/twisted/agent/cmdrsp/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v3arch/twisted/agent/cmdrsp/multiple-interfaces.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/twisted/agent/cmdrsp/multiple-interfaces.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/twisted/contents.rst: -------------------------------------------------------------------------------- 1 | 2 | Asynchronous SNMP (twisted, v3arch) 3 | =================================== 4 | 5 | `Twisted `_ is event-driven networking engine 6 | written in Python. It takes shape of a Python library which is used by many 7 | Python applications mostly for network communication purposes. 8 | 9 | All SNMP-related functionality of Native API to Standard SNMP Applications 10 | remains available to Twisted applications. 11 | 12 | We do not provide Command Generator and Notification Originator examples, 13 | as it is much easier to use 14 | :doc:`high-level interfaces ` instead. 15 | 16 | Command Responder Applications 17 | ------------------------------ 18 | 19 | .. toctree:: 20 | 21 | /examples/v3arch/twisted/agent/cmdrsp/snmp-versions 22 | /examples/v3arch/twisted/agent/cmdrsp/agent-side-mib-implementations 23 | /examples/v3arch/twisted/agent/cmdrsp/transport-tweaks 24 | 25 | Notification Receiver Applications 26 | ---------------------------------- 27 | 28 | .. toctree:: 29 | 30 | /examples/v3arch/twisted/manager/ntfrcv/snmp-versions 31 | /examples/v3arch/twisted/manager/ntfrcv/transport-tweaks 32 | 33 | For more details on PySNMP programming model and interfaces, please 34 | refer to the documentation 35 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/twisted/manager/ntfrcv/snmp-versions.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Various SNMP versions 5 | --------------------- 6 | 7 | .. include:: /../../examples/v3arch/twisted/manager/ntfrcv/multiple-usm-users.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/twisted/manager/ntfrcv/multiple-usm-users.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | 18 | See also: :doc:`library reference `. 19 | -------------------------------------------------------------------------------- /docs/source/examples/v3arch/twisted/manager/ntfrcv/transport-tweaks.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :maxdepth: 2 3 | 4 | Transport tweaks 5 | ---------------- 6 | 7 | .. include:: /../../examples/v3arch/twisted/manager/ntfrcv/multiple-interfaces.py 8 | :start-after: """ 9 | :end-before: """# 10 | 11 | .. literalinclude:: /../../examples/v3arch/twisted/manager/ntfrcv/multiple-interfaces.py 12 | :start-after: """# 13 | :language: python 14 | 15 | :download:`Download` script. 16 | 17 | See also: :doc:`library reference `. 18 | -------------------------------------------------------------------------------- /docs/source/faq.rst: -------------------------------------------------------------------------------- 1 | 2 | FAQ 3 | === 4 | 5 | Here we have an ever-growing list of frequently asked questions regarding 6 | PySNMP usage issues. If you got an issue that you think is worth noting 7 | here, please open a `GitHub issue `_. 8 | 9 | Keep in mind that some the answers below may not be universally applicable 10 | to any PySNMP revision. 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :glob: 15 | 16 | /faq/* 17 | 18 | -------------------------------------------------------------------------------- /docs/source/faq/getting-peer-information.rst: -------------------------------------------------------------------------------- 1 | 2 | Getting peer address information 3 | -------------------------------- 4 | 5 | Q. How do I find out peer transport address or security information within 6 | my receiving app (CommandResponder or Notification Receiver)? 7 | 8 | A. SNMP architecture forces you to distinguish communicating entities only 9 | on the basis of their community names (SNMPv1/v2c) or 10 | ContextEngineId/ContextName pair (SNMPv3). 11 | 12 | In other words, if one SNMP Manager should anyhow differ from another, 13 | then they should use distinct community names or SNMP contexts. 14 | Transport information should never be used for the identification purposes, 15 | as in some cases it proves to be unreliable (cases include NAT device or 16 | a proxy in the middle, not to mention address spoofing). 17 | 18 | As practice reveals, even perfect design does not always cope well with 19 | the imperfect world. So we had to pinch a logic hole from the scope of an 20 | SNMP app down to transport layer. Now with the 21 | getTransportInfo(stateReference) method call you could get peer transport 22 | information upon receiving its SNMP message. 23 | 24 | .. code-block:: python 25 | 26 | # Callback function for receiving notifications 27 | def cbFun(snmpEngine, 28 | stateReference, 29 | contextEngineId, contextName, 30 | varBinds, 31 | cbCtx): 32 | transportDomain, transportAddress = snmpEngine.msgAndPduDsp.getTransportInfo(stateReference) 33 | -------------------------------------------------------------------------------- /docs/source/faq/listening-on-multiple-interfaces.rst: -------------------------------------------------------------------------------- 1 | 2 | Listening on multiple network interfaces 3 | ---------------------------------------- 4 | 5 | Q. I need my receiving entity (CommandResponder or Notification Receiver) 6 | to listen for SNMP messages on multiple network interfaces. How do 7 | I do that with pysnmp? 8 | 9 | A. Simply register multiple network transports with your SNMP engine. 10 | Each transport would be bound to an individual local transport 11 | endpoint (for instance, IP address & UDP port pair). 12 | 13 | .. code-block:: python 14 | 15 | # Security setup would follow 16 | ... 17 | # Setup first transport endpoint 18 | config.addSocketTransport( 19 | snmpEngine, 20 | udp.domainName + (1,), 21 | udp.UdpSocketTransport().openServerMode(('127.0.0.1', 162)) 22 | ) 23 | 24 | # Setup second transport endpoint 25 | config.addSocketTransport( 26 | snmpEngine, 27 | udp.domainName + (2,), 28 | udp.UdpSocketTransport().openServerMode(('192.168.1.1', 162)) 29 | ) 30 | # Receiver callback function implementation and Dispatcher invocation 31 | # would follow 32 | ... 33 | 34 | Notice extended transport domain specification (udp.domainName) in 35 | the code above. There we register each transport endpoint under distinct 36 | OID, however always within the canonical transport domain OID. 37 | -------------------------------------------------------------------------------- /docs/source/faq/non-printable-snmp-values-apps.rst: -------------------------------------------------------------------------------- 1 | 2 | Garbaged SNMP values (apps) 3 | --------------------------- 4 | 5 | Q. When my PySNMP application prints out fetched values, some of them 6 | come out as a garbage on my screan. Here's my code: 7 | 8 | .. code-block:: python 9 | 10 | for varBind in varBinds: 11 | print(' = '.join([ str(x) for x in varBind ]) 12 | 13 | and the result is: 14 | 15 | .. code-block:: python 16 | 17 | 1.3.6.1.4.1.161.19.3.2.1.63.0 = 50000 18 | 1.3.6.1.4.1.161.19.3.2.1.4.0 = '\x01\x02\x03\x04' 19 | 20 | The IpAddress type seems to be the only one with this problem. 21 | 22 | A. Always use prettyPrint() method for all pyasn1-based objects -- it 23 | automatically converts ASN1 types to human-friendly form. 24 | 25 | .. code-block:: python 26 | 27 | > > > from pysnmp.proto import rfc1902 28 | > > > a = rfc1902.IpAddress('1.2.3.4') 29 | > > > str(a) 30 | '\x01\x02\x03\x04' 31 | > > > a 32 | IpAddress('1.2.3.4') 33 | > > > a.prettyPrint() 34 | '1.2.3.4' 35 | > > > rfc1902.IpAddress.prettyPrint(a) 36 | '1.2.3.4' 37 | 38 | See `pyasn1 docs `_ for more information 39 | on pyasn1 data model. 40 | 41 | -------------------------------------------------------------------------------- /docs/source/faq/py2exe-throws-error.rst: -------------------------------------------------------------------------------- 1 | 2 | My py2exe app can't find MIBs 3 | ----------------------------- 4 | 5 | Q. I packed my pysnmp-based application with py2exe. When I run my app, 6 | it throws a traceback like this: 7 | 8 | .. code-block:: bash 9 | 10 | File "pysnmp\entity\rfc3413\oneliner\cmdgen.pyc", line 116, in __init__ 11 | File "pysnmp\entity\engine.pyc", line 16, in __init__ 12 | File "pysnmp\proto\rfc3412.pyc", line 16, in __init__ 13 | File "pysnmp\smi\builder.pyc", line 143, in __init__ 14 | File "pysnmp\smi\builder.pyc", line 35, in init 15 | File "pysnmp\smi\builder.pyc", line 80, in _init 16 | ImportError: No module named mibs.instances 17 | 18 | PySNMP claims itself to be py2exe-friendly. How to make it working? 19 | 20 | A. You have to list pysnmp MIB directories explicitly at your app's 21 | setup.py so that py2exe would include them into the binary. 22 | 23 | .. code-block:: python 24 | 25 | from distutils.core import setup 26 | import sys 27 | 28 | options = {} 29 | 30 | if "py2exe" in sys.argv: 31 | import py2exe 32 | # fix executables 33 | options['console'] = ['myapp.py'] 34 | # add files not found my modulefinder 35 | options['options'] = { 36 | 'py2exe': { 37 | 'includes': [ 38 | 'pysnmp.smi.mibs.*', 39 | 'pysnmp.smi.mibs.instances.*' 40 | ] 41 | } 42 | } 43 | 44 | setup(**options) 45 | 46 | -------------------------------------------------------------------------------- /docs/source/faq/walk-whole-mib.rst: -------------------------------------------------------------------------------- 1 | 2 | Walking whole MIB 3 | ----------------- 4 | 5 | Q. The nextCmd() and bulkCmd() methods of CommandGenerator app 6 | (oneliner version) stop working once returned OIDs went out of scope of 7 | request OIDs. 8 | 9 | In other words, if I request 1.3.6.1, I would get everything under 10 | the 1.3.6.1 prefix, but not 1.3.6.2. Is there any way to make it walking 11 | the whole MIB? 12 | 13 | A. Yes, just pass the lexicographicMode=True parameter to CommandGenerator 14 | nextCmd() and bulkCmd() methods (introduced in PySNMP 4.2.3+) or set 15 | CommandGenerator.lexicographicMode=True option before calling nextCmd() 16 | and bulkCmd() methods. 17 | 18 | .. code-block:: python 19 | 20 | cmdGen = cmdgen.CommandGenerator() 21 | errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd( 22 | ...., 23 | ...., 24 | ...., 25 | lexicographicMode=True 26 | ) 27 | -------------------------------------------------------------------------------- /docs/source/license.rst: -------------------------------------------------------------------------------- 1 | 2 | License 3 | ======= 4 | 5 | .. include:: ../../LICENSE.rst 6 | -------------------------------------------------------------------------------- /docs/source/oldsite.rst: -------------------------------------------------------------------------------- 1 | 2 | Old site archive 3 | ================ 4 | 5 | Starting from PySNMP 4.3.0, we redesigned all documentation and web-site. 6 | For previous versions of those please follow these links for 7 | `old examples `_ 8 | and 9 | `old documentation `_ 10 | . 11 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncio/manager/cmdgen/v1-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv1 3 | ++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv1, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for the 1.3.6.1.2.1.1.1.0 OID (e.g. SNMPv2-MIB::sysDescr.0 MIB object) 11 | * Based on asyncio I/O framework 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 16 | 17 | """# 18 | import asyncio 19 | 20 | from pysnmp.hlapi.v1arch.asyncio import * 21 | 22 | 23 | @asyncio.coroutine 24 | def run(): 25 | snmpDispatcher = SnmpDispatcher() 26 | 27 | iterator = getCmd( 28 | snmpDispatcher, 29 | CommunityData('public', mpModel=0), 30 | UdpTransportTarget(('demo.snmplabs.com', 161)), 31 | ('1.3.6.1.2.1.1.1.0', None) 32 | ) 33 | 34 | errorIndication, errorStatus, errorIndex, varBinds = yield from iterator 35 | 36 | if errorIndication: 37 | print(errorIndication) 38 | 39 | elif errorStatus: 40 | print('%s at %s' % ( 41 | errorStatus.prettyPrint(), 42 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?' 43 | ) 44 | ) 45 | else: 46 | for varBind in varBinds: 47 | print(' = '.join([x.prettyPrint() for x in varBind])) 48 | 49 | snmpDispatcher.transportDispatcher.closeDispatcher() 50 | 51 | 52 | asyncio.get_event_loop().run_until_complete(run()) 53 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v2c-trap.py: -------------------------------------------------------------------------------- 1 | """ 2 | Generic SNMPv2c TRAP 3 | ++++++++++++++++++++ 4 | 5 | Send SNMPv1 TRAP using the following options: 6 | 7 | * SNMPv2c 8 | * with community name 'public' 9 | * over IPv4/UDP 10 | * send TRAP notification 11 | * with Uptime 12345 12 | * with Generic Trap #1 (warmStart) and Specific Trap 0 13 | * include managed object information '1.3.6.1.2.1.1.1.0' = 'my system' 14 | 15 | Functionally similar to: 16 | 17 | | $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.1.0 s "my system" 18 | 19 | """# 20 | from pysnmp.hlapi.v1arch.asyncore import * 21 | 22 | 23 | def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context): 24 | if errorIndication: 25 | print(errorIndication) 26 | 27 | 28 | snmpDispatcher = SnmpDispatcher() 29 | 30 | sendNotification( 31 | snmpDispatcher, 32 | CommunityData('public'), 33 | UdpTransportTarget(('demo.snmplabs.com', 162)), 34 | 'trap', 35 | # SNMPv2-MIB::sysUpTime.0 = 12345 36 | ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)), 37 | # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart 38 | ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')), 39 | # SNMPv2-MIB::sysName.0 40 | ('1.3.6.1.2.1.1.1.0', OctetString('my system')), 41 | cbFun=cbFun 42 | ) 43 | 44 | snmpDispatcher.transportDispatcher.runDispatcher() 45 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py: -------------------------------------------------------------------------------- 1 | """ 2 | Walk whole MIB 3 | ++++++++++++++ 4 | 5 | Send a series of SNMP GETBULK requests using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for all OIDs past 1.3.6.1.4.1 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpwalk -v2c -c public demo.snmplabs.com 1.3.6.1.4.1 15 | """# 16 | from pysnmp.hlapi.v1arch.asyncore import * 17 | 18 | 19 | def cbFun(errorIndication, errorStatus, errorIndex, varBindTable, **context): 20 | if errorIndication: 21 | print(errorIndication) 22 | 23 | elif errorStatus: 24 | print('%s at %s' % (errorStatus.prettyPrint(), 25 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 26 | 27 | else: 28 | for varBindRow in varBindTable: 29 | for varBind in varBindRow: 30 | print(' = '.join([x.prettyPrint() for x in varBind])) 31 | 32 | return context.get('nextVarBinds') 33 | 34 | 35 | snmpDispatcher = SnmpDispatcher() 36 | 37 | # Submit initial GETBULK request 38 | bulkCmd(snmpDispatcher, 39 | CommunityData('public'), 40 | UdpTransportTarget(('demo.snmplabs.com', 161)), 41 | 0, 25, 42 | ('1.3.6.1.4.1', None), 43 | cbFun=cbFun) 44 | 45 | snmpDispatcher.transportDispatcher.runDispatcher() 46 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/manager/cmdgen/v1-getnext.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMP GETNEXT over SNMPv1 3 | ++++++++++++++++++++++++ 4 | 5 | Send a series of SNMP GETNEXT requests using the following options: 6 | 7 | * with SNMPv1, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for the 1.3.6.1.2.1.1 OID (e.g. SNMPv2-MIB::system MIB branch) 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpwalk -v1 -c public demo.snmplabs.com 1.3.6.1.2.1.1 15 | 16 | """# 17 | 18 | from pysnmp.hlapi.v1arch.asyncore import * 19 | 20 | 21 | def cbFun(errorIndication, errorStatus, errorIndex, varBindTable, **context): 22 | if errorIndication: 23 | print(errorIndication) 24 | return 25 | 26 | elif errorStatus: 27 | print('%s at %s' % (errorStatus.prettyPrint(), 28 | errorIndex and varBindTable[-1][int(errorIndex) - 1][0] or '?')) 29 | return 30 | 31 | else: 32 | for varBindRow in varBindTable: 33 | for varBind in varBindRow: 34 | print(' = '.join([x.prettyPrint() for x in varBind])) 35 | 36 | return context.get('nextVarBinds') 37 | 38 | 39 | snmpDispatcher = SnmpDispatcher() 40 | 41 | stateHandle = nextCmd( 42 | snmpDispatcher, 43 | CommunityData('public', mpModel=0), 44 | UdpTransportTarget(('demo.snmplabs.com', 161)), 45 | ('1.3.6.1.5.1.1', None), 46 | cbFun=cbFun 47 | ) 48 | 49 | snmpDispatcher.transportDispatcher.runDispatcher() 50 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMP GET over SNMPv2c 3 | +++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for the 1.3.6.1.2.1.1.1.0 OID (e.g. SNMPv2-MIB::sysDescr.0 MIB object) 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v2c -c public demo.snmplabs.com 1.3.6.1.2.1.1.1.0 15 | 16 | """# 17 | 18 | from pysnmp.hlapi.v1arch.asyncore import * 19 | 20 | 21 | def cbFun(errorIndication, errorStatus, errorIndex, varBinds, **context): 22 | if errorIndication: 23 | print(errorIndication) 24 | return 25 | elif errorStatus: 26 | print('%s at %s' % (errorStatus.prettyPrint(), 27 | errorIndex and varBindTable[-1][int(errorIndex) - 1][0] or '?')) 28 | return 29 | else: 30 | for varBind in varBinds: 31 | print(' = '.join([x.prettyPrint() for x in varBind])) 32 | 33 | 34 | snmpDispatcher = SnmpDispatcher() 35 | 36 | stateHandle = getCmd( 37 | snmpDispatcher, 38 | CommunityData('public'), 39 | UdpTransportTarget(('demo.snmplabs.com', 161)), 40 | ('1.3.6.1.2.1.1.1.0', None), 41 | cbFun=cbFun 42 | ) 43 | 44 | snmpDispatcher.transportDispatcher.runDispatcher() 45 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py: -------------------------------------------------------------------------------- 1 | """ 2 | Generic SNMPv2c TRAP 3 | ++++++++++++++++++++ 4 | 5 | Send SNMPv1 TRAP using the following options: 6 | 7 | * SNMPv2c 8 | * with community name 'public' 9 | * over IPv4/UDP 10 | * send TRAP notification 11 | * with Uptime 12345 12 | * with Generic Trap #1 (warmStart) and Specific Trap 0 13 | * include managed object information '1.3.6.1.2.1.1.1.0' = 'my system' 14 | 15 | Functionally similar to: 16 | 17 | | $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.1.0 s "my system" 18 | 19 | """# 20 | from pysnmp.hlapi.v1arch import * 21 | 22 | iterator = sendNotification( 23 | SnmpDispatcher(), 24 | CommunityData('public'), 25 | UdpTransportTarget(('demo.snmplabs.com', 162)), 26 | 'trap', 27 | # SNMPv2-MIB::sysUpTime.0 = 12345 28 | ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)), 29 | # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart 30 | ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')), 31 | # SNMPv2-MIB::sysName.0 32 | ('1.3.6.1.2.1.1.1.0', OctetString('my system')) 33 | ) 34 | 35 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 36 | 37 | if errorIndication: 38 | print(errorIndication) 39 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv2c INFORM 3 | ++++++++++++++ 4 | 5 | Send SNMP INFORM notification using the following options: 6 | 7 | * SNMPv2c 8 | * with community name 'public' 9 | * over IPv4/UDP 10 | * send INFORM notification 11 | * with TRAP ID 'warmStart' specified as a string OID 12 | * include managed object information 1.3.6.1.2.1.1.5.0 = 'system name' 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpinform -v2c -c public demo.snmplabs.com 12345 1.3.6.1.4.1.20408.4.1.1.2 1.3.6.1.2.1.1.1.0 s "my system" 17 | 18 | """# 19 | from pysnmp.hlapi.v1arch import * 20 | 21 | iterator = sendNotification( 22 | SnmpDispatcher(), 23 | CommunityData('public'), 24 | UdpTransportTarget(('demo.snmplabs.com', 162)), 25 | 'inform', 26 | # SNMPv2-MIB::sysUpTime.0 = 12345 27 | ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)), 28 | # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart 29 | ('1.3.6.1.6.3.1.1.4.1.0', ObjectIdentifier('1.3.6.1.6.3.1.1.5.2')), 30 | # SNMPv2-MIB::sysName.0 31 | ('1.3.6.1.2.1.1.1.0', OctetString('my system')) 32 | ) 33 | 34 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 35 | 36 | if errorIndication: 37 | print(errorIndication) 38 | 39 | elif errorStatus: 40 | print('%s at %s' % (errorStatus.prettyPrint(), 41 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 42 | 43 | else: 44 | for varBind in varBinds: 45 | print(' = '.join([x.prettyPrint() for x in varBind])) 46 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py: -------------------------------------------------------------------------------- 1 | """ 2 | Generic SNMPv2c TRAP 3 | ++++++++++++++++++++ 4 | 5 | Send SNMPv1 TRAP using the following options: 6 | 7 | * SNMPv2c 8 | * with community name 'public' 9 | * over IPv4/UDP 10 | * send TRAP notification 11 | * with Uptime 12345 12 | * with Generic Trap #1 (warmStart) and Specific Trap 0 13 | * include managed object information '1.3.6.1.2.1.1.1.0' = 'my system' 14 | 15 | Functionally similar to: 16 | 17 | | $ snmptrap -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.2 1.3.6.1.2.1.1.1.0 s "my system" 18 | 19 | """# 20 | from pysnmp.hlapi.v1arch import * 21 | 22 | iterator = sendNotification( 23 | SnmpDispatcher(), 24 | CommunityData('public'), 25 | UdpTransportTarget(('demo.snmplabs.com', 162)), 26 | 'trap', 27 | # SNMPv2-MIB::sysUpTime.0 = 12345 28 | ('1.3.6.1.2.1.1.3.0', TimeTicks(12345)), 29 | # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::warmStart 30 | NotificationType(ObjectIdentity('SNMPv2-MIB', 'warmStart')), 31 | # SNMPv2-MIB::sysName.0 32 | ('1.3.6.1.2.1.1.1.0', OctetString('my system')), 33 | lookupMib=True 34 | ) 35 | 36 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 37 | 38 | if errorIndication: 39 | print(errorIndication) 40 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py: -------------------------------------------------------------------------------- 1 | """ 2 | Coerce value to SET to MIB spec 3 | +++++++++++++++++++++++++++++++ 4 | 5 | Send SNMP SET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * with MIB lookup enabled 11 | * setting SNMPv2-MIB::sysName.0 to new value (type taken from MIB) 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpset -v2c -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 = "new system name" 16 | 17 | """# 18 | from pysnmp.hlapi.v1arch import * 19 | 20 | iterator = setCmd( 21 | SnmpDispatcher(), 22 | CommunityData('public'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysORDescr', 1), 'new description'), 25 | lookupMib=True 26 | ) 27 | 28 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 29 | 30 | if errorIndication: 31 | print(errorIndication) 32 | 33 | elif errorStatus: 34 | print('%s at %s' % (errorStatus.prettyPrint(), 35 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 36 | 37 | else: 38 | for varBind in varBinds: 39 | print(' = '.join([x.prettyPrint() for x in varBind])) 40 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py: -------------------------------------------------------------------------------- 1 | """ 2 | Custom ASN.1 MIB path 3 | +++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for IF-MIB::ifInOctets.1 MIB object 11 | * pass non-default ASN.1 MIB source to MIB compiler 12 | * with MIB lookup enabled 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpget -v2c -c public -M /usr/share/snmp demo.snmplabs.com IF-MIB::ifInOctets.1 17 | 18 | """# 19 | from pysnmp.hlapi.v1arch import * 20 | 21 | iterator = getCmd( 22 | SnmpDispatcher(), 23 | CommunityData('public'), 24 | UdpTransportTarget(('demo.snmplabs.com', 161)), 25 | ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1).addAsn1MibSource( 26 | 'file:///usr/share/snmp', 27 | 'http://mibs.snmplabs.com/asn1/@mib@') 28 | ), 29 | lookupMib=True 30 | ) 31 | 32 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 33 | 34 | if errorIndication: 35 | print(errorIndication) 36 | 37 | elif errorStatus: 38 | print('%s at %s' % (errorStatus.prettyPrint(), 39 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 40 | 41 | else: 42 | for varBind in varBinds: 43 | print(' = '.join([x.prettyPrint() for x in varBind])) 44 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Enable MIB lookup 3 | +++++++++++++++++ 4 | 5 | Perform SNMP GETNEXT operation with the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for an OID in string form 11 | * resolve request and response OIDs and values from/to human-friendly form 12 | 13 | The `lookupMib=True` keyword argument makes pysnmp resolving 14 | request and response variable-bindings from/to human-friendly form. 15 | 16 | Functionally similar to: 17 | 18 | | $ snmpwalk -v2c -c public -ObentU demo.snmplabs.com 1.3.6.1.2.1 19 | 20 | """# 21 | from pysnmp.hlapi.v1arch import * 22 | 23 | iterator = nextCmd( 24 | SnmpDispatcher(), 25 | CommunityData('public'), 26 | UdpTransportTarget(('demo.snmplabs.com', 161)), 27 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1')), 28 | lookupMib=True 29 | ) 30 | 31 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 32 | 33 | if errorIndication: 34 | print(errorIndication) 35 | break 36 | 37 | elif errorStatus: 38 | print('%s at %s' % (errorStatus.prettyPrint(), 39 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 40 | break 41 | 42 | else: 43 | for varBind in varBinds: 44 | print(' = '.join([x.prettyPrint() for x in varBind])) 45 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py: -------------------------------------------------------------------------------- 1 | """ 2 | GET over IPv6 3 | +++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv6/UDP 9 | * to an Agent at [::1]:161 10 | * for three OIDs in string form 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v2c -c public udp6:[::1]:161 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0 1.3.6.1.2.1.1.3.0 15 | """# 16 | from pysnmp.hlapi.v1arch import * 17 | 18 | iterator = getCmd( 19 | SnmpDispatcher(), 20 | CommunityData('public'), 21 | Udp6TransportTarget(('::1', 161)), 22 | ('1.3.6.1.2.1.1.1.0', None), 23 | ('1.3.6.1.2.1.1.2.0', None), 24 | ('1.3.6.1.2.1.1.3.0', None) 25 | ) 26 | 27 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 28 | 29 | if errorIndication: 30 | print(errorIndication) 31 | 32 | elif errorStatus: 33 | print('%s at %s' % (errorStatus.prettyPrint(), 34 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 35 | 36 | else: 37 | for varBind in varBinds: 38 | print(' = '.join([x.prettyPrint() for x in varBind])) 39 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py: -------------------------------------------------------------------------------- 1 | """ 2 | GET table row 3 | +++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community name "public" 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * with MIB lookup enabled 11 | * for IF-MIB::ifInOctets.1 and IF-MIB::ifOutOctets.1 MIB object 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v 2c -c public demo.snmplabs.com IF-MIB::ifInOctets.1 IF-MIB::ifOutOctets.1 16 | 17 | """# 18 | from pysnmp.hlapi.v1arch import * 19 | 20 | iterator = getCmd( 21 | SnmpDispatcher(), 22 | CommunityData('public'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1)), 25 | ObjectType(ObjectIdentity('IF-MIB', 'ifOutOctets', 1)), 26 | lookupMib=True 27 | ) 28 | 29 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 30 | 31 | if errorIndication: 32 | print(errorIndication) 33 | 34 | elif errorStatus: 35 | print('%s at %s' % (errorStatus.prettyPrint(), 36 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 37 | 38 | else: 39 | for varBind in varBinds: 40 | print(' = '.join([x.prettyPrint() for x in varBind])) 41 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py: -------------------------------------------------------------------------------- 1 | """ 2 | Fetch table row by composite index 3 | ++++++++++++++++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for TCP-MIB::tcpConnLocalAddress."0.0.0.0".22."0.0.0.0".0 MIB object 11 | * with MIB lookup enabled 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v2c -c public demo.snmplabs.com TCP-MIB::tcpConnLocalAddress."0.0.0.0".22."0.0.0.0".0 16 | 17 | """# 18 | from pysnmp.hlapi.v1arch import * 19 | 20 | iterator = getCmd( 21 | SnmpDispatcher(), 22 | CommunityData('public'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ObjectType( 25 | ObjectIdentity( 26 | 'TCP-MIB', 27 | 'tcpConnLocalAddress', 28 | '0.0.0.0', 22, 29 | '0.0.0.0', 0 30 | ) 31 | ).addAsn1MibSource('http://mibs.snmplabs.com/asn1/@mib@'), 32 | lookupMib=True 33 | ) 34 | 35 | 36 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 37 | 38 | if errorIndication: 39 | print(errorIndication) 40 | 41 | elif errorStatus: 42 | print('%s at %s' % (errorStatus.prettyPrint(), 43 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 44 | 45 | else: 46 | for varBind in varBinds: 47 | print(' = '.join([x.prettyPrint() for x in varBind])) 48 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py: -------------------------------------------------------------------------------- 1 | """ 2 | Walk Agent, limit number of packets 3 | +++++++++++++++++++++++++++++++++++ 4 | 5 | Send a series of SNMP GETBULK requests using the following options: 6 | 7 | * with SNMPv2c, community name "public" 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for all OIDs past SNMPv2-MIB::system 11 | * with MIB lookup enabled 12 | * run till end-of-mib condition is reported by Agent OR 13 | maxCalls == 10 request-response interactions occur 14 | 15 | Functionally similar to: 16 | 17 | | $ snmpbulkwalk -v2c -c public -Cn0 -Cr50 demo.snmplabs.com SNMPv2-MIB::system 18 | 19 | """# 20 | from pysnmp.hlapi.v1arch import * 21 | 22 | iterator = bulkCmd( 23 | SnmpDispatcher(), 24 | CommunityData('public'), 25 | UdpTransportTarget(('demo.snmplabs.com', 161)), 26 | 0, 50, 27 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'system')), 28 | lookupMib=True, 29 | maxCalls=10 30 | ) 31 | 32 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 33 | 34 | if errorIndication: 35 | print(errorIndication) 36 | break 37 | 38 | elif errorStatus: 39 | print('%s at %s' % (errorStatus.prettyPrint(), 40 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 41 | break 42 | 43 | else: 44 | for varBind in varBinds: 45 | print(' = '.join([x.prettyPrint() for x in varBind])) 46 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sequence Of GET's 3 | +++++++++++++++++ 4 | 5 | Send two SNMP GET requests in a row using the following options: 6 | 7 | * with SNMPv2c, community name "public" 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for IF-MIB::ifInOctets.1 and IF-MIB::ifOutOctets.1 MIB objects 11 | * with MIB lookup enabled 12 | 13 | Use a queue of MIB objects to query. 14 | 15 | The next() call is used to forward Python iterator to the position where it 16 | could consume input 17 | 18 | Functionally similar to: 19 | 20 | | $ snmpget -v2c -c public demo.snmplabs.com IF-MIB::ifInOctets.1 21 | 22 | """# 23 | from pysnmp.hlapi.v1arch import * 24 | 25 | queue = [ 26 | [ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1))], 27 | [ObjectType(ObjectIdentity('IF-MIB', 'ifOutOctets', 1))] 28 | ] 29 | 30 | iterator = getCmd( 31 | SnmpDispatcher(), 32 | CommunityData('public'), 33 | UdpTransportTarget(('demo.snmplabs.com', 161)), 34 | lookupMib=True 35 | ) 36 | 37 | next(iterator) 38 | 39 | while queue: 40 | errorIndication, errorStatus, errorIndex, varBinds = iterator.send(queue.pop()) 41 | 42 | if errorIndication: 43 | print(errorIndication) 44 | 45 | elif errorStatus: 46 | print('%s at %s' % (errorStatus.prettyPrint(), 47 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 48 | 49 | else: 50 | for varBind in varBinds: 51 | print(' = '.join([x.prettyPrint() for x in varBind])) 52 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Preload PySNMP MIBs 3 | +++++++++++++++++++ 4 | 5 | Send a series of SNMP GETNEXT requests using the following options: 6 | 7 | * with SNMPv2c, community name "public" 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for all OIDs starting from 1.3.6 11 | * with MIB lookup enabled 12 | * preload all Python MIB modules found in search path 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpwalk -v2c -c public -m ALL demo.snmplabs.com:161 1.3.6 17 | 18 | """# 19 | from pysnmp.hlapi.v1arch import * 20 | 21 | iterator = nextCmd( 22 | SnmpDispatcher(), 23 | CommunityData('public'), 24 | UdpTransportTarget(('demo.snmplabs.com', 161)), 25 | ObjectType(ObjectIdentity('1.3.6').loadMibs()), 26 | lookupMib=True 27 | ) 28 | 29 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 30 | 31 | if errorIndication: 32 | print(errorIndication) 33 | break 34 | 35 | elif errorStatus: 36 | print('%s at %s' % (errorStatus.prettyPrint(), 37 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 38 | break 39 | 40 | else: 41 | for varBind in varBinds: 42 | print(' = '.join([x.prettyPrint() for x in varBind])) 43 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py: -------------------------------------------------------------------------------- 1 | """ 2 | Walk whole MIB 3 | ++++++++++++++ 4 | 5 | Send a series of SNMP GETNEXT requests using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for all OIDs in IF-MIB 11 | * with MIB lookup enabled 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpwalk -v2c -c public demo.snmplabs.com IF-MIB:: 16 | 17 | """# 18 | from pysnmp.hlapi.v1arch import * 19 | 20 | iterator = nextCmd( 21 | SnmpDispatcher(), 22 | CommunityData('public'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ObjectType(ObjectIdentity('IF-MIB')) 25 | ) 26 | 27 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 28 | 29 | if errorIndication: 30 | print(errorIndication) 31 | break 32 | 33 | elif errorStatus: 34 | print('%s at %s' % (errorStatus.prettyPrint(), 35 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 36 | break 37 | 38 | else: 39 | for varBind in varBinds: 40 | print(' = '.join([x.prettyPrint() for x in varBind])) 41 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv1 3 | ++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv1, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for an instance of SNMPv2-MIB::sysDescr.0 MIB object 11 | * having MIB lookup feature enabled 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 16 | 17 | """# 18 | from pysnmp.hlapi.v1arch import * 19 | 20 | iterator = getCmd( 21 | SnmpDispatcher(), 22 | CommunityData('public', mpModel=0), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)), 25 | lookupMib=True 26 | ) 27 | 28 | for response in iterator: 29 | 30 | errorIndication, errorStatus, errorIndex, varBinds = response 31 | 32 | if errorIndication: 33 | print(errorIndication) 34 | 35 | elif errorStatus: 36 | print('%s at %s' % (errorStatus.prettyPrint(), 37 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 38 | else: 39 | for varBind in varBinds: 40 | print(' = '.join([x.prettyPrint() for x in varBind])) 41 | -------------------------------------------------------------------------------- /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv2c 3 | +++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for two var-bindings with OIDs in string form 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v2c -c public demo.snmplabs.com 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.6.0 15 | 16 | """# 17 | from pysnmp.hlapi.v1arch import * 18 | 19 | iterator = getCmd( 20 | SnmpDispatcher(), 21 | CommunityData('public'), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ('1.3.6.1.2.1.1.1.0', None), 24 | ('1.3.6.1.2.1.1.6.0', None) 25 | ) 26 | 27 | for response in iterator: 28 | 29 | errorIndication, errorStatus, errorIndex, varBinds = response 30 | 31 | if errorIndication: 32 | print(errorIndication) 33 | 34 | elif errorStatus: 35 | print('%s at %s' % (errorStatus.prettyPrint(), 36 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 37 | else: 38 | for varBind in varBinds: 39 | print(' = '.join([x.prettyPrint() for x in varBind])) 40 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncio/manager/cmdgen/v1-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv1 3 | ++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv1, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for an instance of SNMPv2-MIB::sysDescr.0 MIB object 11 | * Based on asyncio I/O framework 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 16 | 17 | """# 18 | import asyncio 19 | from pysnmp.hlapi.v3arch.asyncio import * 20 | 21 | 22 | @asyncio.coroutine 23 | def run(): 24 | snmpEngine = SnmpEngine() 25 | 26 | iterator = getCmd( 27 | snmpEngine, 28 | CommunityData('public', mpModel=0), 29 | UdpTransportTarget(('demo.snmplabs.com', 161)), 30 | ContextData(), 31 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)) 32 | ) 33 | 34 | errorIndication, errorStatus, errorIndex, varBinds = yield from iterator 35 | 36 | if errorIndication: 37 | print(errorIndication) 38 | 39 | elif errorStatus: 40 | print('%s at %s' % ( 41 | errorStatus.prettyPrint(), 42 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?' 43 | ) 44 | ) 45 | else: 46 | for varBind in varBinds: 47 | print(' = '.join([x.prettyPrint() for x in varBind])) 48 | 49 | snmpEngine.transportDispatcher.closeDispatcher() 50 | 51 | 52 | asyncio.get_event_loop().run_until_complete(run()) 53 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/agent/ntforg/default-v1-trap.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv1 TRAP with defaults 3 | +++++++++++++++++++++++++ 4 | 5 | Send SNMPv1 TRAP through unified SNMPv3 message processing framework 6 | using the following options: 7 | 8 | * SNMPv1 9 | * with community name 'public' 10 | * over IPv4/UDP 11 | * send TRAP notification 12 | * with Generic Trap #1 (warmStart) and Specific Trap 0 13 | * with default Uptime 14 | * with default Agent Address 15 | * with Enterprise OID 1.3.6.1.4.1.20408.4.1.1.2 16 | * include managed object information '1.3.6.1.2.1.1.1.0' = 'my system' 17 | 18 | Functionally similar to: 19 | 20 | | $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 0.0.0.0 1 0 0 1.3.6.1.2.1.1.1.0 s "my system" 21 | 22 | """# 23 | from pysnmp.hlapi.v3arch.asyncore import * 24 | 25 | snmpEngine = SnmpEngine() 26 | 27 | sendNotification( 28 | snmpEngine, 29 | CommunityData('public', mpModel=0), 30 | UdpTransportTarget(('demo.snmplabs.com', 162)), 31 | ContextData(), 32 | 'trap', 33 | NotificationType( 34 | ObjectIdentity('1.3.6.1.6.3.1.1.5.2') 35 | ).addVarBinds( 36 | ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'), 37 | ('1.3.6.1.2.1.1.1.0', OctetString('my system')) 38 | ).loadMibs( 39 | 'SNMPv2-MIB' 40 | ) 41 | ) 42 | 43 | snmpEngine.transportDispatcher.runDispatcher() 44 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/manager/cmdgen/v2c-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv2c 3 | +++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv1, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for two instances of SNMPv2-MIB::sysDescr.0 MIB object, 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v2c -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 15 | 16 | """# 17 | from pysnmp.hlapi.v3arch.asyncore import * 18 | 19 | 20 | # noinspection PyUnusedLocal,PyUnusedLocal,PyUnusedLocal 21 | def cbFun(snmpEngine, sendRequestHandle, errorIndication, 22 | errorStatus, errorIndex, varBinds, cbCtx): 23 | 24 | if errorIndication: 25 | print(errorIndication) 26 | return 27 | 28 | elif errorStatus: 29 | print('%s at %s' % (errorStatus.prettyPrint(), 30 | errorIndex and varBindTable[-1][int(errorIndex) - 1][0] or '?')) 31 | return 32 | 33 | else: 34 | for varBind in varBinds: 35 | print(' = '.join([x.prettyPrint() for x in varBind])) 36 | 37 | 38 | snmpEngine = SnmpEngine() 39 | 40 | getCmd(snmpEngine, 41 | CommunityData('public'), 42 | UdpTransportTarget(('demo.snmplabs.com', 161)), 43 | ContextData(), 44 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)), 45 | cbFun=cbFun) 46 | 47 | snmpEngine.transportDispatcher.runDispatcher() 48 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-contextname.py: -------------------------------------------------------------------------------- 1 | """ 2 | INFORM with custom ContextName 3 | ++++++++++++++++++++++++++++++ 4 | 5 | Send SNMP notification using the following options: 6 | 7 | * SNMPv3 8 | * with user 'usr-md5-none', MD5 auth, no priv 9 | * send INFORM notification 10 | * in behalf of contextEngineId = SnmpEngineId, contextName 'my-context' 11 | * over IPv4/UDP 12 | * with TRAP ID 'warmStart' specified as a string OID 13 | 14 | Sending SNMPv3 Notification in behalf of non-default ContextName 15 | requires having a collection of Managed Objects registered under 16 | the ContextName being used. 17 | 18 | Functionally similar to: 19 | 20 | | $ snmpinform -v3 -l authNoPriv -u usr-md5-none -A authkey1 -n my-context demo.snmplabs.com 12345 0.3.6.1.6.3.1.1.5.2 21 | 22 | """# 23 | from pysnmp.hlapi import * 24 | 25 | iterator = sendNotification( 26 | SnmpEngine(), 27 | UsmUserData('usr-md5-none', 'authkey1'), 28 | UdpTransportTarget(('demo.snmplabs.com', 162)), 29 | ContextData(contextName='my-context'), 30 | 'inform', 31 | NotificationType(ObjectIdentity('1.3.6.1.6.3.1.1.5.2')).loadMibs('SNMPv2-MIB') 32 | ) 33 | 34 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 35 | 36 | if errorIndication: 37 | print(errorIndication) 38 | 39 | elif errorStatus: 40 | print('%s at %s' % (errorStatus.prettyPrint(), 41 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 42 | 43 | else: 44 | for varBind in varBinds: 45 | print(' = '.join([x.prettyPrint() for x in varBind])) 46 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/agent/ntforg/default-v1-trap.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv1 TRAP with defaults 3 | +++++++++++++++++++++++++ 4 | 5 | Send SNMPv1 TRAP through unified SNMPv3 message processing framework 6 | using the following options: 7 | 8 | * SNMPv1 9 | * with community name 'public' 10 | * over IPv4/UDP 11 | * send TRAP notification 12 | * with Generic Trap #1 (warmStart) and Specific Trap 0 13 | * with default Uptime 14 | * with default Agent Address 15 | * with Enterprise OID 1.3.6.1.4.1.20408.4.1.1.2 16 | * include managed object information '1.3.6.1.2.1.1.1.0' = 'my system' 17 | 18 | Functionally similar to: 19 | 20 | | $ snmptrap -v1 -c public demo.snmplabs.com 1.3.6.1.4.1.20408.4.1.1.2 0.0.0.0 1 0 0 1.3.6.1.2.1.1.1.0 s "my system" 21 | 22 | """# 23 | from pysnmp.hlapi import * 24 | 25 | iterator = sendNotification( 26 | SnmpEngine(), 27 | CommunityData('public', mpModel=0), 28 | UdpTransportTarget(('demo.snmplabs.com', 162)), 29 | ContextData(), 30 | 'trap', 31 | NotificationType( 32 | ObjectIdentity('1.3.6.1.6.3.1.1.5.2') 33 | ).addVarBinds( 34 | ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'), 35 | ('1.3.6.1.2.1.1.1.0', OctetString('my system')) 36 | ).loadMibs( 37 | 'SNMPv2-MIB' 38 | ) 39 | ) 40 | 41 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 42 | 43 | if errorIndication: 44 | print(errorIndication) 45 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/agent/ntforg/send-notification-with-additional-varbinds.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sending additional var-binds 3 | ++++++++++++++++++++++++++++ 4 | 5 | Send SNMP notification using the following options: 6 | 7 | * SNMPv2c 8 | * with community name 'public' 9 | * over IPv4/UDP 10 | * send INFORM notification 11 | * with TRAP ID 'coldStart' specified as a MIB symbol 12 | * include managed object information specified as a MIB symbol 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpinform -v2c -c public demo.snmplabs.com 12345 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.1.0 s "my system" 17 | 18 | """# 19 | from pysnmp.hlapi import * 20 | 21 | iterator = sendNotification( 22 | SnmpEngine(), 23 | CommunityData('public'), 24 | UdpTransportTarget(('demo.snmplabs.com', 162)), 25 | ContextData(), 26 | 'inform', 27 | NotificationType( 28 | ObjectIdentity('SNMPv2-MIB', 'coldStart') 29 | ).addVarBinds( 30 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysName', 0), 'my system') 31 | ) 32 | ) 33 | 34 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 35 | 36 | if errorIndication: 37 | print(errorIndication) 38 | 39 | elif errorStatus: 40 | print('%s at %s' % (errorStatus.prettyPrint(), 41 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 42 | 43 | else: 44 | for varBind in varBinds: 45 | print(' = '.join([x.prettyPrint() for x in varBind])) 46 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv2c TRAP via NOTIFICATION-TYPE 3 | ++++++++++++++++++++++++++++++++++ 4 | 5 | Initialize TRAP message contents from variables specified 6 | in *NOTIFICATION-TYPE* SMI macro. 7 | 8 | * SNMPv2c 9 | * with community name 'public' 10 | * over IPv4/UDP 11 | * send TRAP notification 12 | * with TRAP ID 'linkUp' specified as a MIB symbol 13 | * include values for managed objects implicitly added to notification 14 | (via NOTIFICATION-TYPE->OBJECTS) 15 | 16 | Functionally similar to: 17 | 18 | | $ snmptrap -v2c -c public demo.snmplabs.com 0 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.2.2.1.1.123 i 123 1.3.6.1.2.1.2.2.1.7.123 i 1 1.3.6.1.2.1.2.2.1.8.123 i 1 19 | 20 | """# 21 | from pysnmp.hlapi import * 22 | 23 | iterator = sendNotification( 24 | SnmpEngine(), 25 | CommunityData('public'), 26 | UdpTransportTarget(('demo.snmplabs.com', 162)), 27 | ContextData(), 28 | 'trap', 29 | NotificationType( 30 | ObjectIdentity('IF-MIB', 'linkUp'), 31 | instanceIndex=(123,), 32 | objects={ 33 | ('IF-MIB', 'ifIndex'): 123, 34 | ('IF-MIB', 'ifAdminStatus'): 'up', 35 | ('IF-MIB', 'ifOperStatus'): 'up' 36 | } 37 | ) 38 | ) 39 | 40 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 41 | 42 | if errorIndication: 43 | print(errorIndication) 44 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v3-inform.py: -------------------------------------------------------------------------------- 1 | """ 2 | INFORM, auth: MD5 privacy: DES 3 | ++++++++++++++++++++++++++++++ 4 | 5 | Send SNMP INFORM notification using the following options: 6 | 7 | * SNMPv3 8 | * with user 'usr-md5-des', auth: MD5, priv DES 9 | * over IPv4/UDP 10 | * send INFORM notification 11 | * with TRAP ID 'warmStart' specified as a string OID 12 | * include managed object information 1.3.6.1.2.1.1.5.0 = 'system name' 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpinform -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 demo.snmplabs.com 12345 1.3.6.1.4.1.20408.4.1.1.2 1.3.6.1.2.1.1.1.0 s "my system" 17 | 18 | """# 19 | from pysnmp.hlapi import * 20 | 21 | iterator = sendNotification( 22 | SnmpEngine(), 23 | UsmUserData('usr-md5-des', 'authkey1', 'privkey1'), 24 | UdpTransportTarget(('demo.snmplabs.com', 162)), 25 | ContextData(), 26 | 'inform', 27 | NotificationType( 28 | ObjectIdentity('1.3.6.1.6.3.1.1.5.2') 29 | ).addVarBinds( 30 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1.5.0'), 'system name') 31 | ).loadMibs( 32 | 'SNMPv2-MIB' 33 | ) 34 | ) 35 | 36 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 37 | 38 | if errorIndication: 39 | print(errorIndication) 40 | 41 | elif errorStatus: 42 | print('%s at %s' % (errorStatus.prettyPrint(), 43 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 44 | 45 | else: 46 | for varBind in varBinds: 47 | print(' = '.join([x.prettyPrint() for x in varBind])) 48 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py: -------------------------------------------------------------------------------- 1 | """ 2 | Coerce value to SET to MIB spec 3 | +++++++++++++++++++++++++++++++ 4 | 5 | Send SNMP SET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * setting SNMPv2-MIB::sysName.0 to new value (type taken from MIB) 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpset -v2c -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 = "new system name" 15 | 16 | """# 17 | from pysnmp.hlapi import * 18 | 19 | iterator = setCmd( 20 | SnmpEngine(), 21 | CommunityData('public'), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ContextData(), 24 | ObjectType( 25 | ObjectIdentity('SNMPv2-MIB', 'sysORDescr', 1), 26 | 'new system name' 27 | ) 28 | ) 29 | 30 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 31 | 32 | if errorIndication: 33 | print(errorIndication) 34 | 35 | elif errorStatus: 36 | print('%s at %s' % (errorStatus.prettyPrint(), 37 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 38 | 39 | else: 40 | for varBind in varBinds: 41 | print(' = '.join([x.prettyPrint() for x in varBind])) 42 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py: -------------------------------------------------------------------------------- 1 | """ 2 | Custom ASN.1 MIB path 3 | +++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for IF-MIB::ifInOctets.1 MIB object 11 | * pass non-default ASN.1 MIB source to MIB compiler 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v2c -c public -M /usr/share/snmp demo.snmplabs.com IF-MIB::ifInOctets.1 16 | 17 | """# 18 | from pysnmp.hlapi import * 19 | 20 | iterator = getCmd( 21 | SnmpEngine(), 22 | CommunityData('public'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ContextData(), 25 | ObjectType( 26 | ObjectIdentity( 27 | 'IF-MIB', 'ifInOctets', 1 28 | ).addAsn1MibSource( 29 | 'file:///usr/share/snmp', 30 | 'http://mibs.snmplabs.com/asn1/@mib@' 31 | ) 32 | ) 33 | ) 34 | 35 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 36 | 37 | if errorIndication: 38 | print(errorIndication) 39 | 40 | elif errorStatus: 41 | print('%s at %s' % (errorStatus.prettyPrint(), 42 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 43 | 44 | else: 45 | for varBind in varBinds: 46 | print(' = '.join([x.prettyPrint() for x in varBind])) 47 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-contextengineid.py: -------------------------------------------------------------------------------- 1 | """ 2 | Custom ContextEngineId 3 | ++++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv3 with user 'usr-md5-des', MD5 auth and DES privacy protocols 8 | * use remote SNMP Engine ID 0x80004fb805636c6f75644dab22cc (USM 9 | autodiscovery will run) 10 | * over IPv4/UDP 11 | * to an Agent at demo.snmplabs.com:161 12 | * setting SNMPv2-MIB::sysName.0 to new value (type coerced from MIB) 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpset -v3 -u usr-md5-des -l authPriv -A authkey1 -X privkey1 -E 80004fb805636c6f75644dab22cc demo.snmplabs.com SNMPv2-MIB::sysORDescr.1 = "new system name" 17 | 18 | """# 19 | from pysnmp.hlapi import * 20 | 21 | iterator = setCmd( 22 | SnmpEngine(), 23 | UsmUserData('usr-md5-des', 'authkey1', 'privkey1', 24 | securityEngineId=OctetString(hexValue='80004fb805636c6f75644dab22cc')), 25 | UdpTransportTarget(('demo.snmplabs.com', 161)), 26 | ContextData(), 27 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysName', 0), 'new system name') 28 | ) 29 | 30 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 31 | 32 | if errorIndication: 33 | print(errorIndication) 34 | 35 | elif errorStatus: 36 | print('%s at %s' % (errorStatus.prettyPrint(), 37 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 38 | 39 | else: 40 | for varBind in varBinds: 41 | print(' = '.join([x.prettyPrint() for x in varBind])) 42 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/custom-v3-security-name.py: -------------------------------------------------------------------------------- 1 | """ 2 | Custom SecurityName 3 | +++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv3, user 'usr-md5-none', securityName 'myuser' 8 | MD5 authentication, no privacy 9 | * over IPv4/UDP 10 | * to an Agent at demo.snmplabs.com:161 11 | * for an OID in text form 12 | 13 | The securityName parameter can be thought as an alias to userName and 14 | allows you to address a USM Table row just as userName does. However 15 | securityName can be made human-readable, also it is not an index in 16 | usmUserTable, thus duplicate securityName parameters are possible. 17 | """# 18 | from pysnmp.hlapi import * 19 | 20 | iterator = getCmd( 21 | SnmpEngine(), 22 | UsmUserData('usr-md5-none', 'authkey1', securityName='myuser'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ContextData(), 25 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')) 26 | ) 27 | 28 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 29 | 30 | if errorIndication: 31 | print(errorIndication) 32 | 33 | elif errorStatus: 34 | print('%s at %s' % (errorStatus.prettyPrint(), 35 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 36 | 37 | else: 38 | for varBind in varBinds: 39 | print(' = '.join([x.prettyPrint() for x in varBind])) 40 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py: -------------------------------------------------------------------------------- 1 | """ 2 | GET over IPv6 3 | +++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv3 with user 'usr-md5-des', MD5 auth and DES privacy protocols 8 | * over IPv6/UDP 9 | * to an Agent at [::1]:161 10 | * for three OIDs in string form 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 udp6:[::1]:161 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0 1.3.6.1.2.1.1.3.0 15 | """# 16 | from pysnmp.hlapi import * 17 | 18 | iterator = getCmd( 19 | SnmpEngine(), 20 | UsmUserData('usr-md5-des', 'authkey1', 'privkey1'), 21 | Udp6TransportTarget(('::1', 161)), 22 | ContextData(), 23 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')), 24 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1.2.0')), 25 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1.3.0')) 26 | ) 27 | 28 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 29 | 30 | if errorIndication: 31 | print(errorIndication) 32 | 33 | elif errorStatus: 34 | print('%s at %s' % (errorStatus.prettyPrint(), 35 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 36 | 37 | else: 38 | for varBind in varBinds: 39 | print(' = '.join([x.prettyPrint() for x in varBind])) 40 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py: -------------------------------------------------------------------------------- 1 | """ 2 | GET table row 3 | +++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv3, user 'usr-none-none', no authentication, no privacy 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for IF-MIB::ifInOctets.1 and IF-MIB::ifOutOctets.1 MIB object 11 | * perform response OIDs and values resolution at MIB 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 demo.snmplabs.com IF-MIB::ifInOctets.1 IF-MIB::ifOutOctets.1 16 | 17 | """# 18 | from pysnmp.hlapi import * 19 | 20 | iterator = getCmd( 21 | SnmpEngine(), 22 | UsmUserData('usr-none-none'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ContextData(), 25 | ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1)), 26 | ObjectType(ObjectIdentity('IF-MIB', 'ifOutOctets', 1)) 27 | ) 28 | 29 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 30 | 31 | if errorIndication: 32 | print(errorIndication) 33 | 34 | elif errorStatus: 35 | print('%s at %s' % (errorStatus.prettyPrint(), 36 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 37 | 38 | else: 39 | for varBind in varBinds: 40 | print(' = '.join([x.prettyPrint() for x in varBind])) 41 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py: -------------------------------------------------------------------------------- 1 | """ 2 | Walk Agent, limit number of packets 3 | +++++++++++++++++++++++++++++++++++ 4 | 5 | Send a series of SNMP GETBULK requests using the following options: 6 | 7 | * with SNMPv3, user 'usr-none-none', no authentication, no privacy 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for all OIDs past SNMPv2-MIB::system 11 | * run till end-of-mib condition is reported by Agent OR 12 | maxCalls == 10 request-response interactions occur 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpbulkwalk -v3 -lnoAuthNoPriv -u usr-none-none -Cn0 -Cr50 demo.snmplabs.com SNMPv2-MIB::system 17 | 18 | """# 19 | from pysnmp.hlapi import * 20 | 21 | iterator = bulkCmd( 22 | SnmpEngine(), 23 | UsmUserData('usr-none-none'), 24 | UdpTransportTarget(('demo.snmplabs.com', 161)), 25 | ContextData(), 26 | 0, 50, 27 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'system')), 28 | maxCalls=10 29 | ) 30 | 31 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 32 | 33 | if errorIndication: 34 | print(errorIndication) 35 | break 36 | 37 | elif errorStatus: 38 | print('%s at %s' % (errorStatus.prettyPrint(), 39 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 40 | break 41 | 42 | else: 43 | for varBind in varBinds: 44 | print(' = '.join([x.prettyPrint() for x in varBind])) 45 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-variables.py: -------------------------------------------------------------------------------- 1 | """ 2 | Walk MIB, limit number of response rows 3 | +++++++++++++++++++++++++++++++++++++++ 4 | 5 | Send a series of SNMP GETBULK requests using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * with values non-repeaters = 0, max-repetitions = 25 11 | * for two OIDs in string form 12 | * stop when response OIDs leave the scopes of initial OIDs OR 13 | number of response rows reach fixed value (20) 14 | 15 | Functionally similar to: 16 | 17 | | $ snmpbulkwalk -v2c -c public demo.snmplabs.com -Cn0 -Cr25 1.3.6.1.2.1.2.2 1.3.6.1.2.1.2.3 18 | 19 | """# 20 | from pysnmp.hlapi import * 21 | 22 | iterator = bulkCmd( 23 | SnmpEngine(), 24 | CommunityData('public'), 25 | UdpTransportTarget(('demo.snmplabs.com', 161)), 26 | ContextData(), 27 | 0, 25, 28 | ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2')), 29 | ObjectType(ObjectIdentity('1.3.6.1.2.1.2.3')), 30 | lexicographicMode=False, maxRows=20 31 | ) 32 | 33 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 34 | 35 | if errorIndication: 36 | print(errorIndication) 37 | break 38 | 39 | elif errorStatus: 40 | print('%s at %s' % (errorStatus.prettyPrint(), 41 | errorIndex and varBinds[int(errorIndex)-1][0] or '?')) 42 | break 43 | 44 | else: 45 | for varBind in varBinds: 46 | print(' = '.join([ x.prettyPrint() for x in varBind ])) 47 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/getnext-multiple-oids-to-eom.py: -------------------------------------------------------------------------------- 1 | """ 2 | Fetch two OID branches 3 | ++++++++++++++++++++++ 4 | 5 | Send a series of SNMP GETNEXT requests using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for two OIDs in string form 11 | * stop when response OIDs leave the scopes of initial OIDs 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpwalk -v2c -c public demo.snmplabs.com 1.3.6.1.2.1.2.2.1.2 1.3.6.1.2.1.2.2.1.3 16 | 17 | """# 18 | from pysnmp.hlapi import * 19 | 20 | iterator = nextCmd( 21 | SnmpEngine(), 22 | CommunityData('public'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ContextData(), 25 | ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2.1.2')), 26 | ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2.1.3')), 27 | lexicographicMode=False 28 | ) 29 | 30 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 31 | 32 | if errorIndication: 33 | print(errorIndication) 34 | break 35 | 36 | elif errorStatus: 37 | print('%s at %s' % (errorStatus.prettyPrint(), 38 | errorIndex and varBinds[int(errorIndex)-1][0] or '?')) 39 | break 40 | 41 | else: 42 | for varBind in varBinds: 43 | print(' = '.join([ x.prettyPrint() for x in varBind ])) 44 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Preload PySNMP MIBs 3 | +++++++++++++++++++ 4 | 5 | Send a series of SNMP GETNEXT requests using the following options: 6 | 7 | * with SNMPv3 with user 'usr-md5-des', MD5 auth and DES privacy protocols 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for all OIDs starting from 1.3.6 11 | * preload all Python MIB modules found in search path 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpwalk -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 -m ALL demo.snmplabs.com:161 1.3.6 16 | 17 | """# 18 | from pysnmp.hlapi import * 19 | 20 | iterator = nextCmd( 21 | SnmpEngine(), 22 | UsmUserData('usr-md5-des', 'authkey1', 'privkey1'), 23 | UdpTransportTarget(('demo.snmplabs.com', 161)), 24 | ContextData(), 25 | ObjectType(ObjectIdentity('1.3.6').loadMibs()) 26 | ) 27 | 28 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 29 | 30 | if errorIndication: 31 | print(errorIndication) 32 | break 33 | 34 | elif errorStatus: 35 | print('%s at %s' % (errorStatus.prettyPrint(), 36 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 37 | break 38 | 39 | else: 40 | for varBind in varBinds: 41 | print(' = '.join([x.prettyPrint() for x in varBind])) 42 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py: -------------------------------------------------------------------------------- 1 | """ 2 | Walk whole MIB 3 | ++++++++++++++ 4 | 5 | Send a series of SNMP GETNEXT requests using the following options: 6 | 7 | * with SNMPv3, user 'usr-md5-none', MD5 authentication, no privacy 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for all OIDs in IF-MIB 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpwalk -v3 -lauthPriv -u usr-md5-none -A authkey1 -X privkey1 demo.snmplabs.com IF-MIB:: 15 | 16 | """# 17 | from pysnmp.hlapi import * 18 | 19 | iterator = nextCmd( 20 | SnmpEngine(), 21 | UsmUserData('usr-md5-none', 'authkey1'), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ContextData(), 24 | ObjectType(ObjectIdentity('IF-MIB')) 25 | ) 26 | 27 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 28 | 29 | if errorIndication: 30 | print(errorIndication) 31 | break 32 | 33 | elif errorStatus: 34 | print('%s at %s' % (errorStatus.prettyPrint(), 35 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 36 | break 37 | 38 | else: 39 | for varBind in varBinds: 40 | print(' = '.join([x.prettyPrint() for x in varBind])) 41 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-des.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv3: auth MD5, privacy DES 3 | +++++++++++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv3, user 'usr-md5-des', MD5 authentication, DES encryption 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for IF-MIB::ifInOctets.1 MIB object 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 demo.snmplabs.com IF-MIB::ifInOctets.1 15 | 16 | """# 17 | from pysnmp.hlapi import * 18 | 19 | iterator = getCmd( 20 | SnmpEngine(), 21 | UsmUserData('usr-md5-des', 'authkey1', 'privkey1'), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ContextData(), 24 | ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1)) 25 | ) 26 | 27 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 28 | 29 | if errorIndication: 30 | print(errorIndication) 31 | 32 | elif errorStatus: 33 | print('%s at %s' % (errorStatus.prettyPrint(), 34 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 35 | 36 | else: 37 | for varBind in varBinds: 38 | print(' = '.join([x.prettyPrint() for x in varBind])) 39 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-md5-none.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv3: auth MD5, no privacy 3 | ++++++++++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv3, user 'usr-md5-none', MD5 authentication, no privacy 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for IF-MIB::ifInOctets.1 MIB object 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 demo.snmplabs.com IF-MIB::ifInOctets.1 15 | 16 | """# 17 | from pysnmp.hlapi import * 18 | 19 | iterator = getCmd( 20 | SnmpEngine(), 21 | UsmUserData('usr-md5-none', 'authkey1'), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ContextData(), 24 | ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1)) 25 | ) 26 | 27 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 28 | 29 | if errorIndication: 30 | print(errorIndication) 31 | 32 | elif errorStatus: 33 | print('%s at %s' % (errorStatus.prettyPrint(), 34 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 35 | 36 | else: 37 | for varBind in varBinds: 38 | print(' = '.join([x.prettyPrint() for x in varBind])) 39 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/usm-none-none.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv3: no auth, no privacy 3 | +++++++++++++++++++++++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv3, user 'usr-none-none', no authentication, no encryption 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for IF-MIB::ifInOctets.1 MIB object 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v3 -l noAuthNoPriv -u usr-none-none demo.snmplabs.com IF-MIB::ifInOctets.1 15 | 16 | """# 17 | from pysnmp.hlapi import * 18 | 19 | iterator = getCmd( 20 | SnmpEngine(), 21 | UsmUserData('usr-none-none'), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ContextData(), 24 | ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets', 1)) 25 | ) 26 | 27 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 28 | 29 | if errorIndication: 30 | print(errorIndication) 31 | 32 | elif errorStatus: 33 | print('%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 34 | 35 | else: 36 | for varBind in varBinds: 37 | print(' = '.join([x.prettyPrint() for x in varBind])) 38 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v1-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv1 3 | ++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv1, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for two instances of SNMPv2-MIB::sysDescr.0 MIB object, 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 15 | 16 | """# 17 | from pysnmp.hlapi import * 18 | 19 | iterator = getCmd( 20 | SnmpEngine(), 21 | CommunityData('public', mpModel=0), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ContextData(), 24 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)) 25 | ) 26 | 27 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 28 | 29 | if errorIndication: 30 | print(errorIndication) 31 | 32 | elif errorStatus: 33 | print('%s at %s' % (errorStatus.prettyPrint(), 34 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 35 | 36 | else: 37 | for varBind in varBinds: 38 | print(' = '.join([x.prettyPrint() for x in varBind])) 39 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv2c 3 | +++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for two OIDs in string form 11 | 12 | Functionally similar to: 13 | 14 | | $ snmpget -v2c -c public demo.snmplabs.com 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.6.0 15 | 16 | """# 17 | from pysnmp.hlapi import * 18 | 19 | iterator = getCmd( 20 | SnmpEngine(), 21 | CommunityData('public'), 22 | UdpTransportTarget(('demo.snmplabs.com', 161)), 23 | ContextData(), 24 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')), 25 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1.6.0')) 26 | ) 27 | 28 | errorIndication, errorStatus, errorIndex, varBinds = next(iterator) 29 | 30 | if errorIndication: 31 | print(errorIndication) 32 | 33 | elif errorStatus: 34 | print('%s at %s' % (errorStatus.prettyPrint(), 35 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 36 | 37 | else: 38 | for varBind in varBinds: 39 | print(' = '.join([x.prettyPrint() for x in varBind])) 40 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/v2c-getbulk.py: -------------------------------------------------------------------------------- 1 | """ 2 | Bulk walk MIB 3 | +++++++++++++ 4 | 5 | Send a series of SNMP GETBULK requests using the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * with values non-repeaters = 0, max-repetitions = 25 11 | * for two OIDs in string form 12 | * stop when response OIDs leave the scopes of initial OIDs 13 | 14 | Functionally similar to: 15 | 16 | | $ snmpbulkwalk -v2c -c public demo.snmplabs.com -Cn0 -Cr25 1.3.6.1.2.1.2.2 1.3.6.1.2.1.2.3 17 | 18 | """# 19 | from pysnmp.hlapi import * 20 | 21 | iterator = bulkCmd( 22 | SnmpEngine(), 23 | CommunityData('public'), 24 | UdpTransportTarget(('demo.snmplabs.com', 161)), 25 | ContextData(), 26 | 0, 25, 27 | ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2')), 28 | ObjectType(ObjectIdentity('1.3.6.1.2.1.2.3')), 29 | lexicographicMode=False 30 | ) 31 | 32 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 33 | 34 | if errorIndication: 35 | print(errorIndication) 36 | break 37 | 38 | elif errorStatus: 39 | print('%s at %s' % (errorStatus.prettyPrint(), 40 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 41 | break 42 | 43 | else: 44 | for varBind in varBinds: 45 | print(' = '.join([x.prettyPrint() for x in varBind])) 46 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/waive-mib-lookup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Waive MIB lookup 3 | ++++++++++++++++ 4 | 5 | Perform SNMP GETNEXT operation with the following options: 6 | 7 | * with SNMPv2c, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for an OID in string form 11 | * do not resolve request/response OIDs and values from/toto human-friendly form 12 | 13 | The `lookupMib=False` keyword argument makes pysnmp NOT resolving 14 | request and response variable-bindings from/to human-friendly form. 15 | 16 | Functionally similar to: 17 | 18 | | $ snmpwalk -v2c -c public -ObentU demo.snmplabs.com 1.3.6.1.2.1 19 | 20 | """# 21 | from pysnmp.hlapi import * 22 | 23 | iterator = nextCmd( 24 | SnmpEngine(), 25 | CommunityData('public'), 26 | UdpTransportTarget(('demo.snmplabs.com', 161)), 27 | ContextData(), 28 | ObjectType(ObjectIdentity('1.3.6.1.2.1.1')), 29 | lookupMib=False 30 | ) 31 | 32 | for errorIndication, errorStatus, errorIndex, varBinds in iterator: 33 | 34 | if errorIndication: 35 | print(errorIndication) 36 | break 37 | 38 | elif errorStatus: 39 | print('%s at %s' % (errorStatus.prettyPrint(), 40 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 41 | break 42 | 43 | else: 44 | for varBind in varBinds: 45 | print(' = '.join([x.prettyPrint() for x in varBind])) 46 | -------------------------------------------------------------------------------- /examples/hlapi/v3arch/trollius/manager/cmdgen/v1-get.py: -------------------------------------------------------------------------------- 1 | """ 2 | SNMPv1 3 | ++++++ 4 | 5 | Send SNMP GET request using the following options: 6 | 7 | * with SNMPv1, community 'public' 8 | * over IPv4/UDP 9 | * to an Agent at demo.snmplabs.com:161 10 | * for an instance of SNMPv2-MIB::sysDescr.0 MIB object 11 | * Based on trollius I/O framework 12 | 13 | Functionally similar to: 14 | 15 | | $ snmpget -v1 -c public demo.snmplabs.com SNMPv2-MIB::sysDescr.0 16 | 17 | """# 18 | import trollius 19 | from pysnmp.hlapi.v3arch.asyncio import * 20 | 21 | 22 | @trollius.coroutine 23 | def run(): 24 | 25 | snmpEngine = SnmpEngine() 26 | 27 | iterator = getCmd( 28 | snmpEngine, 29 | CommunityData('public', mpModel=0), 30 | UdpTransportTarget(('demo.snmplabs.com', 161)), 31 | ContextData(), 32 | ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)) 33 | ) 34 | 35 | (errorIndication, errorStatus, 36 | errorIndex, varBinds) = yield trollius.From(iterator) 37 | 38 | if errorIndication: 39 | print(errorIndication) 40 | 41 | elif errorStatus: 42 | print('%s at %s' % (errorStatus.prettyPrint(), 43 | errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) 44 | 45 | else: 46 | for varBind in varBinds: 47 | print(' = '.join([x.prettyPrint() for x in varBind])) 48 | 49 | snmpEngine.transportDispatcher.closeDispatcher() 50 | 51 | 52 | trollius.get_event_loop().run_until_complete(run()) 53 | -------------------------------------------------------------------------------- /examples/smi/manager/configure-mib-viewer-and-resolve-pdu-varbinds.py: -------------------------------------------------------------------------------- 1 | """ 2 | PDU var-binds to MIB objects 3 | ++++++++++++++++++++++++++++ 4 | 5 | This script explains how Python application could turn SNMP PDU 6 | variable-bindings into MIB objects or the other way around. 7 | 8 | The code that configures MIB compiler is similar to what 9 | happens inside the pysnmp.hlapi API. 10 | """# 11 | from pysnmp.smi import builder, view, compiler, rfc1902 12 | 13 | # Assemble MIB browser 14 | mibBuilder = builder.MibBuilder() 15 | mibViewController = view.MibViewController(mibBuilder) 16 | compiler.addMibCompiler(mibBuilder, sources=['file:///usr/share/snmp/mibs', 17 | 'http://mibs.snmplabs.com/asn1/@mib@']) 18 | 19 | # Pre-load MIB modules we expect to work with 20 | mibBuilder.loadModules('SNMPv2-MIB', 'SNMP-COMMUNITY-MIB') 21 | 22 | # This is what we can get in TRAP PDU 23 | varBinds = [ 24 | ('1.3.6.1.2.1.1.3.0', 12345), 25 | ('1.3.6.1.6.3.1.1.4.1.0', '1.3.6.1.6.3.1.1.5.2'), 26 | ('1.3.6.1.6.3.18.1.3.0', '0.0.0.0'), 27 | ('1.3.6.1.6.3.18.1.4.0', ''), 28 | ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'), 29 | ('1.3.6.1.2.1.1.1.0', 'my system') 30 | ] 31 | 32 | # Run var-binds through MIB resolver 33 | # You may want to catch and ignore resolution errors here 34 | varBinds = [rfc1902.ObjectType(rfc1902.ObjectIdentity(x[0]), x[1]).resolveWithMib(mibViewController) 35 | for x in varBinds] 36 | 37 | for varBind in varBinds: 38 | print(varBind.prettyPrint()) 39 | -------------------------------------------------------------------------------- /extra-requirements.txt: -------------------------------------------------------------------------------- 1 | pysnmpcrypto 2 | trollius; python_version < '3.0' 3 | twisted < 15.4; python_version < '2.7' 4 | twisted; python_version == '2.7' 5 | twisted < 17.9; python_version == '3.0' 6 | twisted < 17.9; python_version == '3.1' 7 | twisted < 17.9; python_version == '3.2' 8 | twisted <= 17.9; python_version == '3.3' 9 | twisted <= 17.9; python_version == '3.4' 10 | twisted; python_version >= '3.5' 11 | -------------------------------------------------------------------------------- /pysnmp/__init__.py: -------------------------------------------------------------------------------- 1 | # http://www.python.org/dev/peps/pep-0396/ 2 | __version__ = '5.0.0' 3 | -------------------------------------------------------------------------------- /pysnmp/cache.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # Limited-size dictionary-like class to use for caches 8 | # 9 | 10 | 11 | class Cache(object): 12 | def __init__(self, maxSize=256): 13 | self._maxSize = maxSize 14 | self._size = 0 15 | self._chopSize = maxSize // 10 16 | self._chopSize = self._chopSize or 1 17 | self._cache = {} 18 | self._usage = {} 19 | 20 | def __contains__(self, k): 21 | return k in self._cache 22 | 23 | def __getitem__(self, k): 24 | self._usage[k] += 1 25 | return self._cache[k] 26 | 27 | def __len__(self): 28 | return self._size 29 | 30 | def __setitem__(self, k, v): 31 | if self._size >= self._maxSize: 32 | usageKeys = sorted( 33 | self._usage, key=lambda x, d=self._usage: d[x]) 34 | 35 | for _k in usageKeys[:self._chopSize]: 36 | del self._cache[_k] 37 | del self._usage[_k] 38 | 39 | self._size -= self._chopSize 40 | 41 | if k not in self._cache: 42 | self._size += 1 43 | self._usage[k] = 0 44 | 45 | self._cache[k] = v 46 | 47 | def __delitem__(self, k): 48 | del self._cache[k] 49 | del self._usage[k] 50 | self._size -= 1 51 | -------------------------------------------------------------------------------- /pysnmp/carrier/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/carrier/asyncio/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/carrier/asyncio/dgram/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/carrier/asyncio/dgram/udp6.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | import socket 8 | 9 | from pysnmp.carrier.asyncio.dgram.base import DgramAsyncioProtocol 10 | from pysnmp.carrier.base import AbstractTransportAddress 11 | 12 | domainName = snmpUDP6Domain = (1, 3, 6, 1, 2, 1, 100, 1, 2) 13 | 14 | 15 | class Udp6TransportAddress(tuple, AbstractTransportAddress): 16 | pass 17 | 18 | 19 | class Udp6AsyncioTransport(DgramAsyncioProtocol): 20 | SOCK_FAMILY = socket.has_ipv6 and socket.AF_INET6 or None 21 | ADDRESS_TYPE = Udp6TransportAddress 22 | 23 | def normalizeAddress(self, transportAddress): 24 | if '%' in transportAddress[0]: # strip zone ID 25 | return self.ADDRESS_TYPE((transportAddress[0].split('%')[0], 26 | transportAddress[1], 27 | 0, # flowinfo 28 | 0)) # scopeid 29 | else: 30 | return self.ADDRESS_TYPE((transportAddress[0], 31 | transportAddress[1], 0, 0)) 32 | 33 | 34 | Udp6Transport = Udp6AsyncioTransport 35 | -------------------------------------------------------------------------------- /pysnmp/carrier/asyncore/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/carrier/asyncore/dgram/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/carrier/asyncore/dgram/udp.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from socket import AF_INET 8 | 9 | from pysnmp.carrier.asyncore.dgram.base import DgramSocketTransport 10 | from pysnmp.carrier.base import AbstractTransportAddress 11 | 12 | DOMAIN_NAME = SNMP_UDP_DOMAIN = (1, 3, 6, 1, 6, 1, 1) 13 | 14 | 15 | class UdpTransportAddress(tuple, AbstractTransportAddress): 16 | pass 17 | 18 | 19 | class UdpSocketTransport(DgramSocketTransport): 20 | SOCK_FAMILY = AF_INET 21 | ADDRESS_TYPE = UdpTransportAddress 22 | 23 | 24 | UdpTransport = UdpSocketTransport 25 | -------------------------------------------------------------------------------- /pysnmp/carrier/asyncore/dgram/udp6.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | import socket 8 | 9 | from pysnmp.carrier.asyncore.dgram.base import DgramSocketTransport 10 | from pysnmp.carrier.base import AbstractTransportAddress 11 | 12 | DOMAIN_NAME = SNMP_UDP6_DOMAIN = (1, 3, 6, 1, 2, 1, 100, 1, 2) 13 | 14 | 15 | class Udp6TransportAddress(tuple, AbstractTransportAddress): 16 | pass 17 | 18 | 19 | class Udp6SocketTransport(DgramSocketTransport): 20 | SOCK_FAMILY = socket.has_ipv6 and socket.AF_INET6 or None 21 | ADDRESS_TYPE = Udp6TransportAddress 22 | 23 | def normalizeAddress(self, transportAddress): 24 | if '%' in transportAddress[0]: # strip zone ID 25 | ta = self.ADDRESS_TYPE( 26 | (transportAddress[0].split('%')[0], transportAddress[1], 0, 0)) 27 | 28 | else: 29 | ta = self.ADDRESS_TYPE( 30 | (transportAddress[0], transportAddress[1], 0, 0)) 31 | 32 | if (isinstance(transportAddress, self.ADDRESS_TYPE) and 33 | transportAddress.getLocalAddress()): 34 | 35 | return ta.setLocalAddress(transportAddress.getLocalAddress()) 36 | 37 | else: 38 | return ta.setLocalAddress(self.getLocalAddress()) 39 | 40 | 41 | Udp6Transport = Udp6SocketTransport 42 | -------------------------------------------------------------------------------- /pysnmp/carrier/error.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp import error 8 | 9 | 10 | class CarrierError(error.PySnmpError): 11 | pass 12 | -------------------------------------------------------------------------------- /pysnmp/carrier/sockfix.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | import socket 8 | 9 | from pysnmp import debug 10 | 11 | SYMBOLS = { 12 | 'IP_PKTINFO': 8, 13 | 'IP_TRANSPARENT': 19, 14 | 'SOL_IPV6': 41, 15 | 'IPV6_RECVPKTINFO': 49, 16 | 'IPV6_PKTINFO': 50, 17 | 'IPV6_TRANSPARENT': 75 18 | } 19 | 20 | for symbol, value in SYMBOLS.items(): 21 | if not hasattr(socket, symbol): 22 | setattr(socket, symbol, value) 23 | 24 | debug.logger & debug.FLAG_IO and debug.logger( 25 | 'WARNING: the socket module on this platform misses option %s. ' 26 | 'Assuming its value is %d.' % (symbol, value) 27 | ) 28 | -------------------------------------------------------------------------------- /pysnmp/carrier/twisted/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/carrier/twisted/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # Copyright (C) 2008 Truelite Srl 8 | # Author: Filippo Giunchedi 9 | # 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the BSD 2-Clause License as shipped with pysnmp. 12 | # 13 | # Description: twisted DatagramProtocol UDP transport 14 | # 15 | from pysnmp.carrier.base import AbstractTransport 16 | from pysnmp.carrier.twisted.dispatch import TwistedDispatcher 17 | 18 | 19 | class AbstractTwistedTransport(AbstractTransport): 20 | PROTO_TRANSPORT_DISPATCHER = TwistedDispatcher 21 | 22 | def __init__(self, sock=None, sockMap=None): 23 | self._writeQ = [] 24 | AbstractTransport.__init__(self) 25 | -------------------------------------------------------------------------------- /pysnmp/carrier/twisted/dgram/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/entity/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/entity/rfc3413/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/error.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | 8 | import sys 9 | 10 | 11 | class PySnmpError(Exception): 12 | 13 | def __init__(self, *args): 14 | msg = args and str(args[0]) or '' 15 | 16 | self.cause = sys.exc_info() 17 | 18 | if self.cause[0]: 19 | msg += 'caused by %s: %s' % (self.cause[0], self.cause[1]) 20 | 21 | if msg: 22 | args = (msg,) + args[1:] 23 | 24 | Exception.__init__(self, *args) 25 | -------------------------------------------------------------------------------- /pysnmp/hlapi/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | 8 | # default is v3arch 9 | from pysnmp.hlapi.v3arch import * 10 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v1arch/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.hlapi.v1arch.auth import * 8 | from pysnmp.hlapi.v1arch.asyncore.dispatch import * 9 | from pysnmp.proto.rfc1902 import * 10 | from pysnmp.proto.rfc1905 import EndOfMibView 11 | from pysnmp.proto.rfc1905 import NoSuchObject 12 | from pysnmp.proto.rfc1905 import NoSuchInstance 13 | from pysnmp.smi.rfc1902 import * 14 | 15 | # default is synchronous asyncore-based API 16 | from pysnmp.hlapi.v1arch.asyncore.sync import * 17 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v1arch/asyncio/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.hlapi.v1arch.auth import * 8 | from pysnmp.hlapi.v1arch.asyncio.transport import * 9 | from pysnmp.hlapi.v1arch.asyncio.cmdgen import * 10 | from pysnmp.hlapi.v1arch.asyncio.ntforg import * 11 | from pysnmp.hlapi.v1arch.asyncio.dispatch import * 12 | from pysnmp.proto.rfc1902 import * 13 | from pysnmp.smi.rfc1902 import * 14 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v1arch/asyncio/dispatch.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.carrier.asyncio.dispatch import AsyncioDispatcher 8 | from pysnmp.hlapi.v1arch.dispatch import AbstractSnmpDispatcher 9 | 10 | __all__ = ['SnmpDispatcher'] 11 | 12 | 13 | class SnmpDispatcher(AbstractSnmpDispatcher): 14 | """Creates SNMP message dispatcher object. 15 | 16 | `SnmpDispatcher` object manages send and receives SNMP PDU 17 | messages through underlying transport dispatcher and dispatches 18 | them to the callers. 19 | 20 | `SnmpDispatcher` is the only stateful object, all `hlapi.v1arch` SNMP 21 | operations require an instance of `SnmpDispatcher`. Users do not normally 22 | request services directly from `SnmpDispather`, but pass it around to 23 | other `hlapi.v1arch` interfaces. 24 | 25 | It is possible to run multiple instances of `SnmpDispatcher` in the 26 | application. In a multithreaded environment, each thread that 27 | works with SNMP must have its own `SnmpDispatcher` instance. 28 | """ 29 | PROTO_DISPATCHER = AsyncioDispatcher 30 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v1arch/asyncore/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.hlapi.v1arch.auth import * 8 | from pysnmp.hlapi.v1arch.asyncore.transport import * 9 | from pysnmp.hlapi.v1arch.asyncore.cmdgen import * 10 | from pysnmp.hlapi.v1arch.asyncore.ntforg import * 11 | from pysnmp.hlapi.v1arch.asyncore.dispatch import * 12 | from pysnmp.proto.rfc1902 import * 13 | from pysnmp.smi.rfc1902 import * 14 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v1arch/asyncore/dispatch.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher 8 | from pysnmp.hlapi.v1arch.dispatch import AbstractSnmpDispatcher 9 | 10 | __all__ = ['SnmpDispatcher'] 11 | 12 | 13 | class SnmpDispatcher(AbstractSnmpDispatcher): 14 | """Creates SNMP message dispatcher object. 15 | 16 | `SnmpDispatcher` object manages send and receives SNMP PDU 17 | messages through underlying transport dispatcher and dispatches 18 | them to the callers. 19 | 20 | `SnmpDispatcher` is the only stateful object, all `hlapi.v1arch` SNMP 21 | operations require an instance of `SnmpDispatcher`. Users do not normally 22 | request services directly from `SnmpDispather`, but pass it around to 23 | other `hlapi.v1arch` interfaces. 24 | 25 | It is possible to run multiple instances of `SnmpDispatcher` in the 26 | application. In a multithreaded environment, each thread that 27 | works with SNMP must have its own `SnmpDispatcher` instance. 28 | """ 29 | PROTO_DISPATCHER = AsyncoreDispatcher 30 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v1arch/asyncore/sync/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto.rfc1902 import * 8 | from pysnmp.smi.rfc1902 import * 9 | from pysnmp.hlapi.v1arch.auth import * 10 | from pysnmp.hlapi.v1arch.asyncore.transport import * 11 | from pysnmp.hlapi.v1arch.asyncore.cmdgen import * 12 | from pysnmp.hlapi.v1arch.asyncore.dispatch import * 13 | from pysnmp.hlapi.v1arch.asyncore.ntforg import * 14 | from pysnmp.hlapi.v1arch.asyncore.sync.cmdgen import * 15 | from pysnmp.hlapi.v1arch.asyncore.sync.ntforg import * 16 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v1arch/auth.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | 8 | __all__ = ['CommunityData'] 9 | 10 | 11 | class CommunityData(object): 12 | """Creates SNMP v1/v2c configuration entry. 13 | 14 | This object can be used by 15 | :py:class:`~pysnmp.hlapi.v1arch.asyncore.AsyncCommandGenerator` or 16 | :py:class:`~pysnmp.hlapi.v1arch.asyncore.AsyncNotificationOriginator` 17 | and their derivatives for conveying SNMP v1/v2c configuration. 18 | 19 | Parameters 20 | ---------- 21 | communityName: py:class:`str` 22 | SNMP v1/v2c community string. 23 | mpModel: py:class:`int` 24 | SNMP version - 0 for SNMPv1 and 1 for SNMPv2c. 25 | 26 | Examples 27 | -------- 28 | >>> from pysnmp.hlapi.v1arch import CommunityData 29 | >>> CommunityData('public') 30 | CommunityData(communityName=, mpModel=1) 31 | """ 32 | 33 | def __init__(self, communityName, mpModel=1): 34 | self.mpModel = mpModel 35 | self.communityName = communityName 36 | 37 | def __hash__(self): 38 | return hash((self.communityName, self.mpModel)) 39 | 40 | def __repr__(self): 41 | return '%s(communityName=, mpModel=%r)' % ( 42 | self.__class__.__name__, 43 | self.communityName, 44 | self.mpModel, 45 | ) 46 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v3arch/asyncio/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.entity.engine import * 8 | from pysnmp.hlapi.v3arch.auth import * 9 | from pysnmp.hlapi.v3arch.context import * 10 | from pysnmp.hlapi.v3arch.asyncio.transport import * 11 | from pysnmp.hlapi.v3arch.asyncio.cmdgen import * 12 | from pysnmp.hlapi.v3arch.asyncio.ntforg import * 13 | from pysnmp.proto.rfc1902 import * 14 | from pysnmp.smi.rfc1902 import * 15 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v3arch/asyncore/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.hlapi.v3arch.auth import * 8 | from pysnmp.hlapi.v3arch.context import * 9 | from pysnmp.hlapi.v3arch.asyncore.transport import * 10 | from pysnmp.hlapi.v3arch.asyncore.cmdgen import * 11 | from pysnmp.hlapi.v3arch.asyncore.ntforg import * 12 | from pysnmp.entity.engine import * 13 | from pysnmp.proto.rfc1902 import * 14 | from pysnmp.smi.rfc1902 import * 15 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v3arch/asyncore/sync/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.hlapi.v3arch.auth import * 8 | from pysnmp.hlapi.v3arch.asyncore.sync.cmdgen import * 9 | from pysnmp.hlapi.v3arch.asyncore.sync.ntforg import * 10 | from pysnmp.hlapi.v3arch.context import * 11 | from pysnmp.hlapi.v3arch.asyncore.transport import * 12 | from pysnmp.proto.rfc1902 import * 13 | from pysnmp.entity.engine import * 14 | from pysnmp.smi.rfc1902 import * 15 | -------------------------------------------------------------------------------- /pysnmp/hlapi/v3arch/twisted/__init__.py: -------------------------------------------------------------------------------- 1 | from pysnmp.hlapi.v3arch.auth import * 2 | from pysnmp.hlapi.v3arch.context import * 3 | from pysnmp.hlapi.v3arch.twisted.transport import * 4 | from pysnmp.hlapi.v3arch.twisted.cmdgen import * 5 | from pysnmp.hlapi.v3arch.twisted.ntforg import * 6 | from pysnmp.entity.engine import * 7 | from pysnmp.proto.rfc1902 import * 8 | from pysnmp.smi.rfc1902 import * 9 | -------------------------------------------------------------------------------- /pysnmp/nextid.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | import random 8 | 9 | random.seed() 10 | 11 | 12 | class Integer(object): 13 | """Return a next value in a reasonably MT-safe manner""" 14 | 15 | def __init__(self, maximum, increment=256): 16 | self._maximum = maximum 17 | if increment >= maximum: 18 | increment = maximum 19 | 20 | self._increment = increment 21 | self._threshold = increment // 2 22 | 23 | e = random.randrange(self._maximum - self._increment) 24 | 25 | self._bank = list(range(e, e + self._increment)) 26 | 27 | def __repr__(self): 28 | return '%s(%d, %d)' % ( 29 | self.__class__.__name__, self._maximum, self._increment) 30 | 31 | def __call__(self): 32 | v = self._bank.pop(0) 33 | 34 | if v % self._threshold: 35 | return v 36 | 37 | # Should be MT-safe unless too many (~ increment/2) threads 38 | # bump into this code simultaneously 39 | e = self._bank[-1] + 1 40 | if e > self._maximum: 41 | e = 0 42 | 43 | self._bank.extend(range(e, e + self._threshold)) 44 | 45 | return v 46 | -------------------------------------------------------------------------------- /pysnmp/proto/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/acmod/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/acmod/void.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp import debug 8 | from pysnmp.proto import errind 9 | from pysnmp.proto import error 10 | 11 | 12 | # rfc3415 3.2 13 | # noinspection PyUnusedLocal 14 | class Vacm(object): 15 | """Void Access Control Model""" 16 | ACCESS_MODEL_ID = 0 17 | 18 | def isAccessAllowed(self, snmpEngine, securityModel, securityName, 19 | securityLevel, viewType, contextName, variableName): 20 | debug.logger & debug.FLAG_ACL and debug.logger( 21 | 'isAccessAllowed: viewType %s for variableName ' 22 | '%s - OK' % (viewType, variableName)) 23 | 24 | # rfc3415 3.2.5c 25 | return error.StatusInformation(errorIndication=errind.accessAllowed) 26 | -------------------------------------------------------------------------------- /pysnmp/proto/api/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto.api import v1 8 | from pysnmp.proto.api import v2c 9 | from pysnmp.proto.api import verdec 10 | 11 | # Protocol versions 12 | SNMP_VERSION_1 = 0 13 | SNMP_VERSION_2C = 1 14 | PROTOCOL_MODULES = {SNMP_VERSION_1: v1, SNMP_VERSION_2C: v2c} 15 | 16 | decodeMessageVersion = verdec.decodeMessageVersion 17 | -------------------------------------------------------------------------------- /pysnmp/proto/api/verdec.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pyasn1.codec.ber import decoder 8 | from pyasn1.codec.ber import eoo 9 | from pyasn1.error import PyAsn1Error 10 | from pyasn1.type import univ 11 | 12 | from pysnmp.proto.error import ProtocolError 13 | 14 | 15 | def decodeMessageVersion(wholeMsg): 16 | try: 17 | seq, wholeMsg = decoder.decode( 18 | wholeMsg, asn1Spec=univ.Sequence(), 19 | recursiveFlag=False, substrateFun=lambda a, b, c: (a, b[:c]) 20 | ) 21 | 22 | ver, wholeMsg = decoder.decode( 23 | wholeMsg, asn1Spec=univ.Integer(), 24 | recursiveFlag=False, substrateFun=lambda a, b, c: (a, b[:c]) 25 | ) 26 | 27 | if eoo.endOfOctets.isSameTypeWith(ver): 28 | raise ProtocolError('EOO at SNMP version component') 29 | 30 | return ver 31 | 32 | except PyAsn1Error as exc: 33 | raise ProtocolError('Invalid BER at SNMP version ' 34 | 'component: %s' % exc) 35 | -------------------------------------------------------------------------------- /pysnmp/proto/cache.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto import error 8 | 9 | 10 | class Cache(object): 11 | def __init__(self): 12 | self._cacheRepository = {} 13 | 14 | def add(self, index, **kwargs): 15 | self._cacheRepository[index] = kwargs 16 | return index 17 | 18 | def pop(self, index): 19 | if index in self._cacheRepository: 20 | cachedParams = self._cacheRepository[index] 21 | else: 22 | return 23 | del self._cacheRepository[index] 24 | return cachedParams 25 | 26 | def update(self, index, **kwargs): 27 | if index not in self._cacheRepository: 28 | raise error.ProtocolError( 29 | 'Cache miss on update for %s' % kwargs 30 | ) 31 | self._cacheRepository[index].update(kwargs) 32 | 33 | def expire(self, cbFun, cbCtx): 34 | for index, cachedParams in list(self._cacheRepository.items()): 35 | if cbFun: 36 | if cbFun(index, cachedParams, cbCtx): 37 | if index in self._cacheRepository: 38 | del self._cacheRepository[index] 39 | -------------------------------------------------------------------------------- /pysnmp/proto/error.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pyasn1.error import PyAsn1Error 8 | 9 | from pysnmp import debug 10 | from pysnmp.error import PySnmpError 11 | 12 | 13 | class ProtocolError(PySnmpError, PyAsn1Error): 14 | pass 15 | 16 | 17 | # SNMP v3 exceptions 18 | 19 | class SnmpV3Error(ProtocolError): 20 | pass 21 | 22 | 23 | class StatusInformation(SnmpV3Error): 24 | def __init__(self, **kwargs): 25 | SnmpV3Error.__init__(self) 26 | 27 | self.__errorIndication = kwargs 28 | 29 | debug.logger & (debug.FLAG_DSP | debug.FLAG_MP | 30 | debug.FLAG_SM | debug.FLAG_ACL) and debug.logger( 31 | 'StatusInformation: %s' % kwargs) 32 | 33 | def __str__(self): 34 | return str(self.__errorIndication) 35 | 36 | def __getitem__(self, key): 37 | return self.__errorIndication[key] 38 | 39 | def __contains__(self, key): 40 | return key in self.__errorIndication 41 | 42 | def get(self, key, defVal=None): 43 | return self.__errorIndication.get(key, defVal) 44 | 45 | 46 | class CacheExpiredError(SnmpV3Error): 47 | pass 48 | 49 | 50 | class InternalError(SnmpV3Error): 51 | pass 52 | 53 | 54 | class MessageProcessingError(SnmpV3Error): 55 | pass 56 | 57 | 58 | class RequestTimeout(SnmpV3Error): 59 | pass 60 | -------------------------------------------------------------------------------- /pysnmp/proto/mpmod/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/proxy/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/rfc1901.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pyasn1.type import namedtype 8 | from pyasn1.type import namedval 9 | from pyasn1.type import univ 10 | 11 | from pysnmp.proto import rfc1905 12 | 13 | version = univ.Integer(namedValues=namedval.NamedValues(('version-2c', 1))) 14 | 15 | 16 | class Message(univ.Sequence): 17 | componentType = namedtype.NamedTypes( 18 | namedtype.NamedType('version', version), 19 | namedtype.NamedType('community', univ.OctetString()), 20 | namedtype.NamedType('data', rfc1905.PDUs()) 21 | ) 22 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/cache.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp import nextid 8 | from pysnmp.proto import error 9 | 10 | 11 | class Cache(object): 12 | __stateReference = nextid.Integer(0xffffff) 13 | 14 | def __init__(self): 15 | self.__cacheEntries = {} 16 | 17 | def push(self, **securityData): 18 | stateReference = self.__stateReference() 19 | self.__cacheEntries[stateReference] = securityData 20 | return stateReference 21 | 22 | def pop(self, stateReference): 23 | if stateReference in self.__cacheEntries: 24 | return self.__cacheEntries.pop(stateReference) 25 | 26 | raise error.ProtocolError( 27 | 'Cache miss for stateReference=%s at ' 28 | '%s' % (stateReference, self)) 29 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/eso/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/eso/priv/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/eso/priv/aes192.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto.secmod.eso.priv import aesbase 8 | 9 | 10 | class AesBlumenthal192(aesbase.AbstractAesBlumenthal): 11 | """AES 192 bit encryption (Internet draft) 12 | 13 | Reeder AES encryption: 14 | 15 | http://tools.ietf.org/html/draft-blumenthal-aes-usm-04 16 | """ 17 | # cusmAESCfb192PrivProtocol 18 | SERVICE_ID = (1, 3, 6, 1, 4, 1, 9, 12, 6, 1, 1) 19 | KEY_SIZE = 24 20 | 21 | 22 | class Aes192(aesbase.AbstractAesReeder): 23 | """AES 192 bit encryption (Internet draft) 24 | 25 | Reeder AES encryption with non-standard key localization algorithm 26 | borrowed from Reeder 3DES draft: 27 | 28 | http://tools.ietf.org/html/draft-blumenthal-aes-usm-04 29 | https://tools.ietf.org/html/draft-reeder-snmpv3-usm-3desede-00 30 | 31 | Known to be used by many vendors including Cisco and others. 32 | """ 33 | # cusmAESCfb192PrivProtocol (non-standard OID) 34 | SERVICE_ID = (1, 3, 6, 1, 4, 1, 9, 12, 6, 1, 101) 35 | KEY_SIZE = 24 36 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/eso/priv/aes256.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto.secmod.eso.priv import aesbase 8 | 9 | 10 | class AesBlumenthal256(aesbase.AbstractAesBlumenthal): 11 | """AES 256 bit encryption (Internet draft) 12 | 13 | http://tools.ietf.org/html/draft-blumenthal-aes-usm-04 14 | """ 15 | # cusmAESCfb256PrivProtocol 16 | SERVICE_ID = (1, 3, 6, 1, 4, 1, 9, 12, 6, 1, 2) 17 | KEY_SIZE = 32 18 | 19 | 20 | class Aes256(aesbase.AbstractAesReeder): 21 | """AES 256 bit encryption (Internet draft) 22 | 23 | Reeder AES encryption with non-standard key localization algorithm 24 | borrowed from Reeder 3DES draft: 25 | 26 | http://tools.ietf.org/html/draft-blumenthal-aes-usm-04 27 | https://tools.ietf.org/html/draft-reeder-snmpv3-usm-3desede-00 28 | 29 | Known to be used by many vendors including Cisco and others. 30 | """ 31 | # cusmAESCfb256PrivProtocol (non-standard OID) 32 | SERVICE_ID = (1, 3, 6, 1, 4, 1, 9, 12, 6, 1, 102) 33 | KEY_SIZE = 32 34 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3414/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto.secmod.rfc3414 import service 8 | 9 | SnmpUSMSecurityModel = service.SnmpUSMSecurityModel 10 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3414/auth/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3414/auth/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto import errind 8 | from pysnmp.proto import error 9 | 10 | 11 | class AbstractAuthenticationService(object): 12 | SERVICE_ID = None 13 | 14 | def hashPassphrase(self, authKey): 15 | raise error.ProtocolError(errind.noAuthentication) 16 | 17 | def localizeKey(self, authKey, snmpEngineID): 18 | raise error.ProtocolError(errind.noAuthentication) 19 | 20 | @property 21 | def digestLength(self): 22 | raise error.ProtocolError(errind.noAuthentication) 23 | 24 | # 7.2.4.1 25 | def authenticateOutgoingMsg(self, authKey, wholeMsg): 26 | raise error.ProtocolError(errind.noAuthentication) 27 | 28 | # 7.2.4.2 29 | def authenticateIncomingMsg(self, authKey, authParameters, wholeMsg): 30 | raise error.ProtocolError(errind.noAuthentication) 31 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3414/auth/noauth.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto import errind 8 | from pysnmp.proto import error 9 | from pysnmp.proto.secmod.rfc3414.auth import base 10 | 11 | 12 | class NoAuth(base.AbstractAuthenticationService): 13 | SERVICE_ID = (1, 3, 6, 1, 6, 3, 10, 1, 1, 1) # usmNoAuthProtocol 14 | 15 | def hashPassphrase(self, authKey): 16 | return 17 | 18 | def localizeKey(self, authKey, snmpEngineID): 19 | return 20 | 21 | # 7.2.4.2 22 | def authenticateOutgoingMsg(self, authKey, wholeMsg): 23 | raise error.StatusInformation(errorIndication=errind.noAuthentication) 24 | 25 | def authenticateIncomingMsg(self, authKey, authParameters, wholeMsg): 26 | raise error.StatusInformation(errorIndication=errind.noAuthentication) 27 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3414/priv/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3414/priv/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto import error 8 | 9 | 10 | class AbstractEncryptionService(object): 11 | SERVICE_ID = None 12 | KEY_SIZE = 0 13 | 14 | def hashPassphrase(self, authProtocol, privKey): 15 | raise error.ProtocolError('no encryption') 16 | 17 | def localizeKey(self, authProtocol, privKey, snmpEngineID): 18 | raise error.ProtocolError('no encryption') 19 | 20 | def encryptData(self, encryptKey, privParameters, dataToEncrypt): 21 | raise error.ProtocolError('no encryption') 22 | 23 | def decryptData(self, decryptKey, privParameters, encryptedData): 24 | raise error.ProtocolError('no encryption') 25 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3414/priv/nopriv.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto import errind 8 | from pysnmp.proto import error 9 | from pysnmp.proto.secmod.rfc3414.priv import base 10 | 11 | 12 | class NoPriv(base.AbstractEncryptionService): 13 | SERVICE_ID = (1, 3, 6, 1, 6, 3, 10, 1, 2, 1) # usmNoPrivProtocol 14 | 15 | def hashPassphrase(self, authProtocol, privKey): 16 | return 17 | 18 | def localizeKey(self, authProtocol, privKey, snmpEngineID): 19 | return 20 | 21 | def encryptData(self, encryptKey, privParameters, dataToEncrypt): 22 | raise error.StatusInformation(errorIndication=errind.noEncryption) 23 | 24 | def decryptData(self, decryptKey, privParameters, encryptedData): 25 | raise error.StatusInformation(errorIndication=errind.noEncryption) 26 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3826/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc3826/priv/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc7860/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/proto/secmod/rfc7860/auth/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/smi/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/smi/exval.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | from pysnmp.proto import rfc1905 8 | 9 | noSuchObject = rfc1905.noSuchObject 10 | noSuchInstance = rfc1905.noSuchInstance 11 | endOfMibView = endOfMib = rfc1905.endOfMibView 12 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/ASN1-ENUMERATION.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # This module supplies built-in ASN.1 types to the MIBs importing it. 8 | # 9 | from pyasn1.type import namedval 10 | 11 | if 'mibBuilder' not in globals(): 12 | import sys 13 | 14 | sys.stderr.write(__doc__) 15 | sys.exit(1) 16 | 17 | mibBuilder.exportSymbols( 18 | 'ASN1-ENUMERATION', 19 | NamedValues=namedval.NamedValues 20 | ) 21 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/ASN1-REFINEMENT.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # This module supplies built-in ASN.1 types to the MIBs importing it. 8 | # 9 | from pyasn1.type import constraint 10 | 11 | if 'mibBuilder' not in globals(): 12 | import sys 13 | 14 | sys.stderr.write(__doc__) 15 | sys.exit(1) 16 | 17 | mibBuilder.exportSymbols( 18 | 'ASN1-REFINEMENT', 19 | ConstraintsUnion=constraint.ConstraintsUnion, 20 | ConstraintsIntersection=constraint.ConstraintsIntersection, 21 | SingleValueConstraint=constraint.SingleValueConstraint, 22 | ValueRangeConstraint=constraint.ValueRangeConstraint, 23 | ValueSizeConstraint=constraint.ValueSizeConstraint 24 | ) 25 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/ASN1.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # This module supplies built-in ASN.1 types to the MIBs importing it. 8 | # 9 | from pysnmp.proto import rfc1902 10 | 11 | from pyasn1.type import univ 12 | 13 | if 'mibBuilder' not in globals(): 14 | import sys 15 | 16 | sys.stderr.write(__doc__) 17 | sys.exit(1) 18 | 19 | mibBuilder.exportSymbols( 20 | 'ASN1', 21 | ObjectIdentifier=univ.ObjectIdentifier, 22 | # Instead of using base ASN,1 types we use SNMPv2 SMI ones to make 23 | # SMI objects type-compatible with SNMP protocol values 24 | Integer=rfc1902.Integer32, 25 | OctetString=rfc1902.OctetString 26 | ) 27 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/RFC1158-MIB.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # ASN.1 source http://mibs.snmplabs.com:80/asn1/RFC1158-MIB 8 | # Produced by pysmi-0.4.0 at Thu Feb 14 23:20:17 2019 9 | # 10 | # It is a stripped version of MIB that contains only symbols that is 11 | # unique to SMIv1 and have no analogues in SMIv2 12 | # 13 | 14 | if 'mibBuilder' not in globals(): 15 | import sys 16 | 17 | sys.stderr.write(__doc__) 18 | sys.exit(1) 19 | 20 | (Counter32, 21 | MibScalar) = mibBuilder.importSymbols( 22 | "SNMPv2-SMI", 23 | "Counter32", 24 | "MibScalar") 25 | 26 | _SnmpInBadTypes_Type = Counter32 27 | _SnmpInBadTypes_Object = MibScalar 28 | snmpInBadTypes = _SnmpInBadTypes_Object( 29 | (1, 3, 6, 1, 2, 1, 11, 7), 30 | _SnmpInBadTypes_Type() 31 | ) 32 | snmpInBadTypes.setMaxAccess("read-only") 33 | if mibBuilder.loadTexts: 34 | snmpInBadTypes.setStatus("mandatory") 35 | 36 | _SnmpOutReadOnlys_Type = Counter32 37 | _SnmpOutReadOnlys_Object = MibScalar 38 | snmpOutReadOnlys = _SnmpOutReadOnlys_Object( 39 | (1, 3, 6, 1, 2, 1, 11, 23), 40 | _SnmpOutReadOnlys_Type() 41 | ) 42 | snmpOutReadOnlys.setMaxAccess("read-only") 43 | if mibBuilder.loadTexts: 44 | snmpOutReadOnlys.setStatus("mandatory") 45 | 46 | mibBuilder.exportSymbols( 47 | "RFC1158-MIB", 48 | **{"snmpInBadTypes": snmpInBadTypes, 49 | "snmpOutReadOnlys": snmpOutReadOnlys} 50 | ) 51 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/instances/__PYSNMP-USM-MIB.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # This file instantiates some of the MIB managed objects for SNMP engine use 8 | # 9 | 10 | if 'mibBuilder' not in globals(): 11 | import sys 12 | 13 | sys.stderr.write(__doc__) 14 | sys.exit(1) 15 | 16 | MibScalarInstance, = mibBuilder.importSymbols( 17 | 'SNMPv2-SMI', 18 | 'MibScalarInstance' 19 | ) 20 | 21 | (pysnmpUsmDiscoverable, 22 | pysnmpUsmDiscovery, 23 | pysnmpUsmKeyType) = mibBuilder.importSymbols( 24 | 'PYSNMP-USM-MIB', 25 | 'pysnmpUsmDiscoverable', 26 | 'pysnmpUsmDiscovery', 27 | 'pysnmpUsmKeyType' 28 | ) 29 | 30 | _pysnmpUsmDiscoverable = MibScalarInstance( 31 | pysnmpUsmDiscoverable.name, (0,), 32 | pysnmpUsmDiscoverable.syntax 33 | ) 34 | 35 | _pysnmpUsmDiscovery = MibScalarInstance( 36 | pysnmpUsmDiscovery.name, (0,), 37 | pysnmpUsmDiscovery.syntax 38 | ) 39 | 40 | _pysnmpUsmKeyType = MibScalarInstance( 41 | pysnmpUsmKeyType.name, (0,), 42 | pysnmpUsmKeyType.syntax 43 | ) 44 | 45 | 46 | mibBuilder.exportSymbols( 47 | "__PYSNMP-USM-MIB", 48 | pysnmpUsmDiscoverable=_pysnmpUsmDiscoverable, 49 | pysnmpUsmDiscovery=_pysnmpUsmDiscovery, 50 | pysnmpUsmKeyType = _pysnmpUsmKeyType 51 | ) 52 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/instances/__SNMP-MPD-MIB.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # This file instantiates some of the MIB managed objects for SNMP engine use 8 | # 9 | 10 | if 'mibBuilder' not in globals(): 11 | import sys 12 | 13 | sys.stderr.write(__doc__) 14 | sys.exit(1) 15 | 16 | MibScalarInstance, = mibBuilder.importSymbols( 17 | 'SNMPv2-SMI', 18 | 'MibScalarInstance' 19 | ) 20 | 21 | (snmpUnknownSecurityModels, 22 | snmpInvalidMsgs, 23 | snmpUnknownPDUHandlers) = mibBuilder.importSymbols( 24 | 'SNMP-MPD-MIB', 25 | 'snmpUnknownSecurityModels', 26 | 'snmpInvalidMsgs', 27 | 'snmpUnknownPDUHandlers', 28 | ) 29 | 30 | _snmpUnknownSecurityModels = MibScalarInstance( 31 | snmpUnknownSecurityModels.name, (0,), 32 | snmpUnknownSecurityModels.syntax.clone(0) 33 | ) 34 | _snmpInvalidMsgs = MibScalarInstance( 35 | snmpInvalidMsgs.name, (0,), 36 | snmpInvalidMsgs.syntax.clone(0) 37 | ) 38 | _snmpUnknownPDUHandlers = MibScalarInstance( 39 | snmpUnknownPDUHandlers.name, (0,), 40 | snmpUnknownPDUHandlers.syntax.clone(0) 41 | ) 42 | 43 | mibBuilder.exportSymbols( 44 | '__SNMP-MPD-MIB', 45 | snmpUnknownSecurityModels=_snmpUnknownSecurityModels, 46 | snmpInvalidMsgs=_snmpInvalidMsgs, 47 | snmpUnknownPDUHandlers=_snmpUnknownPDUHandlers 48 | ) 49 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/instances/__SNMP-TARGET-MIB.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # This file instantiates some of the MIB managed objects for SNMP engine use 8 | # 9 | 10 | if 'mibBuilder' not in globals(): 11 | import sys 12 | 13 | sys.stderr.write(__doc__) 14 | sys.exit(1) 15 | 16 | MibScalarInstance, = mibBuilder.importSymbols( 17 | 'SNMPv2-SMI', 18 | 'MibScalarInstance' 19 | ) 20 | 21 | (snmpTargetSpinLock, 22 | snmpUnavailableContexts, 23 | snmpUnknownContexts) = mibBuilder.importSymbols( 24 | 'SNMP-TARGET-MIB', 25 | 'snmpTargetSpinLock', 26 | 'snmpUnavailableContexts', 27 | 'snmpUnknownContexts' 28 | ) 29 | 30 | _snmpTargetSpinLock = MibScalarInstance( 31 | snmpTargetSpinLock.name, (0,), 32 | snmpTargetSpinLock.syntax.clone(0) 33 | ) 34 | _snmpUnavailableContexts = MibScalarInstance( 35 | snmpUnavailableContexts.name, (0,), 36 | snmpUnavailableContexts.syntax.clone(0) 37 | ) 38 | _snmpUnknownContexts = MibScalarInstance( 39 | snmpUnknownContexts.name, (0,), 40 | snmpUnknownContexts.syntax.clone(0) 41 | ) 42 | 43 | mibBuilder.exportSymbols( 44 | '__SNMP-TARGET-MIB', 45 | snmpTargetSpinLock=_snmpTargetSpinLock, 46 | snmpUnavailableContexts=_snmpUnavailableContexts, 47 | snmpUnknownContexts=_snmpUnknownContexts 48 | ) 49 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/instances/__SNMP-VIEW-BASED-ACM-MIB.py: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of pysnmp software. 3 | # 4 | # Copyright (c) 2005-2019, Ilya Etingof 5 | # License: http://snmplabs.com/pysnmp/license.html 6 | # 7 | # This file instantiates some of the MIB managed objects for SNMP engine use 8 | # 9 | 10 | if 'mibBuilder' not in globals(): 11 | import sys 12 | 13 | sys.stderr.write(__doc__) 14 | sys.exit(1) 15 | 16 | MibScalarInstance, = mibBuilder.importSymbols( 17 | 'SNMPv2-SMI', 18 | 'MibScalarInstance' 19 | ) 20 | 21 | vacmViewSpinLock, = mibBuilder.importSymbols( 22 | 'SNMP-VIEW-BASED-ACM-MIB', 23 | 'vacmViewSpinLock' 24 | ) 25 | 26 | _vacmViewSpinLock = MibScalarInstance( 27 | vacmViewSpinLock.name, (0,), 28 | vacmViewSpinLock.syntax 29 | ) 30 | 31 | mibBuilder.exportSymbols( 32 | "__SNMP-VIEW-BASED-ACM-MIB", 33 | vacmViewSpinLock=_vacmViewSpinLock 34 | ) 35 | -------------------------------------------------------------------------------- /pysnmp/smi/mibs/instances/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is necessary to make this directory a package. 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pysmi 2 | pyasn1>=0.2.3 3 | ordereddict; python_version < '2.7' 4 | -------------------------------------------------------------------------------- /runtests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | PYTHON=${1:-python} 6 | 7 | for x in examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/*.py \ 8 | examples/hlapi/v3arch/asyncore/sync/agent/ntforg/*.py \ 9 | examples/hlapi/v3arch/asyncore/manager/cmdgen/*.py \ 10 | examples/hlapi/v3arch/asyncore/agent/ntforg/*.py \ 11 | examples/hlapi/v3arch/asyncio/manager/cmdgen/*.py \ 12 | examples/hlapi/v3arch/asyncio/agent/ntforg/*.py \ 13 | examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/*.py \ 14 | examples/hlapi/v1arch/asyncore/sync/agent/ntforg/*.py \ 15 | examples/hlapi/v1arch/asyncore/manager/cmdgen/*.py \ 16 | examples/hlapi/v1arch/asyncore/agent/ntforg/*.py \ 17 | examples/hlapi/v1arch/asyncio/manager/cmdgen/*.py \ 18 | examples/hlapi/v1arch/asyncio/agent/ntforg/*.py \ 19 | examples/v3arch/asyncore/manager/cmdgen/*.py \ 20 | examples/v3arch/asyncore/agent/ntforg/*.py \ 21 | examples/v1arch/asyncore/manager/cmdgen/*.py \ 22 | examples/v1arch/asyncore/agent/ntforg/*.py \ 23 | examples/smi/manager/*py \ 24 | examples/smi/agent/*.py 25 | do 26 | case "${PYTHON}-${x}" in 27 | *spoof*|*ipv6*|python2*asyncio*|python3.[0-2]*asyncio*|*broadcast*) 28 | echo "skipping ${x}" 29 | continue 30 | ;; 31 | *) 32 | $PYTHON "${x}" | tail -50 33 | ;; 34 | esac 35 | done 36 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal = 1 3 | 4 | [metadata] 5 | license_file = LICENSE.rst 6 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [envlist] 2 | envlist = py{26,27,33,34,35,36,37,38} 3 | 4 | [testenv] 5 | commands = {toxinidir}/runtests.sh {envpython} 6 | --------------------------------------------------------------------------------