Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1584680
  • 博文数量: 399
  • 博客积分: 8508
  • 博客等级: 中将
  • 技术积分: 5302
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-14 09:28
个人简介

能力强的人善于解决问题,有智慧的人善于绕过问题。 区别很微妙,小心谨慎做后者。

文章分类

全部博文(399)

文章存档

2018年(3)

2017年(1)

2016年(1)

2015年(69)

2013年(14)

2012年(17)

2011年(12)

2010年(189)

2009年(93)

分类: 系统运维

2015-05-18 10:43:01

    最近storm集群由于一些不知名原因导致storm集群中有些任务不能正常启动执行(好几个项目再用),所以想弄个监控系统将storm集群的状态给监控起来并做相应的报警处理。最后选定了开源的监控平台ganglia。通过查阅相关资料,ganglia可以使用jmxtrans来对storm进行监控,jmxtrans作为ganglia与storm之间的通信桥梁。
1. 下载并安装jmxtrans
    可以使用wget下载
    wget
    sudo rpm -i jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm
    安装好后的jmxtrans目录在/usr/share/jmxtrans,配置文件在/etc/sysconfig/jmxtrans目录,监控storm的json脚本放在/var/lib/jmxtrans目录。
2. 修改storm配置
    在storm配置文件storm.yaml中加入如下两个参数:
    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"
    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"
    端口号12345和12346可以随便设置,最好是没有用的或不常用的端口号
3. 编写监控脚本
    supervisor.json

点击(此处)折叠或打开

  1. {
  2. "servers" : [ {
  3. "port" : "12346",
  4. "host" : "IP_OF_SUPERVISOR_MACHINE",
  5. "queries" : [ {
  6. "outputWriters": [{
  7. "@class":"com.googlecode.jmxtrans.model.output.GangliaWriter",
  8. "settings": {
  9. "groupName": "supervisor",
  10. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  11. "port": "8649" }
  12. }],
  13. "obj": "java.lang:type=Memory",
  14. "resultAlias": "supervisor",
  15. "attr": ["ObjectPendingFinalizationCount"]
  16. },
  17. {
  18. "outputWriters": [{
  19. "@class":"com.googlecode.jmxtrans.model.output.GangliaWriter",
  20. "settings": {
  21. "groupName": "supervisor",
  22. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  23. "port": "8649"
  24. }
  25. }],
  26. "obj": "java.lang:name=Copy,type=GarbageCollector",
  27. "resultAlias": "supervisor",
  28. "attr": [
  29. "CollectionCount",
  30. "CollectionTime"
  31. ]
  32. },
  33. {
  34. "outputWriters": [{
  35. "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
  36. "settings": {
  37. "groupName": "supervisor",
  38. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  39. "port": "8649"
  40. }
  41. }],
  42. "obj": "java.lang:name=Code Cache,type=MemoryPool",
  43. "resultAlias": "supervisor",
  44. "attr": [
  45. "CollectionUsageThreshold",
  46. "CollectionUsageThresholdCount",
  47. "UsageThreshold",
  48. "UsageThresholdCount"
  49. ]
  50. },
  51. {
  52. "outputWriters": [{
  53. "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
  54. "settings": {
  55. "groupName": "supervisor",
  56. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  57. "port": "8649"
  58. }
  59. }],
  60. "obj": "java.lang:type=Runtime",
  61. "resultAlias": "supervisor",
  62. "attr": [
  63. "StartTime",
  64. "Uptime"
  65. ]
  66. }],
  67. "numQueryThreads" : 2
  68. }]
  69. }
    端口12346是jmx服务的端口,这个端口在storm.yaml中进行设置的;
    IP_OF_SUPERVISOR_MACHINE是supervisor节点的IP地址
    IP_OF_GANGLIA_GMOND_SERVER是ganglia gmond服务所在的服务器的IP

    nimbus.json

点击(此处)折叠或打开

  1. {
  2. "servers" : [{
  3. "port" : "12345",
  4. "host" : "IP_OF_NIMBUS_MACHINE",
  5. "queries" : [
  6. { "outputWriters": [{
  7. "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
  8. "settings": {
  9. "groupName": "nimbus",
  10. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  11. "port": "8649"
  12. }
  13. }],
  14. "obj": "java.lang:type=Memory",
  15. "resultAlias": "nimbus",
  16. "attr": ["ObjectPendingFinalizationCount"]
  17. },
  18. {
  19. "outputWriters": [{
  20. "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
  21. "settings": {
  22. "groupName": "nimbus",
  23. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  24. "port": "8649"
  25. }
  26. }],
  27. "obj": "java.lang:name=Copy,type=GarbageCollector",
  28. "resultAlias": "nimbus",
  29. "attr": [
  30. "CollectionCount",
  31. "CollectionTime"
  32. ]
  33. },
  34. {
  35. "outputWriters": [{
  36. "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
  37. "settings": {
  38. "groupName": "nimbus",
  39. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  40. "port": "8649"
  41. }
  42. }],
  43. "obj": "java.lang:name=Code Cache,type=MemoryPool",
  44. "resultAlias": "nimbus",
  45. "attr": [
  46. "CollectionUsageThreshold",
  47. "CollectionUsageThresholdCount",
  48. "UsageThreshold",
  49. "UsageThresholdCount"
  50. ]
  51. },
  52. {
  53. "outputWriters": [{
  54. "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
  55. "settings": {
  56. "groupName": "nimbus",
  57. "host": "IP_OF_GANGLIA_GMOND_SERVER",
  58. "port": "8649"
  59. }
  60. }],
  61. "obj": "java.lang:type=Runtime",
  62. "resultAlias": "nimbus",
  63. "attr": [
  64. "StartTime",
  65. "Uptime"
  66. ]
  67. }],
  68. "numQueryThreads" : 2
  69. } ]
  70. }
    端口12345是jmx服务的端口,这个端口在storm.yaml中进行设置的;
    IP_OF_NIMBUS_MACHINE是nimbus节点的IP地址
    IP_OF_GANGLIA_GMOND_SERVER是ganglia gmond服务所在的服务器的IP
4. 将nimbus.json和supervisor.json脚本拷贝到/var/lib/jmxtrans目录下
5. 启动jmxtrans服务
    cd /usr/share/jmxtrans
    sudo ./jmxtrans strart
6. 现在就可以在ganglia的wen服务上查看到storm集群的运行状态了

阅读(5953) | 评论(0) | 转发(0) |
0

上一篇:Nginx 最简化模型

下一篇:MongoDb 索引要点

给主人留下些什么吧!~~