1、安裝ganglia參考之前的一篇博客(以下示例使用ganglia組播方式,單播方式大家自己嘗試)
創(chuàng)新互聯(lián)-云計算及IDC服務(wù)提供商,涵蓋公有云、IDC機(jī)房租用、四川綿陽服務(wù)器托管、等保安全、私有云建設(shè)等企業(yè)級互聯(lián)網(wǎng)基礎(chǔ)服務(wù),服務(wù)熱線: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節(jié)點的jvm信息,以下文件僅列舉了部分參數(shù),如果有需要可以增加queries中的數(shù)據(jù),以監(jiān)控更多的參數(shù),具體的MBean的參數(shù),可以通過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是主機(jī)名,如果寫ip的話,在ganglia里同一個節(jié)點會有兩個顯示,看著有點別扭,大家都統(tǒng)一使用hostname就好.ganglia的gmnod和gmetad不需要重啟,用自動收集。
說明:
修改json文件需要重新啟動jmxtrans,查看jmxtrans日志/var/log/jmxtrans/jmxtrans.log.
service jmxtrans restart
下面來張ganglia的主界面,監(jiān)控兩個節(jié)點
上圖顯示不出來監(jiān)控指標(biāo),就放下面來了,可以看到supervisor的監(jiān)控數(shù)據(jù)已經(jīng)收集到ganglia里了。
下圖搞了master節(jié)點的頁面,可以看到nimbus group的監(jiān)控數(shù)據(jù)已經(jīng)顯示,node1節(jié)點的supervisor group懶得上圖了,大家可以明白了,不明白的去面壁去
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。