FlumeNG的监控

FlumeNG的监控

目前FlumeNG支持以下的几种监控方式:

JMX

Ganglia

Json

1、开启JMX方式

在flume-env.sh的JAVA_OPTS中添加如下配置:

-Dcom.sun.management.jmxremote 

-Dcom.sun.management.jmxremote.port=54321(未用的端口号) 

-Dcom.sun.management.jmxremote.authenticate=false 

-Dcom.sun.management.jmxremote.ssl=false

在window端可以通过jconsole YOUR_HOSTNAME: 54321  来访问FlumeNG的jmx信息

2、开启Ganglia方式

在启动agent时需要传递flume.monitoring.type和flume.monitoring.hosts两个属性,启动命令如下:

bin/flume-ng agent --conf-file example.conf --name a1 -Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=com.example:1234,com.example2:5455

我们实战的使用方式如下:

flume-ng agent -n a1 -c conf/ -f conf/tt -Dflume.monitoring.type=http -Dflume.monitoring.port=8888

3、Json服务器方式

当启动agent时,我们可以传递flume.monitoring.type和flume.monitoring.port两个属性,从而实现在port指定的端口上启动一个server

bin/flume-ng agent --conf-file example.conf --name a1 -Dflume.monitoring.type=http -Dflume.monitoring.port=34545

之后,我们可以通过http://<hostname>:<port>/metrics来取得metrics信息

Json串的格式如下:

{"typeName1.componentName1" : {"metric1" : "metricValue1", "metric2" : "metricValue2"},"typeName2.componentName2" : {"metric3" : "metricValue3", "metric4" : "metricValue4"}}

demo:

{"CHANNEL.fileChannel":{"EventPutSuccessCount":"468085",
                      "Type":"CHANNEL",
                      "StopTime":"0",
                      "EventPutAttemptCount":"468086",
                      "ChannelSize":"233428",
                      "StartTime":"1344882233070",
                      "EventTakeSuccessCount":"458200",
                      "ChannelCapacity":"600000",
                      "EventTakeAttemptCount":"458288"},"CHANNEL.memChannel":{"EventPutSuccessCount":"22948908",
                   "Type":"CHANNEL",
                   "StopTime":"0",
                   "EventPutAttemptCount":"22948908",
                   "ChannelSize":"5",
                   "StartTime":"1344882209413",
                   "EventTakeSuccessCount":"22948900",
                   "ChannelCapacity":"100",
                   "EventTakeAttemptCount":"22948908"}}

猜你喜欢

转载自sjy-showtime.iteye.com/blog/2071129