cacti 安装过程笔记
生活随笔
收集整理的這篇文章主要介紹了
cacti 安装过程笔记
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一、搭建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端口是否打開了.或者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? #安裝過程有時(shí)候要注意權(quán)限的問題,在 apache 上設(shè)置好 cacti 所在 web 目錄。 然后編輯cacti 的數(shù)據(jù)庫配置文件。 vi?/data/www/cacti/include/config.php
?
| $database_type= “ mysql ” ; #數(shù)據(jù)庫類型 $database_default?="cacti";? ?#數(shù)據(jù)庫名稱 $database_hostname = "localhost";????? #默認(rèn)是localhost $database_username = "cactiuser";?????#數(shù)據(jù)庫用戶名 $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ù)庫環(huán)境: 對(duì)應(yīng)做一些數(shù)據(jù)庫的操作: 進(jìn)入數(shù)據(jù)庫:mysql #我還沒有設(shè)置密碼 mysql> GRANT ALL ON cacti.* TO cactiuser@localhostIDENTIFIED BY 'cactiuser';mysql> flush privileges; (?#刷新權(quán)限) mysql> CREATE DATABASE cacti; mysql>exit (退出數(shù)據(jù)庫) cd /data/www/cacti/ mysql -u cactiuser -p cacti < cacti.sql 或者(mysql -u root -p cacti < cacti.sql?) (在Mysql中創(chuàng)建一個(gè)新的庫,并導(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???????????#所連接的庫
DB_User???????? cactiuser?????? #數(shù)據(jù)庫用戶
DB_Pass???????? cactiuser?????? #數(shù)據(jù)庫密碼
DB_Port???????? 3306??????????? #連接數(shù)據(jù)庫端口 七、登陸配置 進(jìn)入cacti 的初始設(shè)置頁面
第一次默認(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ù)庫,導(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)過以上操作,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下開啟相關(guān)插件服務(wù) 參考網(wǎng)址: http://blog.myspace.cn/e/407673318.htm http://tqhlyz.blog.51cto.com/1093844/428216
本文出自 “技術(shù)成就夢(mèng)想” 博客,請(qǐng)務(wù)必保留此出處http://52199999.blog.51cto.com/740826/486647
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的cacti 安装过程笔记的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 老公是黑名单老婆可以贷款吗
- 下一篇: 信证怎么恢复