2019-03-18 Cacti 通过SNMP监控CentOS主机

1、首先在CentOS上安装SNMP及需要的组件

[root@aksnail axing]# yum install -y net-snmp lm_sensors net-snmp-utils 
[root@aksnail axing]# service snmpd start
[root@aksnail axing]# systemctl enable snmpd.service

2、更改snmpd配置文件

vim /etc/snmp/snmpd.conf

主要以下几点:
2.1 通讯字串(密码)

com2sec notConfigUser  default       <你的密码>

2.2 大约在55行左右,改成

# Make at least  snmpwalk -v 1 localhost -c public system fast again.
#       name           incl/excl     subtree         mask(optional)
view    systemview    included   .1
view    systemview    included   .1.3.6.1.2.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
view    systemview    included   .1.3.6.1.2.1.2

2.3 约84行左右,改成

  ##           incl/excl subtree                          mask
  view all    included  .1                               80
  ## -or just the mib2 tree-
  view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc

2.4 约 152行,改成

152 access  notConfigGroup ""      any       noauth    exact  all none none

2.5 约163行,改成主机地址和你的邮箱

syslocation <你的主机地址> (edit /etc/snmp/snmpd.conf)
syscontact Root [email protected] (configure /etc/snmp/snmp.local.conf)

2.6 重启SNMP

systemctl restart snmpd

3、添加防火墙规则,默认防火墙是打开的,允许远程snmp访问端口161/udp

firewall-cmd --zone=public --add-port=161/udp --permanent
firewall-cmd --reload

4、在Cacti上添加主机
导航菜单Console -> Management -> Devices ,右上角添加主机。Hostname处填主机IP地址,或者域名(如果有翻译),Device Template选Net-SNMP Device,其他就没什么了。


2019-03-18 Cacti 通过SNMP监控CentOS主机_第1张图片

4.1 添加监控网卡流量
添加完成后,在主机界面可以看到SNMP查询的一些信息,其他通用操作就不多写了,想监控网卡流量的话,就在设备标签页点击右上角Create Graph for this Device,选择Graph Type为 SNMP - Interface Statistics 即可。


2019-03-18 Cacti 通过SNMP监控CentOS主机_第2张图片
屏幕快照 2019-03-17 02.10.37.png

你可能感兴趣的:(2019-03-18 Cacti 通过SNMP监控CentOS主机)