运维笔记-snmp的安装配置

时间:2022-06-17 02:51:25

刚刚上的新项目,在部署服务器时需要开启snmp服务供监控机采集数据进行监控。要求如下:

1、指定采集机和另一台机器来采集数据

2、指定团体名,且为只读


配置如下:(红色为修改的地方)

1、
# sec.name source  community
com2sec notConfigUser default public
将“comunity”字段改为要设置的密码,也就是团体名(不能使用符号,会出错)
将“default”改为授权访问的ip

2、
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact all none none

3、
## incl/excl subtree mask
view all included .1 80      去掉注释

4、
# 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
view all included .1    添加

5、
## -or just the mib2 tree-
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc  去掉注释


测试:
snmpwalk -v 2c -c public serverIP if
public为团体名,serverIP为被监控主机ip,if为查看端口信息