1、安装ganglia参考之前的一篇博客(以下示例使用ganglia组播方式,单播方式大家自己尝试)
创新互联-云计算及IDC服务提供商,涵盖公有云、IDC机房租用、四川绵阳服务器托管、等保安全、私有云建设等企业级互联网基础服务,服务热线:028-86922220http://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懒得上图了,大家可以明白了,不明白的去面壁去
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前名称:ganglia3.6.1+jmxtrans+strom-0.9.4集成-创新互联
文章源于:http://lswzjz.com/article/gipeh.html