客户端配置snmpd

[root@ localhost]#yum install net-snmp
 
(3)安装后打开默认的/etc/snmp/snmpd.conf文件,更改如下配置:

1) 查找以下代码:

# sec.name        source                                        community
com2sec                notConfigUser                default        public
将"comunity"字段改为你要设置的密码.比如"public"
将“default”改为你想哪台机器可以看到你的snmp信息

修改后:com2sec notConfigUser  server端ip地址      public

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  systemview none none
将"systemview"字段改为all.

修改后:access  notConfigGroup ""  any   noauth  exact  all none none

3) 查找以下代码:

#view all    included  .1    80

将该行前面的"#"去掉.

保存关闭.

4) 运行/etc/init.d/snmpd start命令运行snmpd.或 service snmpd start.

5) 如果有防火墙,打开UDP 161端口。

最后运行netstat -ln查看161端口是否打开了.

使用ntsysv,让snmp服务,每次开机自动运行。
  
排错
  
在cacti 监控管理工作站上

1. 首先检查一下rra/下面,有没有数据

2. snmpwalk -v 2c -c public ServerIP if 用来测试被控对象(serverIP)是否开启了SNMP服务

3. snmpwalk -v 2c ServerIP -c public .1.3.6.1.4.1.2021.10.1.3 查看被控端是否有CPU负载的数据返回

4. php /var/www/html/poller.php 用来测试PHP是否可以采集到数据。

原文地址:https://www.cnblogs.com/seasonsstory/p/3216880.html