CentOS7下安装SNMP服务

发布时间 2023-11-22 17:12:20作者: xl4ng

1、安装SNMP服务

yum install net-snmp net-snmp-utils

2、启动SNMP服务

systemctl start snmpd.service

3、设置SNMP服务开机自启

systemctl enable snmpd.service

4、更改团体名

vi /etc/snmp/snmpd.conf
####
# First, map the community name "public" into a "security name"

#       sec.name  source          community
com2sec notConfigUser  default       public

####
# Second, map the security name into a group name:

#       groupName      securityModel securityName
#group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser

image

5、重启SNMP服务

systemctl restart snmpd.service

6、测试

snmpwalk -v 2c -c public 127.0.0.1

7、防火墙放行

firewall-cmd --list-ports  #查看当前开放的端口
firewall-cmd --permanent --zone=public --add-port=161/udp  #防火墙添加开放161 udp端口
firewall-cmd --reload     #重新加载配置