Cacti安裝使用&流量監(jiān)控詳解:
一石洗,cacti的安裝
1?安裝RRDTool
yum?-y?install?rrdtool
啟動(dòng)rrdtool服務(wù)并且加入啟動(dòng)列表
2?安裝snmp支持工具
可以yum安裝,也可以源碼安裝,?Wget
http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2.1/net-snmp-5.6.2.1.tar.gz/download[一般yum安裝]
yum?-y?install?net-snmp
yum?-y?install?net-snmp-utils(此處顯示已安裝他匪,前一項(xiàng)自動(dòng)安裝了)
service?snmpd?start
chkconfig?snmpd?on
3?安裝LAMP
yum?-y?install?httpd?mysql-server?php?php-mysql?mysql-devel
chkconfig?httpd?on
chkconfig?mysqld?on
/etc/init.d/httpd?start
/etc/init.d/mysqld?start
4下載安裝
wget
http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
1)建立cacti用戶(hù)
useradd?-m?cacti
passwd?cacti
密碼:cacti
2)首先安裝幾個(gè)編譯cacti需要的devel包:
yum?install?net-snmp-devel?-y
yum?install?mysql-devel?-y
yum?install?openssl-devel?-y
3)安裝gcc和libtool
yum?install?gcc?-y
yum?install?libtool?-y
4)解壓cacti铐炫,編譯安裝:
tar?zxvf?cacti-0.8.8b.tar.gz?tar?-C?/var/www/html/
mv?cacti-0.8.8b?/?cacti
cd?/var/www/html/cacti
5)創(chuàng)建數(shù)據(jù)庫(kù)用戶(hù)
grant?all?on?cacti.*?to?'cactiuser'@'localhost'?identified?by?'123456';
flush?privileges;
6)編輯cacti配置文件毁渗,連接MySQL服務(wù)的用戶(hù)名题暖,密碼絮宁,端口等梆暮,配置include/config.php
vim?/var/www/html/cacti/include/config.php
$database_type?=?"mysql";
$database_default?=?"cacti";
$database_hostname?=?"localhost";
$database_username?=?"cacti_user";
$database_password?=?"123456";
$database_port?=?"3306";
$database_ssl?=?false;
chown?-R?root:root?/var/www/html/cacti/
useradd?cacti[前已添加]
chown?-R?cacti:cacti?/var/www/html/cacti/log/
chown?-R?cacti:cacti?/var/www/html/cacti/rra/
mysql?cacti?<?/var/www/html/cacti/cacti.sql
7)測(cè)試,建立一個(gè)login.jsp文件
[root@.....?cacti]#?vim?login.php
simple?demo
phpinfo();
?>
8)完成cacti的安裝
在瀏覽器中輸入:
http://www.yourdomain.com/cacti/install
默認(rèn)用戶(hù)名:admin?密碼:admin
更改密碼
設(shè)置cacti用到的命令
監(jiān)控端操作
#?su?–?cacti
$?php?/var/www/html/cacti/poller.php?#開(kāi)始同步數(shù)據(jù)
9)添加計(jì)劃任務(wù)(使cacti每5分鐘獲得一次數(shù)據(jù))
#crontab?-e
*/5?*?*?*?*?/usr/bin/php?/var/www/html/cacti/poller.php
讓系統(tǒng)每5分鐘收集
service?crond?restart
service?httpd?restart
#?chkconfig?crond?on
圖像顯示出來(lái)了
至此绍昂,cacti的安裝已經(jīng)完成.
二啦粹,使用cacti監(jiān)控服務(wù)器流量
1登錄cacti,點(diǎn)擊“Devices”窘游,然后點(diǎn)擊”Add”創(chuàng)建設(shè)備
2然后輸入Description唠椭,Hostname,Host?Template選擇“Generic?SNMP-enabled?Host”,SNMP?Version一般選擇“Version?1”(當(dāng)然得根據(jù)你具體的snmp如何配置)忍饰。完成后點(diǎn)擊”create”創(chuàng)建設(shè)備
3接著在頂部點(diǎn)擊“Create?Graphs?for?this?Host”創(chuàng)建圖表
4在“SNMP?–?Interface?Statistics”下面會(huì)顯示你的網(wǎng)卡贪嫂,選擇其中一個(gè)監(jiān)控即可,我們這里選”eth0″艾蓝,之后單擊“create”力崇。
5現(xiàn)在已經(jīng)成功創(chuàng)建圖表斗塘,我們點(diǎn)擊左側(cè)的“Graph?Management”查看圖表列表,此時(shí)已經(jīng)可以看到剛才創(chuàng)建的圖表亮靴,點(diǎn)擊相應(yīng)的圖表標(biāo)題進(jìn)去查看逛拱。
6現(xiàn)在可能圖表還沒(méi)開(kāi)始生成,最多等待5分鐘台猴,5分鐘后圖表是創(chuàng)建了朽合,但圖表沒(méi)有數(shù)據(jù),需要等待一段時(shí)間程序收集數(shù)據(jù)饱狂。