cacti如何安裝

這篇文章給大家分享的是有關(guān)cacti如何安裝的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

安溪網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,安溪網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為安溪數(shù)千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的安溪做網(wǎng)站的公司定做!

一、搭建lamp架構(gòu)

1、yum方式如下:

yum groupinstall“Web Server”

yum groupinstall   “MySQL Database”  

yum   –y install php-mysql  

2   、編譯方式略:(注意在編譯PHP時(shí)候要加上 --enable-sockets 這個(gè)參數(shù))  

二、安裝 net-snmp、snmpwalk 和 snmpget 命令  

rpm -qa | grep net-snmp (   查看系統(tǒng)中有否已經(jīng)裝有所需的軟件 )  

yum net-snmp* install 安裝上述軟件

修改配置文件   snmpd.conf 保留以下部分即可!  

com2sec notConfigUser  10.10.10.80    cheng              ##團(tuán)體名可以自定義  
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  all none none
view all    included  .1                               80
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat  

# Allow Systems Management Data Engine SNMP to connect to snmpd using SMUX  
smuxpeer .1.3.6.1.4.1.674.10892.1

service snmpd start

chkconfig --add snmpd

chkconfig snmpd on

最后運(yùn)行netstat -ln查看161端口是否打開(kāi)了.或者lsof –i:80  

三、安裝配置cacti  

tar zxvf cacti-0.8.7g.tar.gz

mv  cacti-0.8.7g cacti #修改名字

mv cacti /data/www/    #移到相應(yīng)的網(wǎng)站根目錄下

修改權(quán)限:   chown –R cacti:cacti /data/www/cacti  #安裝過(guò)程有時(shí)候要注意權(quán)限的問(wèn)題,在 apache 上設(shè)置好 cacti 所在 web 目錄。  

然后編輯    cacti 的數(shù)據(jù)庫(kù)配置文件。    

vi /data/www/cacti/include/config.php

$database_type= “ mysql ” ; #數(shù)據(jù)庫(kù)類型

$database_default ="cacti";   #數(shù)據(jù)庫(kù)名稱

$database_hostname = "localhost";      #默認(rèn)是        localhost        

$database_username = "cactiuser";     #數(shù)據(jù)庫(kù)用戶名      
$database_password = "cactiuser";  #密碼      

更改用戶、密碼等項(xiàng)與上面給出的對(duì)應(yīng)保存退出

useadd cacti

# crontab –    e (加入自動(dòng)執(zhí)為cacti用戶添加cron任務(wù)    

su –    cacti    

*/5 * * * *  /data/php/bin/php  /data/www/cacti/poller.php > /dev/null 2>&1

(其中        /data/php/bin/php 這個(gè)為 php 的安裝目錄)        

之后       wq保存退出      

四、配置數(shù)據(jù)庫(kù)環(huán)境:  

對(duì)應(yīng)做一些數(shù)據(jù)庫(kù)的操作:

進(jìn)入數(shù)據(jù)庫(kù):   mysql #我還沒(méi)有設(shè)置密碼  

mysql> GRANT ALL ON cacti.* TO   cactiuser@localhostIDENTIFIED   BY 'cactiuser';  
mysql> flush privileges; ( #   刷新權(quán)限)  

mysql> CREATE DATABASE cacti;

mysql>exit (退出數(shù)據(jù)庫(kù)   )    

cd /data/www/cacti/

mysql -u cactiuser -p cacti < cacti.sql

或者(   mysql -u root -p cacti < cacti.sql )    

(在   Mysql中創(chuàng)建一個(gè)新的庫(kù),并導(dǎo)入cacti 目錄中cacti.sql 并設(shè)置好該表的用戶權(quán)限)    

五、rrdtool安裝,(我弄了個(gè)腳本一鍵安裝。)腳本如下:  

rrdtool_install.sh

#!/bin/sh

export BUILD_DIR=/tmp/rrd  
export INSTALL_DIR=/usr/local/rrdtool  
mkdir -p $BUILD_DIR  
cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz  
  gunzip -c rrdtool-1.4.5.tar.gz | tar xf -  
  cd rrdtool-1.4.5  
  ./configure --prefix=$INSTALL_DIR && make && make install

export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib"  
export MAKE=make

export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig  
export PATH=$INSTALL_DIR/bin:$PATH  
export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config

##########################################################################  
cd $BUILD_DIR

wget   http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz  
gunzip -c pkg-config-0.23.tar.gz | tar xf -  
   cd pkg-config-0.23  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"  
   $MAKE  
   $MAKE install  
export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz  
gunzip -c zlib-1.2.3.tar.gz | tar xf -  
   cd zlib-1.2.3  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz  
gunzip -c libpng-1.2.18.tar.gz | tar xf -  
   cd libpng-1.2.18  
   env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz  
gunzip -c freetype-2.3.5.tar.gz | tar xf -  
   cd freetype-2.3.5  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-2.6.32.tar.gz  
gunzip -c libxml2-2.6.32.tar.gz | tar xf -  
   cd libxml2-2.6.32  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz  
gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -  
   cd fontconfig-2.4.2  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --with-freetype-config=$INSTALL_DIR/bin/freetype-config  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz  
gunzip -c pixman-0.10.0.tar.gz  | tar xf -  
   cd pixman-0.10.0  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz  
   gunzip -c cairo-1.6.4.tar.gz  | tar xf -  
   cd cairo-1.6.4  
   ./configure --prefix=$INSTALL_DIR --enable-xlib=no --enable-xlib-render=no -enable-win32=no CFLAGS="-O3 -fPIC"  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz  
gunzip -c glib-2.15.4.tar.gz  | tar xf -  
   cd glib-2.15.4  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"  
   $MAKE  
   $MAKE install

cd $BUILD_DIR  
wget   http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.bz2  
   bunzip2 -c pango-1.21.1.tar.bz2 | tar xf -  
   cd pango-1.21.1  
   ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x  
   $MAKE  
   $MAKE install

####Building rrdtool (second try)  
cd $BUILD_DIR/rrdtool-1.4.5  
  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python  
  $MAKE clean  
  $MAKE  
  $MAKE install

###########################至此安裝   rrdtool安裝完畢,安裝時(shí)候可采用我的########  

六、安裝cacti-spine  

tar -xzvf cacti-spine-0.8.7g.tar.gz

cd cacti-spine-0.8.7g

./configure --prefix=/usr/local/spine --with-mysql=/data/mysql

make && make install

修改:   spine.conf  

vim /usr/local/spine/etc/spine.conf

DB_Host         localhost       #允許本機(jī)  
DB_Database     cacti           #所連接的庫(kù)
DB_User         cactiuser       #數(shù)據(jù)庫(kù)用戶
DB_Pass         cactiuser       #數(shù)據(jù)庫(kù)密碼
DB_Port         3306            #連接數(shù)據(jù)庫(kù)端口  

七、登陸配置  

進(jìn)入    cacti 的初始設(shè)置頁(yè)面
第一次默認(rèn)登陸賬號(hào):admin 密碼 admin
登陸后它就會(huì)讓你立即修改新密碼  

在左邊欄點(diǎn)擊    settings 如圖:  

在右邊有一排菜單欄,選擇   Paths 如下圖:    

添入如下信息:

snmpwalk Binary Path :         /usr/bin/snmpwalk  

snmpget Binary Path:           /usr/bin/snmpget  

snmpbulkwalk Binary Path:      /usr/bin/snmpbulkwalk  

snmpgetnext Binary Path:       /usr/bin/snmpgetnext  

RRDTool Binary Path:           /usr/local/rrdtool/bin/rrdtool  

RRDTool Default Font Path :      不用寫  

PHP Binary Path:    /usr/bin/php  

Cacti Log File Path:    /data/www/cacti/log/cacti.log  

Spine Poller File Path   /usr/local/spine/bin/spine

手動(dòng)運(yùn)行一次

/data/php/bin/php /data/www/cacti/poller.php (/data/php 為PHP安裝路徑)

勾選最后一項(xiàng)

切換到   poller項(xiàng)做以下調(diào)整:    

在切換到Gerneral項(xiàng):

配置結(jié)束!

八、以下為插件擴(kuò)展安裝  

默認(rèn)的   cacti不方便安裝插件,如果要安裝插件,需要打一個(gè)補(bǔ)丁。對(duì)于0.8.7g版本的cacti,應(yīng)該從cactiusers.org網(wǎng)站上下載并打上這個(gè)補(bǔ)?。?   

cacti-plugin-0.8.7g-PA-v2.8.diff

tar -zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz  
cd cacti-plugin-arch/  
cp cacti-plugin-0.8.7g-PA-v2.8.diff /data/www/cacti/  
cp pa.sql /data/www/cacti/  
cd /data/www/cacti  
patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff (這個(gè)必須是在   cacti目錄下執(zhí)行)
mysql –uroot –p cacti < pa.sql  

打好補(bǔ)丁后,再用   cactiuser用戶登錄mysql,使用cacti數(shù)據(jù)庫(kù),導(dǎo)入補(bǔ)丁包中自帶的pa.sql文件。    

vi include/global.php

/* Default database settings*/

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "cactiuser";

$database_port = "3306";

經(jīng)過(guò)以上操作,   cacti-0.8.7g就具有安裝插件的功能了。  

九、插件安裝  

在安裝其它插件之前,應(yīng)該首先安裝settings插件,這個(gè)插件給cacti增加了發(fā)email等功能。  

如果不首先安裝這個(gè)插件在安裝完thold!會(huì)出現(xiàn):You are missing a dependency for thold, please install the 'Settings將“settings"插件install-Enable后就可以了。' plugin.  

安裝具體的插件很簡(jiǎn)單:

mkdir  -p /data/www/cacti/plugins

#賦予權(quán)限   chown -R  cacti:cacti /data/www/cacti/plugins    

解壓各個(gè)插件,轉(zhuǎn)移到   cacti的plugins文件夾中,然后登陸cacti網(wǎng)站:    

1、   tar -xzvf settings-v0.7-1.tgz    

mv settings /data/www/cacti/plugins/settings

2、   tar -xzvf thold-latest.tgz    

mv thold-0.41 /data/www/cacti/plugins/thold

cd /data/www/cacti/plugins/thold

mysql -uroot -p cacti < thold.sql

3、    tar -xzvf monitor-v1.2-1.tgz    

mv monitor /data/www/monitor

cd /data/www/cacti/plugins/monitor

mysql -uroot -p cacti < monitor.sql

4、   tar -xzvf syslog-v1.05-1.tgz  

mv syslog /data/www/cacti/plugins

mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 9403 to server version: 5.1.50-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database syslog;

Query OK, 1 row affected (0.00 sec)

mysql> grant all on syslog.* to cactiuser@localhost identified by 'cactiuser';

Query OK, 0 rows affected (0.00 sec)

mysql -uroot syslog < /data/www/cacti/plugins/syslog/syslog.sql

5、   tar -xzvf discovery-v1.1-1.tgz  

mv discovery /data/www/cacti/plugins

6、   rpm -ivh syslog-ng-3.0.4-1.rhel5.i386.rpm  

warning: syslog-ng-3.0.4-1.rhel5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 2aa28252

Preparing...                   ########################################### [100%]  

Shutting down kernel logger: [ OK ]

Shutting down system logger: [ OK ]

   1:syslog-ng              ########################################### [100%]  

Starting syslog-ng: OK

User Managerment->admin,勾選    Plugin Managerment項(xiàng)    

Configuration->Plugin Managerment,   Install and Avtive所有插件    

這樣,所有插件都安裝并激活了   ,插件被安裝好后就可以在Configuration->Settings進(jìn)行配置了,可以填上郵件服務(wù)器的地址等信息,設(shè)置throld報(bào)警參數(shù)等。    

到   plugin management下開(kāi)啟相關(guān)插件服務(wù)    

感謝各位的閱讀!關(guān)于“cacti如何安裝”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

當(dāng)前文章:cacti如何安裝
鏈接分享:http://muchs.cn/article36/pdhssg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、靜態(tài)網(wǎng)站、域名注冊(cè)、企業(yè)建站、標(biāo)簽優(yōu)化電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都app開(kāi)發(fā)公司