系统环境:CentOS 5.6 X86
1、安装系统支持cacti的必备环境
#vi /etc/selinux/config
SELINUX=disabled
#setenforce 0
#yum -y install httpd php php-mysql mysql mysql-server net-snmp-utils libpng freetype libart-lgpl
#rpm -Uvh
#yum -y install rrdtool rrdtool-perl
#/etc/rc.d/init.d/mysqld start
#chkconfig mysqld on
#/etc/rc.d/init.d/httpd start
#chkconfig httpd on
2、下载和安装cacti
#wget
#tar xvfz cacti-0.8.7g.tar.gz -C /var/www/html
#cd /var/www/html
#mv cacti-0.8.7g cacti
3、配置mysql数据库
#useradd cacti
#mysql
mysql>create database cacti;
mysql>GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';
mysql>flush privileges;
mysql>exit;
#cd /var/www/html/cacti
#vi cacti.sql(第四行添加如下)
use cacti;
4、配置cacti
#cd /var/www/html/cacti
#vi include/config.php
(将$database_password的密码改为与上面授权的密码一致即可)
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
5、设置cacti数据存储目录权限
#cd /var/www/html/cacti
#chown –R cacti rra/ log/
6、Cacti数据采集,设定任务计划
先创建一个脚本
#mkdir /etc/script
#vi /etc/script/poller.sh
#!/bin/bash
php /var/www/html/cacti/poller.php > /dev/null 2>&1
#chmod 755 /etc/script/poller.sh
#crontab -e
*/5 * * * * su - cacti -c /etc/script/poller.sh
#/etc/init.d/crond reload
7、开始配置cacti,在浏览器打开
默认用户名及密码都是admin
8、使cacti支持syslog集中日志管理及报警等
#yum -y install librelp librelp-devel rsyslog rsyslog-gnutls rsyslog-mysql
[root@syslogd etc]# mysql -uroot -p
mysql> create database syslog;
mysql> GRANT ALL ON syslog.* TO cacti@localhost IDENTIFIED BY 'cacti';
mysql> flush privileges;
# vi /etc/rsyslog.conf
# provides UDP syslog reception
$ModLoad imudp
# start a UDP syslog server at standard port 514
$UDPServerRun 514
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
# Provides support for local system logging (e.g. via logger command)
$ModLoad imuxsock
# provides --MARK-- message capability
$ModLoad immark
# provides UDP syslog reception
$ModLoad imudp
# provides TCP syslog reception and GSS-API (if compiled to support it)
$ModLoad imtcp
# provides mysql
$ModLoad ommysql
# Use costomer timestamp format
$template cacti_syslog,"INSERT INTO syslog_incoming(facility, priority, date, time, host, message) values (%syslogfacility%, %syslogpriority%, '%timereported:::date-mysql%', '%timereported:::date-mysql%', '%HOSTNAME%', '%msg%')", SQL
# Insert the log's text into the Syslog database by the costomer timestamp format of the cacti_syslog template
*.* :ommysql:localhost,Syslog,cacti,cacti;cacti_syslog
# chkconfig rsyslog on
# /etc/init.d//syslog restart
#wget
#tar zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
#cp -R cacti-plugin-arch/* /var/www/html/cacti
#cd /var/www/html/cacti
#mysql -ucacti -pcacti cacti < /var/www/html/cacti/pa.sql
#yum install -y patch
#patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff
# wget -O settings.tar.gz
# wget -O thold.tar.gz
# wget -O monitor.tar.gz
# wget -O syslog.tar.gz
# tar zxvf syslog.tar.gz
# tar -zxvf settings.tar.gz
# tar -zxvf monitor.tar.gz
# tar -zxvf thold.tar.gz
# mv syslog /var/www/html/cacti/plugins/syslog
# mv settings /var/www/html/cacti/plugins/settings
# mv monitor /var/www/html/cacti/plugins/monitor
# mv thold /var/www/html/cacti/plugins/thold
# mysql -ucacti -pcacti cacti
#cd /var/www/html/cacti/plugins/syslog
# vi config.php
$syslogdb_type = 'mysql';
$syslogdb_default = 'syslog';
$syslogdb_hostname = 'localhost';
$syslogdb_username = 'cacti';
$syslogdb_password = 'cacti';
$syslogdb_port = 3306;
# mysql -uroot -p syslog
授权admin用户使用”plugin Management”:
登录后,Utilities–User Management–admin–Realm Permissions,勾选 Plugin Managerment项
Configuration->Plugin Managerment,Install and Avtive所有插件
这样,所有插件都安装并激活了,插件被安装好后就可以在Configuration->Settings进行配置了,可以填上邮件服务器的地址等信息,设置throld报警参数等。
到plugin management下开启相关插件服务
9、配置过程中,发现有配置好的Cacti及相关插件的CactiEZ软体出现(参照),更是有中文版CactiEZ V10,这个就方便多了,不用搞这么多麻烦配置出来。
10、用CactiEZ几天后,发现一个叫“Kiwi Syslog Daemon”的Syslog软件也不错(后来被SolarWinds给收购了),基本Win Server的环境,收集CISCO及Juniper的日志也不含糊。
参照:http://skyou.blog.51cto.com/2915693/541686
阅读(2289) | 评论(0) | 转发(1) |