ganglia 是分佈式的監控系統,有兩個Daemon, 分別是:客戶端Ganglia Monitoring Daemon(gmond)和服務端Ganglia Meta Daemon (gmetad),還有Ganglia PHP Web Frontend(基於web的動態訪問方式)組成是一個Linux下圖形化監控系統運行性能的軟件,界面美觀、豐富,功能強大
http://ganglia.sourceforge.net/ 軟件下載php
實驗環境:
物理主機 redhat7.0 內核版本 3.10.0-123.el7.x86_64
虛擬機 redhat6.5 內核版本 2.6.32-431.el6.x86_64
服務器端: server1.example.com 172.25.254.1
客戶端: server2.example.com 172.25.254.2
所需軟件包:
ganglia-3.4.0.tar.gz
rrdtool-devel-1.3.8-6.el6.x86_64.rpm
ganglia-web-3.4.2.tar.gz
libconfuse-2.6-3.el6.x86_64.rpm
libconfuse-devel-2.6-3.el6.x86_64.rpm
alert-agent-4.1.3.1-linux-x64.tar.gzhtml
1。服務器端配置
python
1.1使用源碼包編譯rpm包安裝
linux
[root@server1 ~]# yum install rpm-build -y
[root@server1 ~]# rpmbuild -tb ganglia-3.4.0.tar.gz ##會顯示須要如下 依賴包,安裝便可c++
error: Failed build dependencies:
libpng-devel is needed by ganglia-3.4.0-1.x86_64
libart_lgpl-devel is needed by ganglia-3.4.0-1.x86_64
gcc-c++ is needed by ganglia-3.4.0-1.x86_64
python-devel is needed by ganglia-3.4.0-1.x86_64
libconfuse-devel is needed by ganglia-3.4.0-1.x86_64
pcre-devel is needed by ganglia-3.4.0-1.x86_64
autoconf is needed by ganglia-3.4.0-1.x86_64
automake is needed by ganglia-3.4.0-1.x86_64
libtool is needed by ganglia-3.4.0-1.x86_64
expat-devel is needed by ganglia-3.4.0-1.x86_64
rrdtool-devel is needed by ganglia-3.4.0-1.x86_64
freetype-devel is needed by ganglia-3.4.0-1.x86_64
apr-devel > 1 is needed by ganglia-3.4.0-1.x86_64
[root@server1 ~]# yum install libart_lgpl-devel gcc-c++ python-devel libconfuse-devel pcre-devel expat-devel rrdtool-devel apr-devel -y
[root@server1 ~]# yum install libconfuse-* rrdtool-devel-1.3.8-6.el6.x86_64.rpm -y
[root@server1 ~]# rpmbuild -tb ganglia-3.4.0.tar.gzerror: Failed build dependencies:
libpng-devel is needed by ganglia-3.4.0-1.x86_64
autoconf is needed by ganglia-3.4.0-1.x86_64
automake is needed by ganglia-3.4.0-1.x86_64
libtool is needed by ganglia-3.4.0-1.x86_64
freetype-devel is needed by ganglia-3.4.0-1.x86_64
[root@server1 ~]# yum install libpng-devel autoconf automake libtool freetype-devel -y
[root@server1 ~]# rpmbuild -tb ganglia-3.4.0.tar.gz ##再次執行就好咯!web
[root@server1 ~]# cd /root/rpmbuild/RPMS/x86_64/
[root@server1 x86_64]# ls
ganglia-devel-3.4.0-1.x86_64.rpm
ganglia-gmetad-3.4.0-1.x86_64.rpm ##服務器端的vim
ganglia-gmond-3.4.0-1.x86_64.rpm ##客戶端的瀏覽器
ganglia-gmond-modules-python-3.4.0-1.x86_64.rpm ##支持python的客戶端的服務器
libganglia-3.4.0-1.x86_64.rpm分佈式
1.2服務器端安裝ganglia軟件
[root@server1 x86_64]# yum install ganglia-gmetad-3.4.0-1.x86_64.rpm libganglia-3.4.0-1.x86_64.rpm ganglia-gmond-3.4.0-1.x86_64.rpm -y
1.3將編譯好的客戶端rpm包複製到客戶端
[root@server1 x86_64]# scp -r libganglia-3.4.0-1.x86_64.rpm ganglia-gmond-3.4.0-1.x86_64.rpm ganglia-gmond-modules-python-3.4.0-1.x86_64.rpm 172.25.254.2:/root
[root@server1 x86_64]# ls /root/libconfuse-*
/root/libconfuse-2.6-3.el6.x86_64.rpm
/root/libconfuse-devel-2.6-3.el6.x86_64.rpm
[root@server1 x86_64]# scp -r /root/libconfuse-* 172.25.254.2:/root
1.4修改配置文件
[root@server1 x86_64]# cd /etc/ganglia/
[root@server1 ganglia]# vim gmetad.conf
#修改44行爲:
44 data_source "willis cluster" localhost 172.25.254.2
[root@server1 ganglia]# vim gmond.conf
##修改24行爲:
24 name = "willis cluster"
1.5 網頁端監控配置
[root@server1 ganglia]# cd /root/
[root@server1 ~]# rpm -tb ganglia-web-3.4.2.tar.gz
[root@server1 ~]# yum install php php-gd -y ##提示什麼就裝什麼
[root@server1 ~]# rpm -tb ganglia-web-3.4.2.tar.gz
[root@server1 ~]# cd /var/www/html/
[root@server1 html]# ls
gweb #有生成一個gweb目錄就是網頁監控端目錄
1.6 啓動服務器端
[root@server1 ganglia]# /etc/init.d/gmond start
Starting GANGLIA gmond: [ OK ]
[root@server1 ganglia]# /etc/init.d/gmetad start
Starting GANGLIA gmetad: [ OK ]
2.被監控客戶端配置
[root@server2 ~]# rpm -ivh ganglia-gmond-3.4.0-1.x86_64.rpm lib*
[root@server2 ~]# rpm -ivh ganglia-gmond-modules-python-3.4.0-1.x86_64.rpm
[root@server2 ~]# cd /etc/ganglia/
[root@server2 ganglia]# vim gmond.conf
24 name = "willis cluster"
[root@server2 ganglia]# /etc/init.d/gmond start
Starting GANGLIA gmond: [ OK ]
3.瀏覽器訪問測試
訪問 172.25.254.1 /gweb,若是沒有顯示節點,且在服務器端server1上的/var/lib/ganglia/rrds路徑下沒有文件
則在服務器和客戶端都作以下動做:
<1>ip route add 239.2.11.71 dev eth0
<2>route -n
********************************************************************
[root@server1 objects]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
239.2.11.71 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
172.25.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
********************************************************************
<3>/etc/init.d/gmond restart
/etc/init.d/gmetad restart
<4>cd /var/lib/ganglia/rrds
ls有__SummaryInfo__ 和 willis cluster兩個目錄 ##willis cluster裏有全部局域網內可監控到的IP,包括本身
<5>瀏覽器再刷新訪問 172.25.254.1/gweb就行了!
查看服務器server1節點
查看客戶端server2節點