十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1、安装ganglia参考之前的一篇博客(以下示例使用ganglia组播方式,单播方式大家自己尝试)
为井陉矿等地区用户提供了全套网页设计制作服务,及井陉矿网站建设行业解决方案。主营业务为成都网站制作、网站建设、井陉矿网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
http://chengyanbin.blog.51cto.com/3900113/1591373
2、安装jmxtrans
http://chengyanbin.blog.51cto.com/3900113/1654754
3、安装storm
http://chengyanbin.blog.51cto.com/3900113/1654757
4、修改storm配置文件storm..yaml
###nimbus config nimbus.childopts: "-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=12345 -Xmx1024m" ###supervisor config supervisor.childopts: "-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=12346 -Xmx256m"
5、为jmxtrans增加两个json文件
分别获取nimbus和supervisor节点的jvm信息,以下文件仅列举了部分参数,如果有需要可以增加queries中的数据,以监控更多的参数,具体的MBean的参数,可以通过jconsole来查看
nimbus.json
{ "servers": [ { "host": "master", "port": "12345", "queries": [ { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "nimbus", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:type=Memory", "resultAlias": "nimbus.heap", "attr": [ "ObjectPendingFinalizationCount" ] }, { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "nimbus", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:name=Copy,type=GarbageCollector", "resultAlias": "nimbus.gc", "attr": [ "CollectionCount", "CollectionTime" ] }, { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "nimbus", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:name=Code Cache,type=MemoryPool", "resultAlias": "nimbus.threads", "attr": [ "CollectionUsageThreshold", "CollectionUsageThresholdCount", "UsageThreshold", "UsageThresholdCount" ] }, { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "nimbus", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:type=Runtime", "resultAlias": "nimbus.runtime", "attr": [ "StartTime", "Uptime" ] } ], "numQueryThreads": 2 } ] }
supervisor.json
{ "servers": [ { "host": "node1", "port": "12346", "queries": [ { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "supervisor", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:type=Memory", "resultAlias": "supervisor.heap", "attr": [ "ObjectPendingFinalizationCount" ] }, { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "supervisor", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:name=Copy,type=GarbageCollector", "resultAlias": "supervisor.gc", "attr": [ "CollectionCount", "CollectionTime" ] }, { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "supervisor", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:name=Code Cache,type=MemoryPool", "resultAlias": "supervisor.threads", "attr": [ "CollectionUsageThreshold", "CollectionUsageThresholdCount", "UsageThreshold", "UsageThresholdCount" ] }, { "outputWriters": [ { "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter", "settings": { "groupName": "supervisor", "host": "239.2.11.71", "port": "8649" } } ], "obj": "java.lang:type=Runtime", "resultAlias": "supervisor.runtime", "attr": [ "StartTime", "Uptime" ] } ], "numQueryThreads": 2 } ] }
两个json文件一定要注意host是主机名,如果写ip的话,在ganglia里同一个节点会有两个显示,看着有点别扭,大家都统一使用hostname就好.ganglia的gmnod和gmetad不需要重启,用自动收集。
说明:
修改json文件需要重新启动jmxtrans,查看jmxtrans日志/var/log/jmxtrans/jmxtrans.log.
service jmxtrans restart
下面来张ganglia的主界面,监控两个节点
上图显示不出来监控指标,就放下面来了,可以看到supervisor的监控数据已经收集到ganglia里了。
下图搞了master节点的页面,可以看到nimbus group的监控数据已经显示,node1节点的supervisor group懒得上图了,大家可以明白了,不明白的去面壁去