1. 程式人生 > >Ganglia對Flume的監控

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 {
    name = "sivan"
    owner = "unspecified"
    latlong = "unspecified"
    url = "unspecified"
}
udp_send_channel {
    #bind_hostname = yes # Highly recommended, soon to be default.
            # This option tells gmond to use a source address
            # that resolves to the machine's hostname. Without
            # this, the metrics may appear to come from any
            # interface and the DNS names associated with
            # those IPs will be used to create the RRDs.

     # mcast_join = 239.2.11.71

     host = 172.19.225.156

     port = 8649

     ttl = 1
}
udp_recv_channel {
    # mcast_join = 239.2.11.71
    port = 8649
    bind = 172.19.225.156
    retry_bind = true
    # Size of the UDP buffer. If you are handling lots of metrics you really
    # should bump it up to e.g. 10MB or even higher.
    # buffer = 10485760
}

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