废话不多说直接正题
主机规划
lo-cacti1:10.5.10.200
linux-www1:10.5.10.55
linux-www2:10.5.10.54
win7:10.5.10.45
上传/下载包仓库 /data0/software
步骤如下可参看 FAQ
lo-cacti1 配置
#yum install -y httpd mysql mysql-devel mysql-server php php-xml php-mysql php-ldap net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
#/etc/init.d/httpd start (访问10.5.10.200 看到apache测试页)
#/etc/init.d/mysqld start
将服务加入开机自启动
#chkconfig --level 35 httpd on
#chkconfig mysqld on
#chkconfig snmpd on
配置php.ini
#vi /etc/php.ini 修改时区为
data.timezone = Asia/Shanghai
测试php
#cat /var/www/html/index.php
phpinfo();
?>
再次访问10.5.10.200/index.php 可以看到php的测试页及支持的相关模块
配置httpd
#cat /etc/httpd/conf.d/cacti.conf
Alias /cacti /var/www/html
DirectoryIndex index.php
Options-Indexs
AllowOverride all
order deny,allow
allow from all
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on
#/etc/init.d/httpd restart
安装rrdtool
安装rrdtool 所需的库
#yum install -y cairo-devel libxml-devel libxml2-devel pango-devel
#tar xvf rrdtool-1.4.7.tar.gz;cd rrdtool-1.4.7;./configure --prefix=/usr/local/rrdtool;make &&make install
#ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
简单配置snmp
#cat /etc/snmp/snmp.conf
定位到41行修改为
#sec.namesourcecommunity
com2secnotConfigure127.0.0.1public
62行修改为
#groupcontextsec.modelsec.levelprefixreadwrite notif
accessnotConfigGroup ""any noauthexact allnonenone
86行修改为
##incl/exclsubtreemask
viewallincluded.180
#service snmpd restart
安装cacti
#tar xvf cacti-0.8.8b.tar.gz;mv cacti-0.8.8b/* /var/www/html/
#chown -R apache.apache /var/www/html
创建cacti数据库
#mysql
>create database cacti;
>insert into mysql.user(host,user,password) values ('localhost','cacti',password('cacti123'));
>flush privileges;
>grant all on cacti.* to cacti@'localhost' identified by 'cacti123';
>\q
导入cacti.sql
#cd /var/www/html;mysql -ucacti -pcacti123 cacti
修改网站配置文件,使用正确连接数据库参数
#vi include/config.php 末尾几行
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti123";
$database_port = "3306";
开始安装cacti 浏览器打开http:10.5.10.100/install
wKiom1MBCYrwQ1tEAAHlsvb-gqg614.jpg
note:Cacti Installation Guide 编译安装的需要确认以下路径全部被found
rrdtool binary path
php binary path
snmpwalk binary path
snmpget binary path
snmpbulkwalk binary path
snmpgetnext binary path
cacti log file path
"finish" -> 进入登陆界面(首次登陆用户名密码都是admin)cacti第一次登陆后会强制更改密码(如报错错/cacti/auth_changepassword.php was not found on this serve) 则须按照上述httpd配置添加/etc/httpd/conf.d/cacti.conf配置文件
cacti全局配置
console ->settings ->General-save
wKioL1MBDVSCpoV7AAPz7P5WdIY028.jpg
crontab 计划任务
#crontab -e
*/5 * * * * env LANG=C /usr/bin/php /var/www/html/poller.php > /dev/null 2>&1
然后转到Graph,tree下面就可以看到localhost的监控图(默认监控localhost),类似如下图
wKiom1MBD82DzU2CAAKxYOeFxSU722.jpg
这篇就先记录下cacti的安装过程,下一篇cacti 添加linux主机监控和自定义主机模板
阅读(2868) | 评论(0) | 转发(2) |