1、需要的软件包:
yum -y install httpd php php-mysql php-ldap php-xml net-snmp-utils
mysql mysql-server net-snmp crond rrdtool lm_sensors
rrdtool在RHEL5的光盘中不提供,需要用源码包
# yum install -y gcc gcc-c++ libart_lgpl-devel zlib-devel libpng-devel freetype-devel
# tar rrdtool-x.x.x.x.tar.gz -C /usr/src
# cd /usr/src/rrdtool-x.x.x
# ./configure --pefix=/usr/local
# make && make install
2、
# service mysqld start
# service httpd start
3、
# tar xvzf cacti-0.xxx.tar.gz
# cp cacti-0.xxx /var/www/html/cacti
4、
# useradd cactiuser
# chown -R cactiuser.cactiuser rra/ log/
5、
# mysql -uroot -p
mysql> create database cactidb default character set utf8;
mysql> grant all on cactidb.* to 'cactiuser'@'localhost' identified by 'cacti';
mysql> \q
导入cacti数据库的表
# mysql -ucactiuser -pcacti
mysql> source cacti.sql;
或
#mysql -ucactiuser -pcacti cactidb < cacti.sql
6、
# vim include/config.php
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";
7、http://192.168.20.1/cacti
根据向导完成安装,登陆的用户名和密码都是admin,登陆成功后,cacti强制更新密码。
被控机:
# vim /etc/snmp/snmpd.conf
com2sec notConfigUser 192.168.20.1 public
access那一行的systemview改成all
view all included .1取消注释
启动SNMP服务
# service snmpd start ; chkconfig snmpd on
在web页上点击devices,删除原有的localhost,点击右侧的add
添加新的主机。HOST template用ucd/net snmp host
Associated Data Queries添加以下的数据
SNMP - Get Mounted Partitions
SNMP - Get Processor Information
SNMP - Interface Statistics
保存save后,找到页面最上面的Create Graphs for this Host
把主机加入到图形树中
点击左侧的graph tree->default tree->点击右侧的add
tree item type选择host,然后点击create
产生数据
[root@localhost ~]# su - cactiuser
[runct@localhost ~]$ php /var/www/html/cacti/poller.php
[runct@localhost ~]$ crontab -e
*/1 * * * * /usr/bin/php /var/www/html/cacti/poller.php &> /dev/null
[runct@localhost ~]$ exit
[root@localhost ~]# service crond start
隔几分钟后,再点击web页的graph按钮就可以看到图形了
二、安装插件框架:
1、把插件解压内容复制到/var/www/html/cacti
# mv cacti-plugin-arch /var/www/html/cacti
2、# cd /var/www/html/cacti
# patch -p1 -N < cacti-plugin-arch/cacti-plugin.xxxx.diff
3、# mysql -ucactiuser -pcacti cactidb < pa.sql
4、# vim include/global.php 改用户名等
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";
5、# vim include/config.php 改访问路径
$url_path = "/cacti/";
6、WEB页面中左侧的用户管理(user management)->admin用户的权限(下面的realm permisson)加入PA
三、安装monitor、settings、thold插件
monitor:通过简单明了的图标提供服务器的运行状态
settings:给不同的插件提供一些共用的信息,如邮件信息,dns信息。
thold :提供设备异常预警。
1、直接把三个包解压到cacti/plugin目录
# tar xvzf settings-x.x.x.x.x.tar.gz
# mv settings monitor thold /var/www/html/cacti/plugins
2、WEB页面上可以直接查看到三个插件(在左侧plugin management),点击安装并启用
(先安装settings,在安装monitor和thold)
3、点击settings中的MISC设置监控图标及分组
4、点击settings中的mail/dns设置收发邮件地址
5、点击settings中的thold设置邮件内容
# yum install -y sendmail-cf
# cd /etc/mail
# vim sendmail.mc
把里面的127.0.0.1换成0.0.0.0
# m4 sendmail.mc > sendmail.cf
# echo localhost >> local-host-names
yum -y install httpd php php-mysql php-ldap php-xml net-snmp-utils
mysql mysql-server net-snmp crond rrdtool lm_sensors
rrdtool在RHEL5的光盘中不提供,需要用源码包
# yum install -y gcc gcc-c++ libart_lgpl-devel zlib-devel libpng-devel freetype-devel
# tar rrdtool-x.x.x.x.tar.gz -C /usr/src
# cd /usr/src/rrdtool-x.x.x
# ./configure --pefix=/usr/local
# make && make install
2、
# service mysqld start
# service httpd start
3、
# tar xvzf cacti-0.xxx.tar.gz
# cp cacti-0.xxx /var/www/html/cacti
4、
# useradd cactiuser
# chown -R cactiuser.cactiuser rra/ log/
5、
# mysql -uroot -p
mysql> create database cactidb default character set utf8;
mysql> grant all on cactidb.* to 'cactiuser'@'localhost' identified by 'cacti';
mysql> \q
导入cacti数据库的表
# mysql -ucactiuser -pcacti
mysql> source cacti.sql;
或
#mysql -ucactiuser -pcacti cactidb < cacti.sql
6、
# vim include/config.php
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";
7、http://192.168.20.1/cacti
根据向导完成安装,登陆的用户名和密码都是admin,登陆成功后,cacti强制更新密码。
被控机:
# vim /etc/snmp/snmpd.conf
com2sec notConfigUser 192.168.20.1 public
access那一行的systemview改成all
view all included .1取消注释
启动SNMP服务
# service snmpd start ; chkconfig snmpd on
在web页上点击devices,删除原有的localhost,点击右侧的add
添加新的主机。HOST template用ucd/net snmp host
Associated Data Queries添加以下的数据
SNMP - Get Mounted Partitions
SNMP - Get Processor Information
SNMP - Interface Statistics
保存save后,找到页面最上面的Create Graphs for this Host
把主机加入到图形树中
点击左侧的graph tree->default tree->点击右侧的add
tree item type选择host,然后点击create
产生数据
[root@localhost ~]# su - cactiuser
[runct@localhost ~]$ php /var/www/html/cacti/poller.php
[runct@localhost ~]$ crontab -e
*/1 * * * * /usr/bin/php /var/www/html/cacti/poller.php &> /dev/null
[runct@localhost ~]$ exit
[root@localhost ~]# service crond start
隔几分钟后,再点击web页的graph按钮就可以看到图形了
二、安装插件框架:
1、把插件解压内容复制到/var/www/html/cacti
# mv cacti-plugin-arch /var/www/html/cacti
2、# cd /var/www/html/cacti
# patch -p1 -N < cacti-plugin-arch/cacti-plugin.xxxx.diff
3、# mysql -ucactiuser -pcacti cactidb < pa.sql
4、# vim include/global.php 改用户名等
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";
5、# vim include/config.php 改访问路径
$url_path = "/cacti/";
6、WEB页面中左侧的用户管理(user management)->admin用户的权限(下面的realm permisson)加入PA
三、安装monitor、settings、thold插件
monitor:通过简单明了的图标提供服务器的运行状态
settings:给不同的插件提供一些共用的信息,如邮件信息,dns信息。
thold :提供设备异常预警。
1、直接把三个包解压到cacti/plugin目录
# tar xvzf settings-x.x.x.x.x.tar.gz
# mv settings monitor thold /var/www/html/cacti/plugins
2、WEB页面上可以直接查看到三个插件(在左侧plugin management),点击安装并启用
(先安装settings,在安装monitor和thold)
3、点击settings中的MISC设置监控图标及分组
4、点击settings中的mail/dns设置收发邮件地址
查看邮件:
[root@localhost cacti]# mail5、点击settings中的thold设置邮件内容
CACTI的报警功能:首先要配置收件人,再配置发件人,最后配置邮件内容。(此为形象说明)
# yum install -y sendmail-cf
# cd /etc/mail
# vim sendmail.mc
把里面的127.0.0.1换成0.0.0.0
# m4 sendmail.mc > sendmail.cf
# echo localhost >> local-host-names