cacti安装与配置(转)。

一、准备所需要的软件包

Apache     http://www.apache.org/
Mysql      http://www.mysql.com/
Php        http://www.php.net
Rrdtool    http://oss.oetiker.ch/rrdtool/
Net-snmp   http://www.net-snmp.org/
Cacti      http://www.cacti.net/
其中apache、mysql、php通过yum安装
二、安装所需要的软件
1.安装LAMP
[[email protected] ~]# yum -y install httpd mysql-server php php-mysql mysql-devel
[[email protected] ~]# chkconfig httpd on
[[email protected] ~]# chkconfig mysqld on
[[email protected] ~]# /etc/init.d/httpd start
[[email protected] ~]# /etc/init.d/mysqld start
安装完成后,可通过以下程序测试
[[email protected] html]# cat inex.php
<?php
phpinfo();
?>
cacti安装与配置(转)。
2.安装rrdtool
Rrdtool安装需要cairo、libxml2、pango库支持,可通过yum安装
[[email protected] ~]# yum -y install cairo-devel libxml2-devel pango-devel
[[email protected] ~]# tar zxvf rrdtool-1.4.7.tar.tar
[[email protected] ~]# cd rrdtool-1.4.7
[[email protected] rrdtool-1.4.7]# ./configure --prefix=/usr/local/rrdtool
[[email protected] rrdtool-1.4.7]# make && make install
[[email protected] rrdtool-1.4.7]# ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
 
3.安装net-snmp
[[email protected] ~]# tar zxvf net-snmp-5.6.1.1.tar.gz
[[email protected] ~]# cd net-snmp-5.6.1.1
[[email protected] net-snmp-5.6.1.1]# ./configure --prefix=/usr/local/net-snmp
[[email protected] net-snmp-5.6.1.1]# make && make install
[[email protected] net-snmp-5.6.1.1]# cp EXAMPLE.conf /etc/snmpd.conf
[[email protected] ~]# ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
[[email protected] ~]# vim /etc/snmpd.conf
rocommunity public localhost #去掉注释
[[email protected] ~]# /usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf
加入开机启动
[[email protected] ~]# echo "/usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf " >>/etc/rc.local
 (这里可以通过yum安装net-snmp)
4.安装cacti
[[email protected] ~]# tar zxvf cacti-0.8.7i-PIA-3.1.tar.gz
[[email protected] ~]# mv cacti-0.8.7i-PIA-3.1/* /var/www/html/ (这里不是要拷贝到/var/www/html,而是要在html下建立一个cacti文件夹,然后把所有内容全部拷贝过去 cp -rf cacti-0.8.7i-PIA-3.1/* /var/www/html/cacti/)
#将cacti中的内容移到 web目录
[[email protected] ~]# chown -R apache:apache /var/www/html/
[[email protected] ~]# mysql -uroot 
#连接到mysql创建数据库
mysql> create database cacti;
#创建cacti数据库
mysql> insert into mysql.user(host,user,password) values ('localhost','cacti',password('cacti123'));
#建立用户cacti,密码cacti123
mysql> flush privileges;
#重载mysql授权表
mysql> grant all on cacti.* to [email protected]'localhost' identified by 'cacti123';
#把数据库cacti授权于用户cacti
[[email protected] ~]# cd /var/www/html/
[[email protected] html]# mysql -ucacti -pcacti123 cacti<cacti.sql #将cacti数据库导入
修改网站配置文件,使用正确连接数据库参数
[[email protected] html]# vim include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti123";
$database_port = "3306";
使用浏览器打开http://192.168.209.130/install/
会看到安装向导,点下两个NEXT之后,出现以下:
cacti安装与配置(转)。
cacti安装与配置(转)。
默认用户名和密码admin,第一次登录会要求更改密码
 
5.设置cacti数据采集轮询时间
[[email protected] ~]# crontab –e
*/5 * * * * env LANG=C /usr/bin/php /var/www/html/poller.php
 
三、常用插件安装
最新版本cacti-0.8.7i-PIA-3.1 集成了plugin架构扩展,所以可以直接开启后就可以安装其他插件
打开“Console”-----“User Management”---“admin”——“Realm Permissions”,选择以下后,单保存”save”
cacti安装与配置(转)。
之后会在“console”中的“Configuration”看到一个
cacti安装与配置(转)。
 
 
Monitor安装(以图形方式显示设备状态)
[[email protected] ~]# tar zxvf monitor-v1.3-1.tgz
[[email protected] ~]# mv monitor /var/www/html/plugins/
[[email protected] ~]# cd /var/www/html/plugins/monitor/
[[email protected] monitor]# mysql -ucacti –pcacti123 cacti&lt;monitor.sql
打开Cacti的web页面“Plugin Management”**插件
cacti安装与配置(转)。
 
Setting安装(用于邮件报警)
[[email protected] ~]# tar zxvf settings-v0.71-1.tgz
[[email protected] ~]# mv settings /var/www/html/plugins
打开Cacti的web页面“Plugin Management”**插件
cacti安装与配置(转)。
打开“console”-----“Settings”可以找到以下
cacti安装与配置(转)。
 
Thold安装(用于设备异常预警、阀值报警)
[[email protected] ~]# tar zxvf thold-v0.4.9-3.tgz
[[email protected] ~]# mv thold /var/www/html/plugins/
打开Cacti的web页面“Plugin Management”**插件
cacti安装与配置(转)。
 
Cacti轮询时间
Cacti默认的轮询时间为5分钟,可通过安装spine将时间变成一分钟
下载:http://cacti.net/spine_download.php
1.安装spine
[[email protected] ~]# tar zxvf cacti-spine-0.8.7i.tar.gz
[[email protected] ~]# cd cacti-spine-0.8.7i
[[email protected] cacti-spine-0.8.7i]# ./configure --prefix=/usr/local/cacti-spine --with-snmp=/usr/local/net-snmp/
[[email protected] cacti-spine-0.8.7i]# make && make install
[[email protected] cacti-spine-0.8.7i]# cd /usr/local/cacti-spine/etc/
[[email protected] etc]# cp spine.conf.dist spine.conf
[[email protected] etc]# vim spine.conf
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass cacti123
DB_Port 3306
DB_PreG 0
这里修改对应的mysql用户名和密码,以及连接参数
打开“console”----“settings”----“Paths” 中填写spine的路径,然后“save”
cacti安装与配置(转)。
2.选择轮询模式
打开“console”----“settings”----“Poller”---“save”
cacti安装与配置(转)。
添加“每分钟”流量视图
打开“console”---“Data Templates”——“Interface - Traffic”
cacti安装与配置(转)。
cacti安装与配置(转)。
其他模板做相应修改。
最后修改crontab中的

* * * * * env LANG=C /usr/bin/php /var/www/html/poller.php>/dev/null 2>&1

 

 

 from: http://liyaoyi.blog.51cto.com/442933/846891

转载于:https://www.cnblogs.com/nathaninchina/articles/2783097.html