上一篇基本完成了cacti的安装,下面我们继续完善cacti配置监控 :

7. 字体在图形中显示不正常的解决方法

下载并安装cjkuni-fonts中文字体

 yum groupinstall chinese-support

安装完成后注意在"设置"中更改下面两个必改项. 
(1. 常规->RRDTool应用程序版本 改为1.2.x,默认为1.0.x.不改可能图像不能正常显示出来. 

8. 被监控主机snmp文件设置

打开被监控的服务器,我们来做一些必需要修改的 snmp 配置.(谢谢网友园园的提醒)

vim /etc/snmp/snmpd.conf

1) 查找以下代码: 

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

修改后:com2sec notConfigUser   192.168.0.8       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 
将"read"字段改为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服务,每次开机自动运行。  

 9.测试snmp是否正常

snmpwalk -c public -v 2c localhost

#  or 

snmpwalk -1 -c public localhost IP-MIB::ipAdEntIfIndex

 会显示输出如下:

IP-MIB::ipAdEntIfIndex.61.xxx.xxx.xxx = INTEGER: 2 IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1 IP-MIB::ipAdEntIfIndex.172.xxx.xxx.xxx = INTEGER: 3

也可以用snmpd -f -Le 命令查看当前有没有出什么错

 

FQA:

1. 如果磁盘监控不到

请使用Cacti 中自带的模板 ucd/net – Get Monitored Partitions ,然后在被监控的机器的snmpd.conf(/etc/snmp/snmpd.conf)中加入 

disk / (比如我们监视根分区)

然后可以用

这个命令来检查

2. 如果图出不来.显示的是 X
这时,有二个可能,见如下,一个个来检查吧
(1.  检查你的主机是不是活的,一定要能测试通过,状态是活的才行,可以用命令来检查是否有输出
(2.  另外 cacti 默认选择的 rrdtool 的版本是 RRDTool 1.1.x  的!需要修改成 1.2 才能显示
点击 Console-> System Utilities -> Technical Support -> RRDTool Version 选择 RRDTool 1.2.x,不然有可能出不了图.

3.网卡流量达到100M以上图像有问题?
这与snmp的版本有关,snmp1的数据是32位而snmp2c以上是64(AS4默认是不支持64位的)

(1.首先要确定你使用的是snmp2c或以上,是否支持64MIB.如下如果返回的有几行含有“Counter64:”的话.那么表明是支持的。

1

2

3

4

5

#snmpwalk -c public -v 2c localhost IF-MIB::ifHCInOctets

IF-MIB::ifHCInOctets.1 = Counter64: 3174458

IF-MIB::ifHCInOctets.2 = Counter64: 1585772167

IF-MIB::ifHCInOctets.3 = Counter64: 35696997927

IF-MIB::ifHCInOctets.4 = Counter64: 0

2.然后点击Cacti的页面:“Console ->; Create New Graphs ->;Data Query”。你在下面看到“Select a graph type:”的下拉菜单(默认是“In/Out bits”),要取64bits的数据所以将其改为“In/Out bits(64-bit Counters)”,然后选择你要监测的网卡即可。另外,该监测点的“Maximum Value”必须设置为100M以上。

3.设备管理中,选择的主机中的SNMP版本,一定要是2.