当前位置: 首页 > article >正文

基于ZABBIX监控 RabbitMQ服务开箱模板汉化及适用性改造

概述:

因为工作的需要,要监控RabbitMQ的状态,看到zabbix里面自带开箱模板,就直接套用,但是发现很多监控项及LLD jsonpath的问题,导致无法使用,自己重新开发耗时耗力,便想着边研究边解决,本文将贴出zabbix原版的模板文件及部分适用性改造例子,并附上最终完善及汉化后的模板。

实验环境:

Zabbix 6.4(192.168.1.1)
RabbitMQ 3.6.14(192.168.1.2)
模板名:RabbitMQ node by Zabbix agent

参考资料:

zabbix模板相关:https://www.zabbix.com/cn/integrations/rabbitmq#rabbitmq_agent

Rabbitmq接口文档:https://www.rabbitmq.com/docs/monitoring#queue-metrics

ZABBIX监控RabbitMQ服务原版开箱模板

zabbix_export:
  version: '6.0'
  date: '2024-10-09T02:10:07Z'
  groups:
    -
      uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
  templates:
    -
      uuid: d5dc11ae9ab143a89c4be534bbb35188
      template: 'RabbitMQ node by Zabbix agent'
      name: 'RabbitMQ node by Zabbix agent'
      description: |
        Get node metrics from RabbitMQ management plugin provided an HTTP-based API using Zabbix agent.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/387226-discussion-thread-for-official-zabbix-template-rabbitmq
        
        Template tooling version used: 0.41
      groups:
        -
          name: Templates/Applications
      items:
        -
          uuid: b1f191f9077f4382b5b87e0085ae2622
          name: 'RabbitMQ: Service response time'
          key: 'net.tcp.service.perf["{$RABBITMQ.API.SCHEME}","{$RABBITMQ.API.HOST}","{$RABBITMQ.API.PORT}"]'
          history: 7d
          value_type: FLOAT
          units: s
          tags:
            -
              tag: component
              value: system
          triggers:
            -
              uuid: 5cb80a7552d74e44a83d0825f039f89f
              expression: 'min(/RabbitMQ node by Zabbix agent/net.tcp.service.perf["{$RABBITMQ.API.SCHEME}","{$RABBITMQ.API.HOST}","{$RABBITMQ.API.PORT}"],5m)>{$RABBITMQ.RESPONSE_TIME.MAX.WARN}'
              name: 'RabbitMQ: Service response time is too high (over {$RABBITMQ.RESPONSE_TIME.MAX.WARN}s for 5m)'
              priority: WARNING
              manual_close: 'YES'
              dependencies:
                -
                  name: 'RabbitMQ: Process is not running'
                  expression: 'last(/RabbitMQ node by Zabbix agent/proc.num["{$RABBITMQ.PROCESS_NAME}"])=0'
                -
                  name: 'RabbitMQ: Service is down'
                  expression: 'last(/RabbitMQ node by Zabbix agent/net.tcp.service["{$RABBITMQ.API.SCHEME}","{$RABBITMQ.API.HOST}","{$RABBITMQ.API.PORT}"])=0'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 6229b623f5ff40f9a65e9573b3b86e3f
          name: 'RabbitMQ: Service ping'
          key: 'net.tcp.service["{$RABBITMQ.API.SCHEME}","{$RABBITMQ.API.HOST}","{$RABBITMQ.API.PORT}"]'
          history: 7d
          valuemap:
            name: 'Service state'
          preprocessing:
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 10m
          tags:
            -
              tag: component
              value: health
            -
              tag: component
              value: network
          triggers:
            -
              uuid: af5cfb0004e04562a9720b9e1b41fd5b
              expression: 'last(/RabbitMQ node by Zabbix agent/net.tcp.service["{$RABBITMQ.API.SCHEME}","{$RABBITMQ.API.HOST}","{$RABBITMQ.API.PORT}"])=0'
              name: 'RabbitMQ: Service is down'
              priority: AVERAGE
              manual_close: 'YES'
              dependencies:
                -
                  name: 'RabbitMQ: Process is not running'
                  expression: 'last(/RabbitMQ node by Zabbix agent/proc.num["{$RABBITMQ.PROCESS_NAME}"])=0'
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: 0b195bf594c44b1f869b4a7671f61453
          name: 'RabbitMQ: CPU utilization'
          key: 'proc.cpu.util["{$RABBITMQ.PROCESS_NAME}"]'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'Process CPU utilization percentage.'
          tags:
            -
              tag: component
              value: cpu
        -
          uuid: 6f13f672d8ce4c9592e0f3f5ec3b0ec4
          name: 'RabbitMQ: Memory usage (rss)'
          key: 'proc.mem["{$RABBITMQ.PROCESS_NAME}",,,,rss]'
          history: 7d
          units: B
          description: 'Resident set size memory used by process in bytes.'
          tags:
            -
              tag: component
              value: system
        -
          uuid: 4faac75027d14304ab071602df8f2937
          name: 'RabbitMQ: Memory usage (vsize)'
          key: 'proc.mem["{$RABBITMQ.PROCESS_NAME}",,,,vsize]'
          history: 7d
          units: B
          description: 'Virtual memory size used by process in bytes.'
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 8f1c8d2449c44ab590842184d9deb3a6
          name: 'RabbitMQ: Number of processes running'
          key: 'proc.num["{$RABBITMQ.PROCESS_NAME}"]'
          history: 7d
          tags:
            -
              tag: component
              value: system
          triggers:
            -
              uuid: 2979bc7d779b404696f7eac273e99ea7
              expression: 'last(/RabbitMQ node by Zabbix agent/proc.num["{$RABBITMQ.PROCESS_NAME}"])=0'
              name: 'RabbitMQ: Process is not running'
              priority: HIGH
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: 7dad79be93bd46bba7a2540b38080b06
          name: 'RabbitMQ: Free disk space'
          type: DEPENDENT
          key: rabbitmq.node.disk_free
          delay: '0'
          history: 7d
          units: B
          description: 'Current free disk space'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.disk_free
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: storage
        -
          uuid: d8de1eb13f024ce99388fc4bb68d6ad0
          name: 'RabbitMQ: Disk free alarm'
          type: DEPENDENT
          key: rabbitmq.node.disk_free_alarm
          delay: '0'
          history: 7d
          description: 'Does the node have disk alarm'
          valuemap:
            name: 'Alarm state'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.disk_free_alarm
            -
              type: BOOL_TO_DECIMAL
              parameters:
                - ''
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: storage
          triggers:
            -
              uuid: b68cb12ecd4046fd80a717fb557f04e8
              expression: 'last(/RabbitMQ node by Zabbix agent/rabbitmq.node.disk_free_alarm)=1'
              name: 'RabbitMQ: Free disk space alarm (Free space threshold has been reached)'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'https://www.rabbitmq.com/disk-alarms.html'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 4e62b476bd11497f9190d1f720f22f75
          name: 'RabbitMQ: Disk free limit'
          type: DEPENDENT
          key: rabbitmq.node.disk_free_limit
          delay: '0'
          history: 7d
          units: B
          description: 'Disk free space limit in bytes'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.disk_free_limit
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: storage
        -
          uuid: 09aeab86c69846eb82d27c2f82f46d2b
          name: 'RabbitMQ: Used file descriptors'
          type: DEPENDENT
          key: rabbitmq.node.fd_used
          delay: '0'
          history: 7d
          description: 'Used file descriptors'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.fd_used
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: storage
        -
          uuid: e059b278ba384133a72dc723c2b2c40b
          name: 'RabbitMQ: Memory alarm'
          type: DEPENDENT
          key: rabbitmq.node.mem_alarm
          delay: '0'
          history: 7d
          description: 'Does the host has memory alarm'
          valuemap:
            name: 'Alarm state'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.mem_alarm
            -
              type: BOOL_TO_DECIMAL
              parameters:
                - ''
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: memory
          triggers:
            -
              uuid: ec6ae727fe774b0fa56bb4d9ad773e35
              expression: 'last(/RabbitMQ node by Zabbix agent/rabbitmq.node.mem_alarm)=1'
              name: 'RabbitMQ: Memory alarm (Memory usage threshold has been reached)'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'https://www.rabbitmq.com/memory.html'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 54bd4a47d635444e8e2e955325dbb976
          name: 'RabbitMQ: Memory limit'
          type: DEPENDENT
          key: rabbitmq.node.mem_limit
          delay: '0'
          history: 7d
          units: B
          description: 'Memory usage high watermark in bytes'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.mem_limit
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: memory
        -
          uuid: d6a01ec409a6449986c5c0a81ffaf914
          name: 'RabbitMQ: Memory used'
          type: DEPENDENT
          key: rabbitmq.node.mem_used
          delay: '0'
          history: 7d
          units: B
          description: 'Memory used in bytes'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.mem_used
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: memory
        -
          uuid: db91f84a5ad7412c959fbfe4e3b6df88
          name: 'RabbitMQ: Management plugin version'
          type: DEPENDENT
          key: rabbitmq.node.overview.management_version
          delay: '0'
          history: 7d
          trends: '0'
          value_type: CHAR
          description: 'Version of the management plugin in use'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.management_version
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/overview"]'
          tags:
            -
              tag: component
              value: system
        -
          uuid: 52a0be5049ee40748761d301a644315b
          name: 'RabbitMQ: RabbitMQ version'
          type: DEPENDENT
          key: rabbitmq.node.overview.rabbitmq_version
          delay: '0'
          history: 7d
          trends: '0'
          value_type: CHAR
          description: 'Version of RabbitMQ on the node which processed this request'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.rabbitmq_version
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/overview"]'
          tags:
            -
              tag: component
              value: system
          triggers:
            -
              uuid: daf98bb4593d4697bc51423b2f65ba41
              expression: 'last(/RabbitMQ node by Zabbix agent/rabbitmq.node.overview.rabbitmq_version,#1)<>last(/RabbitMQ node by Zabbix agent/rabbitmq.node.overview.rabbitmq_version,#2) and length(last(/RabbitMQ node by Zabbix agent/rabbitmq.node.overview.rabbitmq_version))>0'
              name: 'RabbitMQ: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'RabbitMQ version has changed. Ack to close.'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
        -
          uuid: 5e8c1ed0b073461eb14477edac3c756a
          name: 'RabbitMQ: Number of network partitions'
          type: DEPENDENT
          key: rabbitmq.node.partitions
          delay: '0'
          history: 7d
          description: 'Number of network partitions this node is seeing'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.partitions
            -
              type: JAVASCRIPT
              parameters:
                - 'return JSON.parse(value).length;'
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: network
          triggers:
            -
              uuid: 5bed266725e94000804b0ecc7bce6209
              expression: 'min(/RabbitMQ node by Zabbix agent/rabbitmq.node.partitions,5m)>0'
              name: 'RabbitMQ: Number of network partitions is too high (more than 0 for 5m)'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'https://www.rabbitmq.com/partitions.html#detecting'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 087fcb3992ef4e35bacd4b6e69ef93d3
          name: 'RabbitMQ: Is running'
          type: DEPENDENT
          key: rabbitmq.node.running
          delay: '0'
          history: 7d
          description: 'Is the node running or not'
          valuemap:
            name: 'Service state'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.running
            -
              type: BOOL_TO_DECIMAL
              parameters:
                - ''
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: system
          triggers:
            -
              uuid: 253acf98446e4790975b330d44dd6b96
              expression: 'max(/RabbitMQ node by Zabbix agent/rabbitmq.node.running,5m)=0'
              name: 'RabbitMQ: Node is not running'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'RabbitMQ node is not running'
              dependencies:
                -
                  name: 'RabbitMQ: Process is not running'
                  expression: 'last(/RabbitMQ node by Zabbix agent/proc.num["{$RABBITMQ.PROCESS_NAME}"])=0'
                -
                  name: 'RabbitMQ: Service is down'
                  expression: 'last(/RabbitMQ node by Zabbix agent/net.tcp.service["{$RABBITMQ.API.SCHEME}","{$RABBITMQ.API.HOST}","{$RABBITMQ.API.PORT}"])=0'
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: 1ae6f429e99d4ddaa54aa6adab6b8100
          name: 'RabbitMQ: Runtime run queue'
          type: DEPENDENT
          key: rabbitmq.node.run_queue
          delay: '0'
          history: 7d
          description: 'Average number of Erlang processes waiting to run'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.run_queue
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: system
        -
          uuid: 3aa508520f224150a05a7ebb64d22c5e
          name: 'RabbitMQ: Sockets available'
          type: DEPENDENT
          key: rabbitmq.node.sockets_total
          delay: '0'
          history: 7d
          description: 'File descriptors available for use as sockets'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.sockets_total
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: system
        -
          uuid: de2cbe02ff6c47d78b6c7105709f4805
          name: 'RabbitMQ: Sockets used'
          type: DEPENDENT
          key: rabbitmq.node.sockets_used
          delay: '0'
          history: 7d
          description: 'Number of file descriptors used as sockets'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.sockets_used
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: system
        -
          uuid: a28b6c8cca5544b79c2d9946c1978c7e
          name: 'RabbitMQ: Uptime'
          type: DEPENDENT
          key: rabbitmq.node.uptime
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: s
          description: 'Uptime in milliseconds'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.uptime
            -
              type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          tags:
            -
              tag: component
              value: system
          triggers:
            -
              uuid: 729c448ebabb417bb7ce17b1634c4484
              expression: 'last(/RabbitMQ node by Zabbix agent/rabbitmq.node.uptime)<10m'
              name: 'RabbitMQ: has been restarted (uptime < 10m)'
              priority: INFO
              description: 'Uptime is less than 10 minutes'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
        -
          uuid: 61730555a0ae4f798ea740effb82764c
          name: 'RabbitMQ: Get nodes'
          key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"]'
          history: 1h
          trends: '0'
          value_type: TEXT
          description: 'The HTTP API endpoint that returns nodes metrics'
          preprocessing:
            -
              type: REGEX
              parameters:
                - '\n\s?\n(.*)'
                - \1
          tags:
            -
              tag: component
              value: raw
          triggers:
            -
              uuid: 4f2a88d09b1b49879d80e0794ec19e0e
              expression: 'nodata(/RabbitMQ node by Zabbix agent/web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/nodes/{$RABBITMQ.CLUSTER.NAME}@{HOST.NAME}?memory=true"],30m)=1'
              name: 'RabbitMQ: Failed to fetch nodes data (or no data for 30m)'
              priority: WARNING
              description: 'Zabbix has not received data for items for the last 30 minutes.'
              manual_close: 'YES'
              dependencies:
                -
                  name: 'RabbitMQ: Process is not running'
                  expression: 'last(/RabbitMQ node by Zabbix agent/proc.num["{$RABBITMQ.PROCESS_NAME}"])=0'
                -
                  name: 'RabbitMQ: Service is down'
                  expression: 'last(/RabbitMQ node by Zabbix agent/net.tcp.service["{$RABBITMQ.API.SCHEME}","{$RABBITMQ.API.HOST}","{$RABBITMQ.API.PORT}"])=0'
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: 1af326f40cdb407a96b34025062b4743
          name: 'RabbitMQ: Get node overview'
          key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/overview"]'
          history: 1h
          trends: '0'
          value_type: TEXT
          description: 'The HTTP API endpoint that returns cluster-wide metrics'
          preprocessing:
            -
              type: REGEX
              parameters:
                - '\n\s?\n(.*)'
                - \1
          tags:
            -
              tag: component
              value: raw
        -
          uuid: 7fb61ad564db42d5a373912491f5c9d3
          name: 'RabbitMQ: Get queues'
          key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/queues"]'
          history: 1h
          trends: '0'
          value_type: TEXT
          description: 'The HTTP API endpoint that returns queues metrics'
          preprocessing:
            -
              type: REGEX
              parameters:
                - '\n\s?\n(.*)'
                - \1
          tags:
            -
              tag: component
              value: raw
      discovery_rules:
        -
          uuid: 04ef7d13809c45009553815f60ef5ba8
          name: 'Health Check 3.8.9- discovery'
          type: DEPENDENT
          key: rabbitmq.healthcheck.v389.discovery
          delay: '0'
          description: 'Specific metrics up to and including version 3.8.4'
          item_prototypes:
            -
              uuid: 8b959a9d03dc4ae8bed7292973f4fcc4
              name: 'RabbitMQ: Healthcheck{#SINGLETON}'
              key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/healthchecks/node{#SINGLETON}"]'
              history: 7h
              description: 'Runs basic healthchecks in the current node. Checks that the rabbit application is running, channels and queues can be listed successfully, and that no alarms are in effect.'
              valuemap:
                name: 'RabbitMQ healthcheck'
              preprocessing:
                -
                  type: REGEX
                  parameters:
                    - '\n\s?\n(.*)'
                    - \1
                -
                  type: JSONPATH
                  parameters:
                    - $.status
                -
                  type: BOOL_TO_DECIMAL
                  parameters:
                    - ''
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              tags:
                -
                  tag: component
                  value: health
                -
                  tag: component
                  value: system
              trigger_prototypes:
                -
                  uuid: bf6bcbda20ed46cbb779d9c1f446dfa8
                  expression: 'last(/RabbitMQ node by Zabbix agent/web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/healthchecks/node{#SINGLETON}"])=0'
                  name: 'RabbitMQ: Node healthcheck failed'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'https://www.rabbitmq.com/monitoring.html#health-checks'
                  tags:
                    -
                      tag: scope
                      value: availability
          master_item:
            key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/overview"]'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.management_version
            -
              type: JAVASCRIPT
              parameters:
                - |
                  var rabbit_version = parseInt(value.split('.')[0]) * 10000 +
                                       parseInt(value.split('.')[1]) * 100 +
                                       parseInt(value.split('.')[2])
                  return JSON.stringify(rabbit_version < 30810 ? [{'{#SINGLETON}': ''}] : []);
        -
          uuid: 3c0021a3e57142eb806deb5b47b6700a
          name: 'Health Check 3.8.10+ discovery'
          type: DEPENDENT
          key: rabbitmq.healthcheck.v3810.discovery
          delay: '0'
          description: 'Version 3.8.10+ specific metrics'
          item_prototypes:
            -
              uuid: 0f1cd729d8f4447db25e0af19eae595d
              name: 'RabbitMQ: Healthcheck: expiration date on the certificates{#SINGLETON}'
              key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/health/checks/certificate-expiration/1/months{#SINGLETON}"]'
              history: 7d
              username: '{$RABBITMQ.API.USER}'
              password: '{$RABBITMQ.API.PASSWORD}'
              description: 'Checks the expiration date on the certificates for every listener configured to use TLS. Responds a 200 OK if all certificates are valid (have not expired), otherwise responds with a 503 Service Unavailable.'
              valuemap:
                name: 'RabbitMQ healthcheck'
              preprocessing:
                -
                  type: REGEX
                  parameters:
                    - HTTP\/1\.1\b\s(\d+)
                    - \1
                -
                  type: JAVASCRIPT
                  parameters:
                    - |
                      switch(value){ 
                      case '200': return 1 
                      case '503': return 0 
                      default: 2}
                -
                  type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              status_codes: '200,503,404'
              retrieve_mode: HEADERS
              tags:
                -
                  tag: component
                  value: certificate
                -
                  tag: component
                  value: health
              trigger_prototypes:
                -
                  uuid: d180912136c74e5cb246655ecab75f57
                  expression: 'last(/RabbitMQ node by Zabbix agent/web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/health/checks/certificate-expiration/1/months{#SINGLETON}"])=0'
                  name: 'RabbitMQ: There are valid TLS certificates expiring in the next month'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'http://{HOST.CONN}:{$RABBITMQ.API.PORT}/api/index.html'
                  tags:
                    -
                      tag: scope
                      value: notice
            -
              uuid: 701449b128cb42cdb971fc608ba9f29b
              name: 'RabbitMQ: Healthcheck: local alarms in effect on the this node{#SINGLETON}'
              key: 'web.page.get["{$RABBITMQ.API.SCHEME}://{$RABBITMQ.API.USER}:{$RABBITMQ.API.PASSWORD}@{$RABBITMQ.API.HOST}:{$RABBITMQ.API.PORT}/api/health/checks/local-alarms{#SINGLETON}"]'
              history: 7d
              username: '{$RABBITMQ.API.USER}'
              

http://www.kler.cn/news/341492.html

相关文章:

  • 相亲交友系统的商业模式探讨
  • Android Studio Koala Feature Drop 稳定版现已推出
  • 在滴滴和字节划水6年,过于真实了。。。
  • 刷题小计六:矩阵
  • 【fastjson】json对象格式化打印
  • 2015年国赛高教杯数学建模C题月上柳梢头解题全过程文档及程序
  • 无人自助超市系统小程序源码开发
  • 谈谈bluestore与rocksdbstore(未完,待续)
  • 什么是网络信息安全?
  • 考研笔试/上机经典编程题集合(持续更新并完善解题思路)
  • 2024 kali虚拟机安装教程,分两大步骤,图文讲解(1)
  • 云原生日志ELK( logstash安装部署)
  • ABB机器人20195故障报警原因分析
  • 【基础介绍】【OCR】
  • 【微服务】链路追踪 - Micrometer(day9)
  • IT招聘乱象的全面分析
  • 13种pod的状态
  • NL2SQL之DB-GPT-Hub详解篇:text2sql任务的微调框架和基准对比
  • ctfshow-web 萌新题
  • C++——模拟实现list