JMXTrans、graphite、icinga集成方式

1 采用jmxtrans统一封装 jmx数据上报到告警平台icinga和报表平台graphite
  1.1 jmxtrans安装
      wget https://github.com/downloads/jmxtrans/jmxtrans/jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm
      rpm -i jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm
      替换jmxtrans-all.jar包
      /usr/share/jmxtrans
  1.2 应用程序部署目录
      /usr/share/jmxtrans
  1.3 配置文件目录
      /etc/sysconfig/jmxtrans
  1.4 服务脚本
      /etc/init.d/jmxtrans

  1.5 采集配置文件
      /var/lib/jmxtrans

  1.6 启动命令
      采用service 方式启动
      service jmxtrans start

1.7 修改规则文件的路径
      定义JSON_DIR环境变量,可以修改规则文件的目录,否则默认在 /var/lib/jmxtrans目录下面。规则文件样例:
      下述为和icinga对接规则文件样例:

{
    "servers": [
        {
            "port": "10008",
            "host": "xx.xx.xx.xx",
            "alias": "test",
            "numQueryThreads":5,
            "queries": [
                {
                    "obj": "metrics:name=mq-message-handle-timer",
                    "resultAlias": "mq_message_handle_time",
                    "outputWriters": [
                        {
                            "@class": "com.googlecode.jmxtrans.model.output.NagiosWriter",
                            "outputFile": "/usr/local/icinga/var/rw/icinga.cmd",
                            "nagiosHost": "xx_xx_xx_xx",
                            "prefix": "mq_message_handle_time_",
                            "suffix": "",
                            "filters": [
                                "Max",
                                "95thPercentile"
                            ],
                            "thresholds": [
                                "~:10000",
                                "~:50000"
                            ]
                        }
                    ]
                
                }
            ]
        }
    ]
}

1.8 jmxtrans服务自启动
      chkconfig jmxtrans on


  1.9 业务进程增加rmi端口监听   
      -Dcom.sun.management.jmxremote.port=10008 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

  2.0 icinga对接
      1. 检查icinga的外部命令文件
         默认配置: /usr/local/icinga/var/rw/icinga.cmd
         (安装目录: /usr/local/icinga)
         检查该文件的权限

      2. 配置jmxtrans的icinga

      3. 增加icinga的对象文件
         样例:
    define host{
        use                  generic-linux-host,host-pnp4
        host_name              115_29_250_113 
        alias                   linux-host
        icon_image              redhat.gif
        statusmap_image         redhat.gd2
        address                 115.29.250.113 
}


define host{
        use                  generic-linux-host,host-pnp4
        host_name              114_215_204_97 
        alias                   linux-host
        icon_image              redhat.gif
        statusmap_image         redhat.gd2
        address                 114.215.204.97
}

define command{
    command_name check_dummy
    command_line $USER1$/check_dummy $ARG1$ $ARG2$
}

define contactgroup{
        contactgroup_name       test_biz_group
        alias                   test_biz_group
        members                 gtpi
}

define service{
    use                     generic-service   ; template to inherit from
    name                    passive-service   ; name of this template
    active_checks_enabled   0                 ; no active checks
    passive_checks_enabled  1                 ; allow passive checks
    check_command           check_dummy!0     ; use "check_dummy", RC=0 (OK)
    check_period            24x7              ; check active all the time
    check_freshness         0                 ; don't check if check result is "stale"
    register                0                 ; this is a template, not a real service
}

define service{
name jmx-error-count-notify-service          ; The name of this service template
use passive-service          ; Inherit default values from the generic-service definition
notification_options u,c,w    ; Send notifications about warning, unknown, critical, and recovery events
  notification_interval           60 ; Re-notify about service problems every hour
  notification_period             24x7 ; Notifications can be sent out at any time
contact_groups                  test_biz_group ;       Notifications get sent out to everyone in the 'admins' group
  register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值