1 Star 0 Fork 45

北冥有鱼在飞/qytang_Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
2016.04.02 snmpv2 set 610 Bytes
一键复制 编辑 原始数据 按行查看 历史
现任明教教主-乾颐堂 提交于 2016-04-02 08:09 . new file
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.proto import rfc1902
cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorindex, varBinds = cmdGen.setCmd(
cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('192.168.1.3',161)),
('1.3.6.1.2.1.1.5.0',rfc1902.OctetString('R333'))
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (
errorStatus.prettyPrint(),
errorindex and varBinds[int(errorindex)-1][0] or '?'
)
)
for name,val in varBinds:
print('%s = %s' % (name.prettyPrint(),val.prettyPrint()))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/grant5/qytang_Python.git
git@gitee.com:grant5/qytang_Python.git
grant5
qytang_Python
qytang_Python
master

搜索帮助