ganglia3.6.1+jmxtrans+strom-0.9.4集成

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的主界面,监控两个节点

wKiom1Vhw3nCBgzWAAlYkzA0ce8396.jpg

上图显示不出来监控指标,就放下面来了,可以看到supervisor的监控数据已经收集到ganglia里了。

wKiom1Vhw3mi12hpAAZfzJ9W5tU476.jpg

下图搞了master节点的页面,可以看到nimbus group的监控数据已经显示,node1节点的supervisor group懒得上图了,大家可以明白了,不明白的去面壁去j_0059.gif

wKioL1VhxQaiKlK2AAiSbnnLzQY490.jpg


你可能感兴趣的:(storm,集成,ganglia)