配置snmp:
vim /etc/snmp/snmpd.conf
更改 1com2sec notConfigUser  default       public
       改为:com2sec notConfigUser   127.0.0.1       public
       2 access  notConfigGroup ""      any       noauth    exact  systemview  none none
       改为:access  notConfigGroup ""      any       noauth    exact  all  none  none
       3 #view all    included  .1         80
       将前面的 # 注释 去掉。
保存退出 :wq
service snmpd restart
tar zxvf rrdtool-1.3.9.tar.gz
cd rrdtool-1.3.9
./configure --prefix=/user/web/rrdtool --disable-tcl --disable-python
Make
make install
cd ../
ln -s /user/web/rrdtool/bin/rrdtool  /usr/bin/rrdtool
ln -s /user/web/rrdtool/bin/rrdupdate /usr/bin/rrdupdate
ln -s /user/web/rrdtool/bin/rrdcgi /usr/bin/rrdcgi
cd /user/soft
tar zxvf cacti-0.8.7d-cn-utf8.gz
mv cacti-0.8.7d-cn-utf8 /user/web/html/cacti
/user/web/mysql/bin/mysql -uroot -pJackHuang2009
登入执行:
create database cacti;
退出执行:
/user/web/mysql/bin/mysql -uroot -pJackHuang2009 cacti < /user/web/html/cacti/cacti.sql
chown -R nginx:nginx /user/web/html/cacti
chmod -R 777 /user/web/html/cacti/rra
chmod -R 777 /user/web/html/cacti/log
vim /user/web/html/cacti/include/config.php
填写自己设置的连接数据库的帐户密码
 
加入
crontab -u root -e
*/5 * * * * /user/web/php/bin/php /user/web/html/cacti/poller.php > /dev/null 2>&1

3.4 cacti监控nginx服务

nginx 编译时允许http_stub_status_module
conf文件添加如下:
# vi /user/web/nginx/conf/nginx.conf
location /nginx_status {
stub_status on;
access_log off;
}
重启动
killall nginx
/user/web/nginx/sbin/nginx
tar zxvf cacti-nginx.tar.gz
cp cacti-nginx/get_nginx_socket_status.pl /user/web/html/cacti/scripts/
cp cacti-nginx/get_nginx_clients_status.pl /user/web/html/cacti/scripts/
chmod 755 /user/web/html/cacti/scripts/get_nginx*
cacti管理面板导入:
cacti_graph_template_nginx_clients_stat.xml
cacti_graph_template_nginx_sockets_stat.xml
检测插件:
/user/web/html/cacti/scripts/get_nginx_clients_status.pl http://127.0.0.1/nginx_status

3.5 cacti监控apache服务

Apache Server Status的启用
Apache的状态管理的模块是LoadModule status_module modules/mod_status.so,所以这个需要有
然后打开下面的配置
ExtendedStatus On
配置Apache Server Status的权限
<location /server-status>
         SetHandler server-status
         Order Deny,Allow
         Allow from 127.0.0.1
</location>