分佈式監控 工具Ganglia介紹與集羣部署
使用Ganglia來監控物理機
Ganglia的監控包括gmond、gmetad以及一個web前端。
gmond(GangliaMonitoring Deamon)是一種輕量級服務,安裝在每臺需要收集指標數據的節點主機上,gmond在每臺主機上完成實際意義上的指標數據收集工作,並通過偵聽/通告協議和集羣內其他節點共享數據。使用gmond,你可以很容易收集很多系統指標數據,如CPU、內存、磁盤、網絡和活躍進程的數據等。
gmetad(GangliaMeta Daemon)是一種從其他gmetad或gmond源收集指標數據,並將其以RRD格式存儲至磁盤的服務。gmetad爲從主機組收集的特定指標信息提供了簡單的查詢機制,並支持分級授權,使得創建聯合監測域成爲可能。
gweb(GangliaWeb)是一種利用瀏覽器顯示gmetad所存儲數據的PHP前端。在Web界面中以圖表方式展現集羣的多種不同指標數據。
本人使用的操作系統是Ubuntu14.04
安裝
master端:
sudo apt-get install ganglia-monitor rrdtoolgmetad ganglia-webfrontend
cp/etc/ganglia-webfrontend/apache.
conf/etc/apache2/sites-enabled/ganglia.
conf
slave端
sudo apt-
getinstall ganglia-monitor
修改配置
sudo vi /etc/ganglia/gmetad.conf
更改內容爲:
data_source "my cluster" localhost
修改爲:
data-source標識一個要監控的集羣
格式爲:data_source “my cluster” [polling interval] address1:port address2:port address3:port …………..
一般情況下默認端口port爲8649
sudo vi /etc/ganglia/gmond.conf
修改內容:
/* If a cluster attribute is specified, then all gmond hosts are wrapped inside
* of a tag. If you do not specify a cluster tag, then all will
* NOT be wrapped inside of a tag. */
cluster
{
name =
"unspecified"
owner =
"unspecified"
latlong =
"unspecified"
url =
"unspecified"
}
修改爲:
cluster {
name =
"my cluster"
owner =
"unspecified"
latlong =
"unspecified"
url =
"unspecified"
}
修改內容:
/* Feel free to specify as many udp_send_channels as you like. Gmond
used to only support having a single channel */
udp_send_channel {
mcast_join =
239.2.11.71
port =
8649
ttl =
1
}
修改爲:
//修改爲:
/* Feel free to specify as many udp_send_channels as you like. Gmond
used to only support having a single channel */
udp_send_channel {
#mcast_join =
239.2.11.71
host =
192.168.56.10 host爲master主機的ip地址
port =
8649
ttl =
1
}
修改內容:
/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
mcast_join =
239.2.11.71
port =
8649
bind =
239.2.11.71
}
修改爲:
/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
#mcast_join =
239.2.11.71
port =
8649
#bind =
239.2.11.71
}
驗證是否工作
telnetlocalhost 8649
通過對端口的監聽獲取xml數據觀察,ganglia是否處於工作狀態
重啓服務
sudo/etc/init.d/ganglia-monitor start
sudo/etc/init.d/gmetad start
sudo/etc/init.d/apache2 restart
slave端的操作
sudo apt-
getinstall ganglia-monitor
修改文件:
sudo vi /etc/ganglia/gmond.conf
修改信息同上
啓動服務;
sudo/etc/init.d/ganglia-monitor start
配置完成
訪問頁面:localhost/ganglia