Questions tagged [pysnmp]

PySNMP is a pure Python module used for SNMP operations.

PySNMP

PySNMP is a pure-Python module that can talk SNMPv1/v2/v3, automatically download and parse MIBs via pysmi and is designed with asynchronous applications in mind (e.g. asyncio).

Its source code spans over multiple GitHub repositories and you can get started from https://github.com/etingof/pysnmp

As the original project owner passed away, future ownership is to be determined. More details can be found in https://github.com/etingof/pysnmp/issues/429

477 questions
17
votes
1 answer

How to get data from SNMP with python?

How to get value mac and vlan from fdb table uses python? In bash snmpwalk work fine: snmpwalk -v2c -c pub 192.168.0.100 1.3.6.1.2.1.17.7.1.2.2.1.2 pysnmp: import os, sys import socket import random from struct import pack, unpack from datetime…
uralbash
  • 3,219
  • 5
  • 25
  • 45
8
votes
3 answers

Convert snmp octet string to human readable date format

Using the pysnmp framework i get some values doing a snmp walk. Unfortunately for the oid 1.3.6.1.21.69.1.5.8.1.2 (DOCS-CABLE-DEVICE-MIB) i get a weird result which i cant correctly print here since it contains ascii chars like BEL ACK When…
Michael Lang
  • 83
  • 1
  • 1
  • 3
7
votes
1 answer

How do I implement a custom MIB in PySNMP?

I already have the MIB text file (do I need to make this into a .py file somehow??). I am trying to use PySNMP (not net-snmp). I have been able to connect to my device and print out some info, but the info was not very helpful (just ObjectName,…
5
votes
1 answer

How can I check the data transfer on a network interface in python?

There is a socket method for getting the IP of a given network interface: import socket import fcntl import struct def get_ip_address(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( …
Matt Sweeney
  • 2,060
  • 1
  • 14
  • 19
5
votes
1 answer

problems with installation pycrypto in python 3.6

I've tried to install pysnmp (which uses pycrypto) on python 3.6.0 using pip, but I've got an error: Command ""c:\program files (x86)\python36-32\python.exe" -u -c "import setuptools, tokenize;file='C: …
5
votes
2 answers

Using pySNMP to write an SNMP agent (for OpenNMS)

I'm trying to write a python SNMP agent that I can embed within my python application so that the application can be monitored remotely by OpenNMS. OpenNMS expects the Agent to implement the HOST-RESOURCES-MIB querying two fields hrSWRunNameand…
Richard B
  • 895
  • 13
  • 39
5
votes
2 answers

Sending SNMP Traps containing custom data

A client has requested that instead of email alerts that we send SNMP Traps to their Nagios server instead. The only thing I knew about SNMP before yesterday was that it sounded like an acronym, so please excuse (and correct me on) any…
Matt
  • 1,377
  • 2
  • 13
  • 26
5
votes
1 answer

Listen traps with pysnmp

Hello I'm trying to listen for traps with this code from pysnmp doc: from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher from pysnmp.carrier.asynsock.dgram import udp, udp6 from pyasn1.codec.ber import decoder from pysnmp.proto import…
Drakorcarnis
  • 51
  • 1
  • 1
  • 3
5
votes
2 answers

PySNMP : ImportError: No module named pyasn1.compat.octets

I'm trying to use PySNMP on windows, but when I try to import cmdgen I see following Error: from pysnmp.entity.rfc3413.oneliner import cmdgen ImportError: No module named pyasn1.compat.octets How can I solve this error, I also don't touched…
Mahdi
  • 967
  • 4
  • 18
  • 34
5
votes
3 answers

SNMP Agent in Python

I required a SNMP agent in python, which listen on a particular port and and responds to basic SNMP command (like GTE, SET, GETNEXT ...etc) If any one have code please reply on this post.
aloksinghk
  • 101
  • 1
  • 2
  • 7
5
votes
1 answer

PySNMP can not recognize response

i am using the following simple script: from pysnmp.entity.rfc3413.oneliner import cmdgen errorIndication, errorStatus, errorIndex, \ varBindTable = cmdgen.CommandGenerator().bulkCmd( cmdgen.CommunityData('test-agent', 'public'), …
Alex Emelin
  • 814
  • 1
  • 9
  • 19
4
votes
2 answers

python net-snmp loading mibs

I'm using net-snmp's python libraries to do some long queries on various switches. I would like to be able to load new mibs -- but I cannot find any documentation on how to do this. PySNMP appears to be rather complicated and requires me to create…
yee379
  • 6,498
  • 10
  • 56
  • 101
4
votes
1 answer

Unpacking OctetString data into a variable for further processing

All - I am working with python and pysnmp to collect Cisco Discovery Protocol data via snmp. Since I am working with CDP, I am using the CISCO-CDP-MIB.my and the issues that I am facing are with unpacking the contents of cdpCacheCapabilities and…
adamz88
  • 319
  • 3
  • 12
4
votes
1 answer

snmpwalk with PySNMP

I’d like to reproduce the comportment of the following SNMP command : snmpwalk -v2c -cpublic 192.168.0.10 1.3.6.1.2.1.25.2.3.1.3 which gives me this output : iso.3.6.1.2.1.25.2.3.1.3.1 = STRING: "Physical memory" iso.3.6.1.2.1.25.2.3.1.3.3 =…
Stéphane
  • 425
  • 2
  • 7
  • 21
4
votes
1 answer

How to get SNMP data using pysnmp?

I want to get snmp data by using python pysnmp module. I was using command line to get SNMP data but now I want to read it using pysnmp module. SNMP command - snmpwalk -v 1 -c public : xyz::pqr I was using command like above. Now…
ketan
  • 2,732
  • 11
  • 34
  • 80
1
2 3
31 32