Python 开发环境搭建(5):SNMP
发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,使用的系统为Redhat 7.6 的64位,使用Net-SNMP 5.7版本安装mysql包rpm -ivh mysql-community-libs-compat*不安装这个包会出现如下报错安装cd
千家信息网最后更新 2026年11月01日Python 开发环境搭建(5):SNMP
使用的系统为Redhat 7.6 的64位,使用Net-SNMP 5.7版本
安装mysql包
rpm -ivh mysql-community-libs-compat*
不安装这个包会出现如下报错
安装
cd /mnt/Packagesrpm -ivh net-snmpyum install -y net-snmp-perlyum install -y net-snmp-utilsyum install -y net-snmp-develyum install -y net-snmp-lib
验证
可以使用下面的命令去验证你是否成功安装了Net-SNMP,如果你可以获取到正确的版本号,说明你已经成功安装了Net-SNMP
snmpget --version
配置snmpd.conf
vi /etc/snmp/snmpd.conf################################################################################ Access Control################################################################################ First, map the community name "public" into a "security name"# sec.name source communitycom2sec notConfigUser default public# Second, map the security name into a group name:# groupName securityModel securityNamegroup notConfigGroup v1 notConfigUsergroup notConfigGroup v2c notConfigUser# Third, create a view for us to let the group have rights to:# Make at least snmpwalk -v 1 localhost -c public system fast again.# name incl/excl subtree mask(optional)#view systemview included .1.3.6.1.2.1.1#view systemview included .1.3.6.1.2.1.25.1.1# Finally, grant the group read-only access to the systemview view.# group context sec.model sec.level prefix read write notifaccess notConfigGroup "" any noauth exact all none none# -----------------------------------------------------------------------------# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.## incl/excl subtree maskview all included .1 80################################################################################ System contact information## It is also possible to set the sysContact and sysLocation system# variables through the snmpd.conf file:syslocation Unknown (edit /etc/snmp/snmpd.conf)syscontact Root
(configure /etc/snmp/snmp.local.conf)################################################################################ Logging## We do not want annoying "Connection from UDP: " messages in syslog.# If the following option is commented out, snmpd will print each incoming# connection, which can be useful for debugging.dontLogTCPWrappersConnects yes###############################################################################com2sec notConfigUser localhost Server_pu 运行snmpd 且开机自启动
chkconfig snmpd onsystemctl start snmp
可通过如下命令检查snmpd是否启动
netstat -na | grep 161
或
ps aux | grep snmp测试snmpd
可以用如下的几个命令获取系统开机时间,如果有正确的返回则说明snmp运行正常
snmpwalk -v 2c -c public localhost sysUpTime.0
配置python获取netsnmp
pip install client
pip install python3-netsnmp
命令
成功
版本
系统
运行
配置
验证
时间
面的
可通
检查
测试
环境
开发
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网科技企业
金融科技还是互联网
唐信互联网科技
凡科互联网科技
科技互联网创业计划书
衡水科技产业互联网平台
互联网和高科技公司
岳阳华臻互联网科技有限公司
互联网与医疗科技
想开互联网科技公司怎么样
深圳艾果互联网通讯科技
四川慕妮娅互联网科技有限公司
互联网科技如何创业
伊宁互联网科技做什么的
山东有哪些互联网科技公司
上海科技产业互联网平台
浙南科技城互联网大厦招聘
世界互联网科技成果奖
网互联网络科技
科技发展第三阶段互联网时代
百单网互联网科技有限公司
互联网科技金融
福州新华互联网科技学校 知乎
科技互联网大厂
武汉健翔互联网络科技有限公司
群盈汇互联网科技有限公司
雨阳互联网卡科技有限公司
杭州融税互联网科技有限公司
安徽九吞吴互联网科技有限公司
广东猫王互联网科技有限公司电话