cacti監控服務安裝搭建實戰講解
安裝準備
操作系統環境
系統安裝包選擇
需要使用3臺服務器。
一臺監控的服務器C 183。一臺snmp的服務器182 S1。一臺web 服務器181 S2。
snmp簡單介紹
簡單網絡管理協議(SNMP),由一組網絡管理的標準組成,包含一個應用層協議(application layer protocol)、數據庫模型(database schema)和一組資源對象。該協議能夠支持網絡管理系統,用以監測連接到網絡上的設備是否有任何引起管理上關注的情況。該協議是互聯網工程工作小組(IETF,Internet Engineering Task Force)定義的internet協議簇的一部分。SNMP的目標是管理互聯網Internet上衆多廠家生產的軟硬件平臺,因此SNMP受Internet標準網絡管理框架的影響也很大。SNMP已經出到第三個版本的協議,其功能較以前已經大大地加強和改進了。
詳細介紹:http://baike.baidu.com/link?url=z02jw0iHeRRubmzuEgAuuRhmb0zatU2d0O-KxxlsxUKMffxAxKprY6lTO_I-gLpnsY_bEUP0bl0n8k4Lz-BcF_
SNMP安裝完整的命令集
cat /etc/redhat-release
uname -r
uname -m
yum install net-snmp* -y
ll /etc/snmp/snmpd.conf
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori
cat >/etc/snmp/snmpd.conf<<EOF
com2sec local localhost public
com2sec mynetwork 192.168.204.0/24 public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
view all included .1 80
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
syslocation etiantian.org
syscontact Me <[email protected]>
proc mountd
proc ntalkd 4
proc sendmail 10 1
proc httpd 10 1
exec echotest /bin/echo hello world
exec disk_used_shell /bin/sh /root/current_disk_used.sh
exec httpd_proc /bin/sh /root/current_httpd_proc.sh
disk / 10000
disk /boot 10000
load 12 14 14
EOF
cat -n /etc/snmp/snmpd.conf
/etc/init.d/snmpd start
lsof -i :161
netstat -lntup|grep 161
ps -ef|grep snmpd|grep -v grep
snmpget -v 1 -c public localhost system.sysUpTime.0
tail -10 /var/log/snmpd.log
##################################################################################################
其他操作的命令集合
mkdir /home/oldboy/tools
cd /home/oldboy/tools
rz
ll
tar xf cacti_tools.tar.gz
tree
cd cacti_tools
ll
tar zxf libart_lgpl-2.3.17.tar.gz
cd libart_lgpl-2.3.17
./configure
make
make install
/bin/cp -r /usr/local/include/libart-2.0 /usr/include
cd ../
tar xf rrdtool-1.2.30.tar.gz
cd rrdtool-1.2.30
./configure
make && make install
ls -l /usr/local/bin/rrdtool
ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool
ls -l /usr/local/bin/rrdtool
ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool /usr/local/bin/rrdtool
ls -l /usr/local/bin/rrdtool
yum install gcc glibc glibc-common cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel -y
yum install mysql* httpd* php* --skip-broken -y
cd ../
cd /etc/httpd/conf
cp httpd.conf httpd.conf.oldboy.ori
sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf
sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf
egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf
/etc/init.d/httpd start
lsof -i :80
grep DocumentRoot httpd.conf
echo -e "<?php \nphpinfo(); \n?>" >/var/www/html/index.php
cat /var/www/html/index.php
rm -f /var/www/html/index.php
cd ~
/etc/init.d/mysqld start
lsof -i :3306
ps -ef|grep mysql
mysql
cd /home/oldboy/tools/
ll
cd cacti_tools
ll
tar xf cacti-0.8.8a.tar.gz
cd cacti-0.8.8a
mysql cacti <cacti.sql
mysql -e "use cacti;show tables;"
grep database include/config.php
grep apache /etc/httpd/conf/httpd.conf
chown -R apache rra/ log/
mv ../cacti-0.8.8a /var/www/html/cacti
cd /var/www/html/
ll
ll cacti/
ll
chown -R apache.apache cacti
/usr/bin/php /var/www/html/cacti/poller.php
chmod 755 /var/www/html/cacti/poller.php
/usr/bin/php /var/www/html/cacti/poller.php
/usr/bin/php /var/www/html/cacti/poller.php
/usr/bin/php /var/www/html/cacti/poller.php
/usr/bin/php /var/www/html/cacti/poller.php
/usr/bin/php /var/www/html/cacti/poller.php
echo '*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >>/var/spool/cron/root
crontab -l
cat /var/www/html/cacti/poller.php
ll /usr/local/bin/rrdtool
/usr/bin/php
ll /usr/bin/php
rpm -qa |grep net-snmp
netstat -lntup|grep 161
/etc/init.d/iptables stop
crontab -l
/usr/bin/php /var/www/html/cacti/poller.php
/usr/bin/php /var/www/html/cacti/poller.php
telnet 10.0.0.181 161
sz -y /etc/httpd/conf/httpd.conf
SNMP詳細實戰安裝過程
如果yum安裝的比較慢的話,需要提前配置好yum最好選擇阿里源
[root@test cacti]# yum install net-snmp* -y #所監控的和作爲監控的機器都需要安裝。
[root@C-SERVER ~]# cat /etc/redhat-release
CentOS release 5.8 (Final)
[root@C-SERVER ~]# unam -r
-bash: unam: command not found
[root@C-SERVER ~]# uname -r
2.6.18-308.el5
[root@C-SERVER ~]# uname -m
x86_64
[root@C-SERVER ~]#
[root@C-SERVER ~]# yum install net-snmp* -y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
base | 1.1 kB 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
updates/primary_db | 734 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package net-snmp.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated
--> Processing Dependency: libsensors.so.3()(64bit) for package: net-snmp
---> Package net-snmp-devel.i386 1:5.3.2.2-17.el5_8.1 set to be updated
--> Processing Dependency: elfutils-devel for package: net-snmp-devel
--> Processing Dependency: lm_sensors-devel for package: net-snmp-devel
--> Processing Dependency: beecrypt-devel for package: net-snmp-devel
---> Package net-snmp-devel.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated
---> Package net-snmp-libs.i386 1:5.3.2.2-17.el5_8.1 set to be updated
---> Package net-snmp-libs.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated
---> Package net-snmp-perl.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated
---> Package net-snmp-utils.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated
--> Running transaction check
---> Package beecrypt-devel.x86_64 0:4.1.2-10.1.1 set to be updated
--> Processing Dependency: beecrypt = 4.1.2-10.1.1 for package: beecrypt-devel
--> Processing Dependency: libbeecrypt.so.6()(64bit) for package: beecrypt-devel
---> Package elfutils-devel.x86_64 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-devel-static-x86_64 = 0.137-3.el5 for package: elfutils-devel
---> Package lm_sensors.x86_64 0:2.10.7-9.el5 set to be updated
---> Package lm_sensors-devel.x86_64 0:2.10.7-9.el5 set to be updated
--> Running transaction check
---> Package beecrypt.x86_64 0:4.1.2-10.1.1 set to be updated
---> Package elfutils-devel-static.x86_64 0:0.137-3.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
net-snmp x86_64 1:5.3.2.2-17.el5_8.1 updates 706 k
net-snmp-devel i386 1:5.3.2.2-17.el5_8.1 updates 1.9 M
net-snmp-devel x86_64 1:5.3.2.2-17.el5_8.1 updates 2.0 M
net-snmp-perl x86_64 1:5.3.2.2-17.el5_8.1 updates 201 k
net-snmp-utils x86_64 1:5.3.2.2-17.el5_8.1 updates 192 k
Updating:
net-snmp-libs i386 1:5.3.2.2-17.el5_8.1 updates 1.3 M
net-snmp-libs x86_64 1:5.3.2.2-17.el5_8.1 updates 1.3 M
Installing for dependencies:
beecrypt x86_64 4.1.2-10.1.1 base 87 k
beecrypt-devel x86_64 4.1.2-10.1.1 base 118 k
elfutils-devel x86_64 0.137-3.el5 base 62 k
elfutils-devel-static x86_64 0.137-3.el5 base 119 k
lm_sensors x86_64 2.10.7-9.el5 base 525 k
lm_sensors-devel x86_64 2.10.7-9.el5 base 85 k
Transaction Summary
==========================================================================================
Install 11 Package(s)
Upgrade 2 Package(s)
Total download size: 8.5 M
Downloading Packages:
(1/13): elfutils-devel-0.137-3.el5.x86_64.rpm | 62 kB 00:00
(2/13): lm_sensors-devel-2.10.7-9.el5.x86_64.rpm | 85 kB 00:00
(3/13): beecrypt-4.1.2-10.1.1.x86_64.rpm | 87 kB 00:00
(4/13): beecrypt-devel-4.1.2-10.1.1.x86_64.rpm | 118 kB 00:00
(5/13): elfutils-devel-static-0.137-3.el5.x86_64.rpm | 119 kB 00:00
(6/13): net-snmp-utils-5.3.2.2-17.el5_8.1.x86_64.rpm | 192 kB 00:00
(7/13): net-snmp-perl-5.3.2.2-17.el5_8.1.x86_64.rpm | 201 kB 00:00
(8/13): lm_sensors-2.10.7-9.el5.x86_64.rpm | 525 kB 00:00
(9/13): net-snmp-5.3.2.2-17.el5_8.1.x86_64.rpm | 706 kB 00:00
(10/13): net-snmp-libs-5.3.2.2-17.el5_8.1.i386.rpm | 1.3 MB 00:00
(11/13): net-snmp-libs-5.3.2.2-17.el5_8.1.x86_64.rpm | 1.3 MB 00:01
(12/13): net-snmp-devel-5.3.2.2-17.el5_8.1.i386.rpm | 1.9 MB 00:01
(13/13): net-snmp-devel-5.3.2.2-17.el5_8.1.x86_64.rpm | 2.0 MB 00:01
------------------------------------------------------------------------------------------
Total 888 kB/s | 8.5 MB 00:09
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : net-snmp-libs 1/15
Installing : lm_sensors 2/15
Installing : net-snmp 3/15
Updating : net-snmp-libs 4/15
Installing : beecrypt 5/15
Installing : net-snmp-perl 6/15
Installing : net-snmp-utils 7/15
Installing : beecrypt-devel 8/15
Installing : lm_sensors-devel 9/15
Installing : elfutils-devel 10/15
Installing : elfutils-devel-static 11/15
Installing : net-snmp-devel 12/15
Installing : net-snmp-devel 13/15
Cleanup : net-snmp-libs 14/15
Cleanup : net-snmp-libs 15/15
Installed:
net-snmp.x86_64 1:5.3.2.2-17.el5_8.1 net-snmp-devel.i386 1:5.3.2.2-17.el5_8.1
net-snmp-devel.x86_64 1:5.3.2.2-17.el5_8.1 net-snmp-perl.x86_64 1:5.3.2.2-17.el5_8.1
net-snmp-utils.x86_64 1:5.3.2.2-17.el5_8.1
Dependency Installed:
beecrypt.x86_64 0:4.1.2-10.1.1 beecrypt-devel.x86_64 0:4.1.2-10.1.1
elfutils-devel.x86_64 0:0.137-3.el5 elfutils-devel-static.x86_64 0:0.137-3.el5
lm_sensors.x86_64 0:2.10.7-9.el5 lm_sensors-devel.x86_64 0:2.10.7-9.el5
Updated:
net-snmp-libs.i386 1:5.3.2.2-17.el5_8.1 net-snmp-libs.x86_64 1:5.3.2.2-17.el5_8.1
Complete!
查看是否存在默認的snmp配置文件。
[root@C-SERVER ~]# ll /etc/snmp/snmpd.conf
-rw-r--r-- 1 root root 18579 May 21 17:00 /etc/snmp/snmpd.conf
[root@C-SERVER ~]# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori
增加snmp配置文件內容。全部清空原始內容,然後添加如下內容。
[root@C-SERVER ~]# cat >/etc/snmp/snmpd.conf<<EOF
com2sec local localhost public
com2sec mynetwork 10.0.0.0/24 public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
view all included .1 80
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
syslocation etiantian.org
syscontact Me <[email protected]>
proc mountd
proc ntalkd 4
proc sendmail 10 1
proc httpd 10 1
exec echotest /bin/echo hello world
exec disk_used_shell /bin/sh /root/current_disk_used.sh
exec httpd_proc /bin/sh /root/current_httpd_proc.sh
disk / 10000
disk /boot 10000
load 12 14 14
EOF
提示:snmp.conf的以下兩行比較重要
com2sec local localhost public
com2sec mynetwork 10.0.0.0/24 public
#其中的public爲團體名字,可以隨意改名字。
#10.0.0.0/24爲允許訪問的SNMP一般是內網IP的IP段。多個IP段換行寫,也可以cat添加。
檢查配置文件
[root@C-SERVER ~]# cat -n /etc/snmp/snmpd.conf
com2sec local localhost public
com2sec mynetwork 10.0.0.0/24 public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
view all included .1 80
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
syslocation etiantian.org
syscontact Me <[email protected]>
proc mountd
proc ntalkd 4
proc sendmail 10 1
proc httpd 10 1
exec echotest /bin/echo hello world
exec disk_used_shell /bin/sh /root/current_disk_used.sh
exec httpd_proc /bin/sh /root/current_httpd_proc.sh
disk / 10000
disk /boot 10000
load 12 14 14
啓動SNMP服務。
[root@C-SERVER ~]# /etc/init.d/snmpd start
Starting snmpd: [ OK ]
查看端口及進程狀態
[root@C-SERVER ~]# lsof -i :161
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
snmpd 22294 root 10u IPv4 40371 0t0 UDP *:snmp
[root@C-SERVER ~]# netstat -lntup|grep 161
udp 0 0 0.0.0.0:161 0.0.0.0:* 22294/snmpd
[root@C-SERVER ~]# ps -ef|grep snmpd|grep -v grep
root 22294 1 0 19:53 ? 00:00:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a
#grep -v grep 其中-v 表示的是排除的意思,就是過濾包含grep的行,既排除自己
測試snmp服務正常
[root@test tools]# snmpget -v 1 -c public localhost system.sysUpTime.0
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (74930) 0:12:29.30
查看日誌信息。
[root@C-SERVER ~]# tail -10 /var/log/snmpd.log (第二次裝沒有路徑了懷疑和配置有關)編譯默認有日誌
tail: cannot open `/var/log/snmpd.log' for reading: No such file or directory
編譯時候的日誌信息如下
至此:SNMP配置完成啦---
RRDTool簡單介紹
RRDtool (Round Robin Database Tool)就是一個強大的繪圖的引擎,很多工具例如MRTG都可以調用rrdtool繪圖。[1]
RRDtool是由Tobias Oetiker 編寫並由全球各地的許多人貢獻的工具。本篇文檔的作者是Alex van den Bogaerdt 主要是幫助你理解RRDtool是什麼,它能夠幫助你做些什麼。 RRDtool的文檔對於有些人來說過於技術化。本教程幫助你理解RRDtool的基本概念。它爲你自學RRDtool的文檔做好準備。本文檔還重點介紹了網絡統計方面的知識。
你可以一直往下走下去。RRDtool處理RRD數據庫。它向RRD數據庫存儲數據、從RRD數據庫中提取數據。
詳細介紹:http://baike.baidu.com/link?url=DjklERYJFa1bJKdjrPmezC0MS51cMIa9UuY1Mmv_M5Etao-cjRrRowMyQTdM97xZyk4T28hKTo9rIrgi9yUmbK
RRDTool安裝完整的命令集
#安裝libart_lgp
mkdir /home/oldboy/tools
cd /home/oldboy/tools
rz
tar xf cacti_tools.tar.gz
tree
cd cacti_tools
ll
tar zxf libart_lgpl-2.3.17.tar.gz
cd libart_lgpl-2.3.17
./configure
make && make install
/bin/cp -r /usr/local/include/libart-2.0 /usr/include
cd ../
#安裝RRDTool
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.30.tar.gz
tar xf rrdtool-1.2.30.tar.gz
cd rrdtool-1.2.30
yum install gcc libxml2-devel libpng-devel pkg-config glib pixman pango pango-devel #不安裝的話./configure 不成功
./configure
make && make install
ls -l /usr/local/bin/rrdtool #提示做軟連接否則找不到路徑
ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool /usr/local/bin/rrdtool
ls -l /usr/local/bin/rrdtool
cd ../
yum 安裝LAMP 環境命令集
yum install gcc glibc glibc-common cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel -y
yum install mysql* httpd* php* --skip-broken -y
配置apache的命令集
完整的命令
cd ../
cd /etc/httpd/conf
cp httpd.conf httpd.conf.oldboy.ori
sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf
sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf
egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf
正確結果
ServerName 127.0.0.1:80
DirectoryIndex index.php index.html
解析以上命令含義。
啓動Apache的檢查命令集合
/etc/init.d/httpd start
lsof -i :80
netstat -lntup|grep 80
ss -lntup|grep 80
grep DocumentRoot httpd.conf
grep DocumentRoot httpd.conf 查看的站點目錄
編輯PHPinfo的測試文件命令集
echo -e "<?php \nphpinfo(); \n?>" >/var/www/html/index.php
cat /var/www/html/index.php
rm -f /var/www/html/index.php
提示測試正常後移除PHPinfo的文件。以防外來人員搗亂。
rm -f /var/www/html/index.php
到此去界面查看有PHP界面表示LANP 環境OK。可以部署cacti軟件啦。輸入自己的ifconfig eth0的地址。外網地址。
---部署cacti軟件
啓動mysql服務
cd ~
/etc/init.d/mysqld start
lsof -i :3306
ps -ef|grep mysql
創建用戶cactiuser 密碼也是cactiuser
mysql
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';
flush privileges;
create database cacti;
show databases;
quit
下載解壓cacti 監控軟件
一種方式
wget http://www.catci.net/downloads/catci-0.8.8a.tar.gz
tar xf cacti-0.8.8a.tar.gz
cd cacti-0.8.8a
我操作的方式。
cd /home/oldboy/tools/
cd cacti_tools
tar xf cacti-0.8.8a.tar.gz
cd cacti-0.8.8a
初始化數據庫
mysql cacti <cacti.sql
查看數據庫多出來的表
mysql -e "use cacti;show tables;"
####如果按照此文檔按照不需要辯解以下配文件(默認設定好)
可以查看下cacti配置文件,實際環境需要改紅色部分。
[root@test cacti-0.8.8a]#grep database include/config.php
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
$database_ssl = false;
授權Apache用戶訪問的cacti的rra和log目錄
chown -R apache rra/ log/
mv ../cacti-0.8.8a /var/www/html/cacti
#yum安裝的Apache的服務用戶就是Apache所以授權Apache用戶。
查看授權的狀態
cd /var/www/html/
ll cacti/
ll
chown -R apache.apache cacti
測試定時收集數據php文件(只要此步驟不錯就OK啦)
/usr/bin/php /var/www/html/cacti/poller.php
出現以下錯誤:
sh: -q: command not found
sh: -: command not found
解決辦法:
chmod 755 /var/www/html/cacti/poller.php
提示:要是您不放心的話再次執行的話有可能出現結果,顯示些ok之類的樣式。、類似以下的不是報錯。
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /var/www/html/cacti/lib/functions.php on line 486
09/21/2015 06:20:22 AM - SYSTEM STATS: Time:16.8473 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:9 RRDsProcessed:0
做定時任務收集數據
echo '*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >>/var/spool/cron/root
crontab -l
沒事可以查看下PHP的程序
cat /var/www/html/cacti/poller.php
cacti的後臺操作界面
自己執行,演練。
netstat -lntup|grep 161
/etc/init.d/iptables stop
cacti成功部署完成。
SNMP 協議是UDP的
#安裝libart_lgp 詳細過程、
[root@C-SERVER ~]# mkdir /home/oldboy/tools
[root@C-SERVER ~]# cd /home/oldboy/tools
[root@C-SERVER tools]# rz
rz waiting to receive.
正在開始 zmodem 傳輸。 按 Ctrl+C 取消。
正在傳輸 cacti_tools.tar.gz...
正在傳輸 cacti_tools.tar.gz...
100% 3675 KB 3675 KB/s 00:00:01 0 錯誤
?]0;root@C-SERVER:/home/oldboy/tools[root@C-SERVER tools]# ll
total 3680
-rw-r--r-- 1 root root 3764176 Aug 22 19:05 cacti_tools.tar.gz
[root@C-SERVER tools]# tar xf cacti_tools.tar.gz
[root@C-SERVER tools]# tree
.
|-- cacti_tools
| |-- cacti-0.8.8a.tar.gz
| |-- get_netstat_conn.zip
| |-- libart_lgpl-2.3.17.tar.gz
| |-- rrdtool-1.2.30.tar.gz
| `-- snmpd.conf
`-- cacti_tools.tar.gz
1 directory, 6 files
[root@C-SERVER tools]# cd cacti_tools
[root@C-SERVER cacti_tools]# ll
total 3700
-rw-r--r-- 1 root root 2273280 Apr 30 08:35 cacti-0.8.8a.tar.gz
-rw-r--r-- 1 root root 6101 Aug 21 22:31 get_netstat_conn.zip
-rw-r--r-- 1 root root 395528 Aug 29 2010 libart_lgpl-2.3.17.tar.gz
-rw-r--r-- 1 root root 1092483 Jan 19 2009 rrdtool-1.2.30.tar.gz
-rw-r--r-- 1 root root 821 Aug 22 19:05 snmpd.conf
[root@C-SERVER cacti_tools]# tar zxf libart_lgpl-2.3.17.tar.gz
[root@C-SERVER cacti_tools]# cd libart_lgpl-2.3.17
[root@C-SERVER libart_lgpl-2.3.17]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets $(MAKE)... yes
checking for working aclocal-1.4... found
checking for working autoconf... found
checking for working automake-1.4... found
checking for working autoheader... found
checking for working makeinfo... found 以下太多詳見 操作日誌。
正確結果
config.status: executing default-1 commands
config.status: executing default commands
[root@C-SERVER libart_lgpl-2.3.17]# make
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -I. -DLIBART_COMPILATION -g -O2 -Wall -Wmissing-prototypes -c gen_art_config.c
/bin/sh ./libtool --mode=link gcc -g -O2 -Wall -Wmissing-prototypes -o gen_art_config gen_art_config.o
mkdir .libs
gcc -g -O2 -Wall -Wmissing-prototypes -o gen_art_config gen_art_config.o
./gen_art_config > art_config.h
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -I. -DLIBART_COMPILATION -g -O2 -Wall -Wmissing-prototypes -c art_affine.c
正確結果
creating testuta
cp -f libart-config libart2-config
[root@C-SERVER libart_lgpl-2.3.17]# make install 以下太多詳見 操作日誌。
make[1]: Entering directory `/home/oldboy/tools/cacti_tools/libart_lgpl-2.3.17'
/bin/sh ./mkinstalldirs /usr/local/lib
/bin/sh ./libtool --mode=install /usr/bin/install -c libart_lgpl_2.la /usr/local/lib/libart_lgpl_2.la
/usr/bin/install -c .libs/libart_lgpl_2.so.2.3.17 /usr/local/lib/libart_lgpl_2.so.2.3.17
(cd /usr/local/lib && rm -f libart_lgpl_2.so.2 && ln -s libart_lgpl_2.so.2.3.17 libart_lgpl_2.so.2)
(cd /usr/local/lib && rm -f libart_lgpl_2.so && ln -s libart_lgpl_2.so.2.3.17 libart_lgpl_2.so)
/usr/bin/install -c .libs/libart_lgpl_2.lai /usr/local/lib/libart_lgpl_2.la
/usr/bin/install -c .libs/libart_lgpl_2.a /usr/local/lib/libart_lgpl_2.a
ranlib /usr/local/lib/libart_lgpl_2.a
chmod 644 /usr/local/lib/libart_lgpl_2.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/lib
正確結果
/usr/bin/install -c -m 644 libart-features.h /usr/local/include/libart-2.0/libart_lgpl/libart-features.h
make[1]: Leaving directory `/home/oldboy/tools/cacti_tools/libart_lgpl-2.3.17'
[root@C-SERVER libart_lgpl-2.3.17]# /bin/cp -r /usr/local/include/libart-2.0 /usr/include
[root@C-SERVER libart_lgpl-2.3.17]# cd ../
安裝RRDTool詳細過程
[root@C-SERVER cacti_tools]# tar xf rrdtool-1.2.30.tar.gz
[root@C-SERVER cacti_tools]# cd rrdtool-1.2.30
[root@C-SERVER rrdtool-1.2.30]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
正確結果
make me happy. Go to http://tobi.oetiker.ch/wish and
place an order.
-- Tobi Oetiker <[email protected]>
----------------------------------------------------------------
[root@C-SERVER cacti_tools]#make && make install
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.30.tar.gz
tar xf rrdtool-1.2.30.tar.gz
cd rrdtool-1.2.30
yum install gcc libxml2-devel libpng-devel pkg-config glib pixman pango pango-devel #不安裝的話./configure 不成功
./configure
make && make install
ls -l /usr/local/bin/rrdtool #提示做軟連接否則找不到路徑
[root@test rrdtool-1.2.30]# ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool /usr/local/bin/rrdtool
-rwxr-xr-x 1 root root 6791 9月 21 03:17 /usr/local/rrdtool-1.2.30/bin/rrdtool
[root@test rrdtool-1.2.30]# ls -l /usr/local/bin/rrdtool
lrwxrwxrwx 1 root root 37 9月 21 03:26 /usr/local/bin/rrdtool -> /usr/local/rrdtool-1.2.30/bin/rrdtool
[root@test rrdtool-1.2.30]# cd ../
yum安裝LAMP環境
[root@C-SERVER rrdtool-1.2.30]# yum install gcc glibc glibc-common cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel -y
正確結果
Dependency Updated:
cpp.x86_64 0:4.1.2-52.el5_8.1 gcc-c++.x86_64 0:4.1.2-52.el5_8.1
gcc-gfortran.x86_64 0:4.1.2-52.el5_8.1 glibc-devel.i386 0:2.5-81.el5_8.4
glibc-devel.x86_64 0:2.5-81.el5_8.4 glibc-headers.x86_64 0:2.5-81.el5_8.4
libgcc.i386 0:4.1.2-52.el5_8.1 libgcc.x86_64 0:4.1.2-52.el5_8.1
libgfortran.x86_64 0:4.1.2-52.el5_8.1 libstdc++.i386 0:4.1.2-52.el5_8.1
libstdc++.x86_64 0:4.1.2-52.el5_8.1 libstdc++-devel.x86_64 0:4.1.2-52.el5_8.1
nscd.x86_64 0:2.5-81.el5_8.4
Complete!
[root@C-SERVER rrdtool-1.2.30]# yum install mysql* httpd* php* --skip-broken -y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
Setting up Install Process
Package php-dbase is obsoleted by php-common, trying to install php-common-5.1.6-39.el5_8.x86_64 instead
Resolving Dependencies
--> Running transaction check 以下太多沒寫
正確結果:
Skipped (dependency problems):
php53.x86_64 0:5.3.3-13.el5_8 php53-bcmath.x86_64 0:5.3.3-13.el5_8
php53-cli.x86_64 0:5.3.3-13.el5_8 php53-common.x86_64 0:5.3.3-13.el5_8
php53-dba.x86_64 0:5.3.3-13.el5_8 php53-devel.x86_64 0:5.3.3-13.el5_8
php53-gd.x86_64 0:5.3.3-13.el5_8 php53-imap.x86_64 0:5.3.3-13.el5_8
php53-intl.x86_64 0:5.3.3-13.el5_8 php53-ldap.x86_64 0:5.3.3-13.el5_8
php53-mbstring.x86_64 0:5.3.3-13.el5_8 php53-mysql.x86_64 0:5.3.3-13.el5_8
php53-odbc.x86_64 0:5.3.3-13.el5_8 php53-pdo.x86_64 0:5.3.3-13.el5_8
php53-pgsql.x86_64 0:5.3.3-13.el5_8 php53-process.x86_64 0:5.3.3-13.el5_8
php53-pspell.x86_64 0:5.3.3-13.el5_8 php53-snmp.x86_64 0:5.3.3-13.el5_8
php53-soap.x86_64 0:5.3.3-13.el5_8 php53-xml.x86_64 0:5.3.3-13.el5_8
php53-xmlrpc.x86_64 0:5.3.3-13.el5_8
Complete!
[root@C-SERVER rrdtool-1.2.30]# cd ../
[root@C-SERVER cacti_tools]# cd /etc/httpd/conf
[root@C-SERVER conf]# cp httpd.conf httpd.conf.oldboy.ori
sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf
sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf
egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf
[root@C-SERVER conf]# sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf
[root@C-SERVER conf]# sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf
[root@C-SERVER conf]# egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
DirectoryIndex index.php index.html
[root@C-SERVER conf]# /etc/init.d/httpd start
Starting httpd: [ OK ]
[root@C-SERVER conf]# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 14804 root 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14806 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14807 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14808 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14809 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14810 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14811 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14812 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)
httpd 14813 apache 3u IPv6 69944 0t0 TCP *:http (LISTEN)