cacti pdo_mysql_搭建配置cacti,采集信息监控
安裝cacti
lamp環(huán)境
[iyunv@Cacti ~]#service iptables stop //關(guān)閉防火墻服務(wù)
[iyunv@Cacti ~]#chkconfig iptables off //永久性關(guān)閉
[iyunv@Cacti ~]#vi /etc/sysconfig/selinux //把SELINUX=enforcing改為SELINUX=disabled
1:操作系統(tǒng)的安裝,這個(gè)就不用寫(xiě)教程了吧(略)我個(gè)人用的是CentOS6.5最小化安裝
裝好系統(tǒng)以后關(guān)閉防火墻和selinux
[iyunv@Cacti ~]#service iptables stop //關(guān)閉防火墻服務(wù)
[iyunv@Cacti ~]#chkconfig iptables off //永久性關(guān)閉
[iyunv@Cacti ~]#vi /etc/sysconfig/selinux //把SELINUX=enforcing改為SELINUX=disabled
2:yum設(shè)置
這里也不再多說(shuō),請(qǐng)參見(jiàn)上一篇博文yum設(shè)置
3:安裝cacti依賴(lài)的軟件
yum -y install mysql mysql-server mysql-devel httpd php php-pdo php-snmp php-mysql lm_sensors net-snmp net-snmp-utils net-snmp-libs rrdtool rrdtool-devel perl-PlRPC perl-DBI perl-rrdtool perl-DBD-MySQL
4:裝好依賴(lài)軟件之后,snmp有3個(gè)地方需要配置一下
[iyunv@Cacti ~]#vim /etc/snmp/snmpd.confg
第41行:將 com2sec notConfigUser default public 中的 "default" 改為 "127.0.0.1"
第62行:將 access notConfigGroup "" any noauth exact systemview none none 中的 "systemview" 改為 "all"
第85行:將 #view all include .1 80 這一行前面的 # 號(hào)去掉
5:配置好snmp以后我們來(lái)啟動(dòng)3個(gè)重要的服務(wù)
[iyunv@Cacti ~]#service snmpd start //啟動(dòng)snmp服務(wù)
[iyunv@Cacti ~]#chkconfig snmpd on //設(shè)置開(kāi)機(jī)啟動(dòng)
[iyunv@Cacti ~]#service httpd start
[iyunv@Cacti ~]#chkconfig httpd on
[iyunv@Cacti ~]#service mysqld start
[iyunv@Cacti ~]#chkconfig mysqld on
6:安裝并配置cacti
[iyunv@Cacti ~]#wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz //cacti官網(wǎng)最新版
[iyunv@Cacti ~]#tar -zxvf cacti-0.8.8b.tar.gz
[iyunv@Cacti ~]#mv cacti-0.8.8b /var/www/html/cacti //將cacti-0.8.8b文件夾移到/var/www/html目錄下,并將cacti-0.8.8b重命名為cacti
7:設(shè)置mysql數(shù)據(jù)庫(kù)
[iyunv@Cacti ~]#mysql -uroot -p //新裝的mysql沒(méi)有密碼,直接回車(chē)進(jìn)入mysql數(shù)據(jù)庫(kù)
mysql>create database cacti; //首先創(chuàng)建cacti數(shù)據(jù)庫(kù),注意別丟了分號(hào)
mysql>grant all privileges on cacti.* to cacti@localhost identified by 'cacti' with grant option; //創(chuàng)建cacti用戶(hù)并授權(quán)
mysql>use cacti;
mysql>source /var/www/html/cacti/cacti.sql; //導(dǎo)入cacti數(shù)據(jù)庫(kù)文件
mysql>exit
8:配置cacti
[iyunv@Cacti ~]#vim /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser"; //因?yàn)槲覀兿惹霸跀?shù)據(jù)庫(kù)建的是 "cacti" 用戶(hù),所以這里默認(rèn)的 "cactiuser" 要改為 "cacti"
$database_password = "cactiuser"; //這里默認(rèn)的密碼我們也要改為 "cacti"
$database_port = "3306";
9:增加 cacti 用戶(hù)以用來(lái)寫(xiě)入rrd和log目錄的數(shù)據(jù),否則就會(huì)生成不了圖片
[iyunv@Cacti ~]#useradd cacti
[iyunv@Cacti ~]#cd /var/www/html/cacti
[iyunv@Cacti ~]#chown -R cacti rra/ log/
10:添加任務(wù)計(jì)劃
具體多長(zhǎng)時(shí)間讓cacti生成一次監(jiān)控圖表自己決定,這里以cacti的默認(rèn)時(shí)間5分鐘生成一次為例
[iyunv@Cacti ~]#crontab -e
加入這一行保存即可
*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
總結(jié)
以上是生活随笔為你收集整理的cacti pdo_mysql_搭建配置cacti,采集信息监控的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: html做自我介绍模板,应聘自我介绍模板
- 下一篇: 《概率论与数理统计》之常见概率分布