Ganglia對Flume的監控
Ganglia的安裝與部署
1.安裝httpd服務與php
>sudo yum -y install httpd php
2.安裝其他依賴
>sudo yum -y install rrdtool perl-rrdtool rrdtool-devel
>sudo yum -y install apr-devel
3.安裝ganglia
>sudo yum -y install epel-release
>sudo yum -y install ganglia-gmetad
>sudo yum -y install ganglia-web
>sudo yum install -y ganglia-gmond
4.修改配置檔案ganglia.conf
>sudo vim /etc/httpd/conf.d/ganglia.conf
# Ganglia monitoring system php web frontend # Alias /ganglia /usr/share/ganglia <Location /ganglia> Require all granted # Require local # Require ip 10.1.2.3 # Require host example.org </Location> |
5.修改配置檔案gmetad.conf
>sudo vim /etc/ganglia/gmetad.conf
修改,其中sivan是主機名,172.19.225.156是ip(主機名不能為大寫)
data_source "sivan" 172.19.225.156
6.修改配置檔案gmond.conf
>sudo vim /etc/ganglia/gmond.conf
修改為,主機名和ip與上面配置一致
cluster { # mcast_join = 239.2.11.71 host = 172.19.225.156 port = 8649 ttl = 1 |
7.修改配置檔案config
>sudo vim /etc/selinux/config
修改為
SELINUX=disabled
注意,selinux本次生效關閉必須重啟,如果此時不想重啟,可以執行下面命令臨時生效之
sudo setenforce 0
8.啟動ganglia
>sudo service httpd start
>sudo service gmetad start
>sudo service gmond start
9.開啟網頁瀏覽ganglia頁面
172.19.225.156/ganglia
注意,如果完成以上操作依然出現許可權不足錯誤,請修改/var/lib/ganglia目錄的許可權,執行下面命令
>sudo chmod -R 777 /var/lib/ganglia
操作Flume測試監控
1.修改$FLUME_HOME/conf目錄下的flume-env.sh配置
export JAVA_OPTS="-Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=172.19.225.156:8649 -Xms100m -Xmx200m"
2.啟動flume任務
>flume-ng agent -c /home/sivan/software/flume/apache-flume-1.8.0-bin/conf -f /home/sivan/agent.conf -n agent_test -Dflume.root.logger=INFO,console -Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=172.19.225.156:8649
(-n agent_test的name必須和agent配置的name一致)
3.檢視監控結果
Grid > sivan > sivan