pysnmp

PySNMP Error: pysnmp.smi.error.SmiError

我是研究僧i 提交于 2019-12-14 03:56:51
问题 I am running a Python program on a Windows XP machine. When I run the program, I get the following error: File "C:\Python27\lib\pysnmp\smi\builder.pyt, line 230, in loadModules... pysnmp.smi.error.SmiError: MIB file "SNMPv2-MIB.py[co]" not found in search path The file SNMPv2-MIB.py is currently located in C:\Python27\Lib\pysnmp\smi\mibs . Does anyone know how I can solve this? 回答1: if a mib is missing make sure you have performed a pip install pysnmp-mibs first if you used pip install pysnmp

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

丶灬走出姿态 提交于 2019-12-13 13:13:02
问题 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 init .py Thank you 回答1: Make sure you have the latest pyasn1 package also installed on your system for the same Python version as pysnmp is installed. 回答2: I met with the same mistake. I copied the library from this link into the downloaded project

snmpv3 getone fails while trying via pysnmp (WrongValueError)

一世执手 提交于 2019-12-13 03:45:17
问题 while trying to run get one with pysnmp for snmpv3, getting below error pysnmp.smi.error.WrongValueError: WrongValueError({'msg': WrongValueError(), 'name': (1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 5, 24, 48, 48, 48, 48, 49, 100, 51, 98, 48, 48, 48, 48, 55, 53, 100, 49, 97, 99, 49, 48, 48, 49, 48, 49, 5, 107, 107, 48, 51, 48), 'idx': 3}) from pysnmp.hlapi import * errorIndication, errorStatus, errorIndex, varBinds = next( getCmd(SnmpEngine(), UsmUserData('USERNAME',authKey='AUTHKEY', privKey=

pysnmp.smi.error.MibNotFoundError: No module __SNMP-FRAMEWORK-MIB loaded at <pysnmp.smi.builder.MibBuilder object at 0x0418A110>

泪湿孤枕 提交于 2019-12-13 03:19:09
问题 I'm just starting out in Python so please bear with me. I've been trying to find a solution to this error for the last 3 days in google, Stack Overflow, Github, python.org and also snmplabs.com. I have progressed from other errors (thanks in part to the above websites) but this one has me stumped and I cannot seem to resolve it. I'm running the following versions of stuff: Windows 10 Enterprise 64-bit python 3.6, pysnmp 4.4.4, pyasn1 0.2.3 and I am using paramiko for ssh and tkinter as a GUI

How to make custom MIB PYSNMP

别说谁变了你拦得住时间么 提交于 2019-12-12 03:09:27
问题 Im newbie in SNMP, but I'm going to make some simple monitoring apps using SNMP and PYSNMP I want to monitor my agent with my custom MIB (because when i run some MIB, it can not work with PYSNMP), I've read PYSNMP documentation, but it seems can not help me, Can you show me , how to make custom MIB PYSNMP easyly? so i can use it both in manager and agent side :) Thank you thank you for your answer I've already read those tuts, but my mib still can not hit the target, I want read my Total Disk

How to get the value of OID in Python using PySnmp

夙愿已清 提交于 2019-12-11 14:56:41
问题 Using snmpwalk I can get this from my device: OID=.1.3.6.1.4.1.5296.1.9.1.1.1.7.115.101.99.99.97.57.27.1.41 Type=OctetString Value=secca99 I tried this program in Python to get the value field from above OID: #!/usr/bin/env python3 from pysnmp.hlapi import * import sys def walk(host, oid): for (errorIndication, errorStatus, errorIndex, varBinds) in nextCmd(SnmpEngine(), CommunityData('public'), UdpTransportTarget((host, 161)), ContextData(), ObjectType(ObjectIdentity(oid))): if

build-pysnmp-mib: convert cisco mib files to a python fails on Ubuntu 14.04

拈花ヽ惹草 提交于 2019-12-11 01:18:28
问题 I'm trying to convert some .my files from the cisco site to .py files to use with pysnmp application but each one is failing. ftp://ftp.cisco.com/pub/mibs/supportlists/wlc/wlc-supportlist.html I have already set my SMIPATH to the current directory with all my mibs. But i'm receiving the same error on each of the cisco mibs. root@testbox:/home/johnny# build-pysnmp-mib -o CISCO-CDP-MIB.py CISCO-CDP-MIB.my Segmentation fault (core dumped) Empty input smidump -k -f python CISCO-CDP-MIB.my | /usr

Using pySNMP to write an SNMP agent (for OpenNMS)

北城以北 提交于 2019-12-10 05:31:52
问题 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 hrSWRunName and hrSWRunStatus . I took a pysnmp example as the basis of my code and edited it as I believed necessary. The resulting code looks like this: import logging from pysnmp import debug from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity import

How to get SNMP data using pysnmp?

社会主义新天地 提交于 2019-12-07 16:59:27
问题 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 <ip address>:<port> xyz::pqr I was using command like above. Now I tried something like below - import netsnmp def getmac(): oid = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.2.1.17.7.1.2.2.1.2')) res = netsnmp.snmpgetbulk(oid, Version = 1, DestHost='ip', Community='pub') return res print getmac() I'm facing error

Listen traps with pysnmp

僤鯓⒐⒋嵵緔 提交于 2019-12-07 07:29:04
问题 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 api def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg): print('cbFun is called') while wholeMsg: print('loop...') msgVer = int(api.decodeMessageVersion(wholeMsg)) if msgVer in api.protoModules: pMod = api.protoModules[msgVer]