catci的安裝

來源:互聯網
上載者:User

標籤:監控   cacti   

 

環境說明:

作業系統:CentOS6.5_x86_64

mysql:5.17

cacti版本:cacti-0.8.8a

NET-SNMP版本:5.5

cacti:cacti-0.8.8c.tar.gz

 

 

1.安裝以下組件或服務,使其開機啟動

yum install httpd php php-mysql php-snmpmysql mysql-server net-snmp net-snmp-utils php-gd vixie-cron

yum install rrdtool --nogpgcheck

 

httpd:apache服務,提供web服務

php:php模組,支援動態網頁

mysql:mysql服務,儲存模板,使用者等相關資訊。

net-snmp:snmp服務,用來抓取被監控機的資料

rrdtool:儲存資料

 

設定以下服務為開機啟動

chkconfig mysqld on

chkconfig snmpd on

chkconfig httpd on

 

2.配置(apache配置,apache和php關聯)

 

apache 的設定檔

/etc/httpd/conf/httpd.conf

DocumentRoot "/var/www/html"  #  找到資料目錄

 

關聯php模組

修改DirectoryIndex index.html 為DirectoryIndexindex.html index.php

並添加AddType application/x-httpd-php .php

 

測試php和apache關聯是否成功關聯

建立測試php頁面test.php,並存放在網站主目錄下,

<?php

phpinfo();

?>

 

在瀏覽器中輸出http://ip/test.php 如果沒有報錯就表示關聯成功

 

apache和php關聯參考

http://blog.csdn.net/yincg/article/details/8782364

 

3.安裝cacti

官網下載:wget http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz

 

解壓之後複製檔案,目錄到apache 根目錄

mkdir /var/www/html/cacti

 

cd /home/software/cacti-0.8.8c

 

cp -rf  *  /var/www/html/cacti/

 

建立資料庫:

mysql> create database cacti defaultcharacter set utf8;

 

匯入資料cacti資料:

mysql> mysql  -uroot [email protected] cacti <  /var/www/html/cacti/cacti.sql

mysql> GRANT ALL ON cacti.* [email protected] IDENTIFIED BY ‘cacti‘;

mysql> flush privileges;

 

修改設定檔:

vi  /var/www/html/cacti/include/config.php

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

 

/var/www/html/cacti/include/global.php

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

 

useradd cacti  :添加cacti 使用者

添加許可權:

cd /var/www/html/cacti 

chown -R cacti rra/ log/

 

 

 

4.配置snmp使可以監控本機(被監控機上安裝)

yum -y install net-snmp net-snmp-utils

 

編輯snmp設定檔/etc/snmp/snmp.conf

 

修改:

com2sec notConfigUser  default      public

改為:

com2sec notConfigUser  監控主機的ip       public

 

修改:

access notConfigGroup ""     any       noauth    exact systemview none none

改為:

access notConfigGroup ""     any       noauth    exact all none none

 

去掉這句的注釋

#view all   included  .1                               80

 

重啟snmp服務並測試

service snmpd restart

 

5.安裝spine:提升監控效率

http://www.cacti.net/downloads/spine/

 

#tar xf cacti-spine-0.8.8a.tar.gz

# cd cacti-spine-0.8.8a

#./configure --prefix=/usr/local/cacti-spine

configure: error: Cannot find SNMPheaders.  Use --with-snmp= to specifynon-default path.

 

#yum -y net-snmp-devel

#./configure--prefix=/usr/local/cacti-spine

 

在安裝cacti-spine過程中,configure編譯時間出現如下錯誤提示:

configure: error: Cannot find MySQLheaders.  Use --with-mysql= to specifynon-default path.

原來是找不到mysql頭,原來是mysql-devel沒有安裝,於是先安裝mysq-devel:

#yum -y mysq-devel

如果出現無法註冊X86-64錯誤,升級gcc

#yum -y gcc

 

#Make && make install

#cd /usr/local/cacti-spine/etc/

#cp spine.conf.dist spine.conf

 

6.cacti故障排查:

檢測被監控端是否可以與監控機通訊。

snmpwalk -c public -v 2c 監控主機ipIF-MIB::ifHCInOctets

snmpwalk -v 2c -c public 監控主機ip if

檢查rrd檔案是否問nan:

rrdtool fetch fxd-mdl11_traffic_in_365.rrdAVERAGE

故障排查:

http://blog.itechol.com/space.php?uid=33&do=blog&id=5100

 

cacti安裝:

http://www.360doc.com/content/12/1120/16/834950_249119792.shtml

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

http://blog.chinaunix.net/uid-24727220-id-3025015.html

http://www.cacti.net/download_cacti.php

yum找不到包的解決方案:

http://mirrors.163.com/.help/centos.html

apache和php的關聯(lamp環境搭建)

http://blog.csdn.net/yincg/article/details/8782364

Rrdtool: http://oss.oetiker.ch/rrdtool/pub/

Net-snmp: http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2.1/net-snmp-5.6.2.1.tar.gz/download

 

 

 

 

本文出自 “SQLServer MySQL” 部落格,請務必保留此出處http://dwchaoyue.blog.51cto.com/2826417/1631783

catci的安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.