CentOS系統(tǒng)下Cacti中文版安裝配置_第1頁
CentOS系統(tǒng)下Cacti中文版安裝配置_第2頁
CentOS系統(tǒng)下Cacti中文版安裝配置_第3頁
CentOS系統(tǒng)下Cacti中文版安裝配置_第4頁
CentOS系統(tǒng)下Cacti中文版安裝配置_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、CentOS系統(tǒng)下Cacti中文版安裝配置Cacti是一款優(yōu)秀的開源監(jiān)控軟件,使用php實現(xiàn),它的主要特點是使用snmp服務獲取數(shù)據,然后用rrdtool存儲和更新數(shù)據,當用戶查看數(shù)據的時候,rrdtool生成圖表呈現(xiàn)給用戶。mysql數(shù)據庫用于存儲變量并進行調用。mysql數(shù)據庫并不存儲snmp捕獲到的數(shù)據,snmp捕獲到的數(shù)據,存在于rrdtool生成的rrd文件中,這些文件位于cacti目錄下的rra目錄中。本文主要介紹cacti中文版的安裝,配置,cacti插件的安裝,配置。英文版的安裝跟中文版大同小異,但是中文版會麻煩點,所以就以中文版為例。系統(tǒng):Centos5.6 x386軟件:c

2、acti-0.8.7e 本文檔提供pdf版本下載,祥見文章尾部。 一、    準備軟件的安裝由于cacti使用php來實現(xiàn),通過WEB來管理,使用snmp來捕獲數(shù)據,使用rrdtool來生成圖表,使用mysql來存儲變量,因此需要先安裝這些軟件,直接使用yum進行安裝即可,共需安裝以下rpm包:httpd/mysql-server/php/php-mysql/rrdtool/gd/net-snmp/php-snmp/net-snmp-utils/net-snmp-devel/mysql-devel/openssl-devel各個rpm包的作用為

3、:httpd  WEB服務器apachemysql-server   數(shù)據庫mysqlphp   cacti使用php來實現(xiàn)php-mysql  php支持mysqlrrdtool   用來生成cacti圖像gd      rrdtool繪制圖像需要的圖形庫php-snmp   php支持snmpnet-snmp-utils   一些snmp的擴展命令,如:snmpwalk、snmpget等,cacti需要net-snmp-d

4、evel/mysql-devel/openssl-devel   cactid/spine需要安裝rpm包:yum -y install httpd gettext mysql mysql-server mysql-devel php php-mysql php-pyum -y install php-mysql mysql perl mysql-server perl-DBI perl-DBD-MySQL httpd gcc glibc glibc-common gd gd-devel phpyum -y install net-snmp php-snmp net-snm

5、p-utils net-snmp-devel mysql-devel openssl-devel由于centos的標準組件中是不帶rrdtool的,因此我們需要添加一個dag的yum源,以安裝rrdtool。修改/etc/yum.repos.d/CentOS-Base.repo,#vi /etc/yum.repos.d/CentOS-Base.repo在其末尾追加dagname=Dag RPM Repository for Red Hat Enterprise Linuxbaseurl=http:/apt.sw.be/redhat/el$releasever/en/$basearch/dagg

6、pgcheck=1gpgkey=enabled=1安裝相關依賴rootlocalhost#yum install ntp vim-enhanced gcc gcc-c+ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel  pam-develrootlocalhost# yum install -y rrdtool perl-

7、rrdtool rrdtool-devel 這可安裝完成!設置開機自啟動#chkconfig httpd on#chkconfig mysqld on#chkconfig snmpd on二、    MySQL數(shù)據設置由于cacti依靠mysql來存儲必要的變量,我們有必要對MySQL做些設置。啟動并初始化mysql數(shù)據庫#service mysqld start為root用戶設置密碼(以linuxpad為例),并更改登錄權限,默認密碼為空#mysql u root p      回車后輸入密碼(空)my

8、sql>use mysql;mysql>update user set password=password("linuxpad") where user="root"              mysql>grant all privileges on *.* to rootlocalhost identified by "linuxpad" with grant option;mysql

9、>flush privileges;添加cacti庫和cacti用戶,并為其設置權限mysql>create database cacti default character set utf8;    /數(shù)據庫字符集設置utf8,否則亂碼mysql>grant all privileges on cacti.* to cactilocalhost identified by "linuxpad" with grant option;mysql>flush privileges;三、    安

10、裝Cacti下載cacti-0.8.7e-cn-utf8.tar.gz,地址為 /upfile2/090815172648.gz (這個鏈接是tar.gz格式的,請下載后更改文件格式),假設下載目錄為/opt/soft,下面相同#cd /opt/soft#tar zxvf 090815172648.tar.gz#mv cacti-0.8.7e-cn-utf8 /var/www/cacti修改配置文件#vi /var/www/cacti/include/config.php修改內容如下$database_type = "mysql"$database_default = &q

11、uot;cacti"$database_hostname = "localhost"$database_username = "cacti"$database_password = "linuxpad"關于cacti添加用戶,網上常見的做法是添加一個cacti的用戶,并更改rra和log目錄屬主。經過本人測試這里并不需要添加cacti用戶并更改 rra和log的屬主,直接使用root即可。原因是因為官方的安裝文檔上使用的是FreeBSD,在計劃任務那步使用的是:*/5 * * * * cacti php /var/www/c

12、acti/poller.php &>/dev/null,使用用戶cacti來執(zhí)行任務。但是centos并不是識別這個cacti參數(shù),因此也就無需使用cacti來執(zhí)行任務,我們直接使用root來執(zhí)行任務就OK了,于是不用更改目錄權限,crontab內容為*/5 * * * * php /var/www/cacti/poller.php >/dev/null &2>1還有另外一種的解決方案,就是添加一個cacti用戶,更改rra和log目錄屬主為cacti,然后在cacti用戶環(huán)境下設置crontab,內容為*/5 * * * * php /var/www/cac

13、ti/poller.php >/dev/null &2>1這樣就能實現(xiàn)crontab計劃是由cacti用戶來執(zhí)行的了。創(chuàng)建并編輯apache的cacti配置文件#vi /etc/httpd/conf.d/cacti.conf內容如下:Alias /cacti /var/www/cacti<Directory /var/www/cacti>DirectoryIndex index.phpAllowOverride allorder deny,allowallow from allphp_flag magic_quotes_gpc onphp_flag track_

14、vars on</Directory>導入數(shù)據庫#mysql u root p cacti < /var/www/cacti/cacti.sql啟動服務,然后訪問http:/ip/cacti開始安裝cacti#service mysqld start#service httpd start#service snmpd start直接下一步,選擇”全新安裝”,來到下面的一個界面,如圖1請確認所有路徑都已找到,并選擇SNMP應用程序版本為5.x,RRDTool版本為1.3.x。完成之后來到登錄頁面,默認用戶名admin,密碼admin,登錄之后會提示你強制更改密碼。設置計劃任務#

15、crontab e追加以下內容*/5 * * * * php /var/www/cacti/poller.php >/dev/null &2>1添加中文字體支持,否則Cacti圖像內會沒有任何內容。CentOS下直接yum安裝中文支持#yum install fonts-chinese打開Cacti,控制面板->配置->設置->路徑:將RRDTool默認字體路徑設為/usr/share/fonts/chinese/TrueType/ukai.ttf配置無誤,會顯示文件已找到。四、    配置本機snmp編輯snmp配置文件/e

16、tc/snmp/snmp.conf修改:com2sec notConfigUser default public改為:com2sec notConfigUser 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 res

17、tart# snmpwalk -v 1 -c public localhost IP-MIB:ipAdEntIfIndex IP-MIB:ipAdEntIfIndex. = INTEGER: 1IP-MIB:ipAdEntIfIndex.xxx.xxx.xxx.xxx = INTEGER: 2IP-MIB:ipAdEntIfIndex.xxx.xxx.xxx.xxx = INTEGER: 3顯示以上信息,則snmp配置成功,xxx.xxx.xxx.xxx會根據你本機的IP信息配置而不同。 圖1如果配置正確,隔幾分鐘,我們的cacti就會有數(shù)據了,如圖2,你也可以手動

18、執(zhí)行以下命令手動生成rrd圖像#/usr/bin/php /var/www/cacti/poller.php &>/dev/null 圖2五、    安裝Spine由于默認cmd.php來輪詢數(shù)據,速度會很慢,特別是在監(jiān)控節(jié)點比較多的情況下,cmd.php就更顯不足了,因此我們采用Spine來輪詢數(shù)據。cacti-spine是一個由C語言開發(fā)的,用于替代cmd.php的快速獲取速度的引擎。下載地址:安裝spine之前請確保它所依賴的包net-snmp-devel、mysql-devel、openssl-devel都已安裝完畢。以下是安裝步驟

19、#cd /opt/soft#wget #tar zxvf cacti-spine-0.8.7e.tar.gz#cd cacti-spine-0.8.7e#./configure#make && make install編輯spine配置文件#vi /usr/local/spine/etc/spine.conf修改內容如下:DB_Host localhostDB_Database cactiDB_User cactiDB_Pass linuxpadDB_Port 3306將spine啟動并設置開機自啟動#/usr/local/spine/bin/spine#echo /usr/l

20、ocal/spine/bin/spine >>/etc/rc.d/rc.localCacti設置:Cacti控制面板->配置->設置路徑:將Spine輪詢器路徑設置為/usr/local/spine/bin/spine輪詢器:輪詢器類型選擇Spine到此為止,我們已經成功安裝Spine輪詢器并使用。六、    Cacti插件安裝之Cacti-plugin對于中文版,我們需要下載中文版的更新文件:Cacti-Plugin安裝過程如下:#cd /opt/soft#wget #mv 090818213852.gz cacti-plugin-0.8

21、.7d-PA-v2.4-cn-utf8.diff.gz# gunzip cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff.gz# mv cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff /var/www/cacti/# patch -p1 -N <cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff#mysql u cacti p < pa.sql如果你的cacti訪問時候是使用http:/ip/cacti,你需要修改/var/www/cacti/include/global.php修改如下

22、:$database_type = "mysql"$database_default = "cacti"$database_hostname = "localhost"$database_username = "cacti"$database_password = "linuxpad"$database_port = "3306" $config'url_path' = '/cacti/' 配置CactiCacti控制面板->工具->用戶管理->

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論