zoukankan      html  css  js  c++  java
  • prometheus自定义监控项的报警规则

    prometheus rules:

    - name: basic-and-important
        rules:
        - alert: NodeCPUUsage
          annotations:
            description: '{{ $labels.instance }} CPU usage is above 80% (current value is {{ $value }})' 
          expr: 100 - (avg by (instance) (irate(node_cpu_seconds_total{job="node-exporter",mode="idle"}[5m])) * 100) > 80
          for: 10m
          labels:
            severity: critical
          annotations:
            description: '{{$labels.instance}} CPU usage is above 80% (current value is {{ $value }})'
        - alert: NodeMEMUsage
          expr: ((1 - (node_memory_MemAvailable_bytes{job="node-exporter"} / (node_memory_MemTotal_bytes{job="node-exporter"}))) * 100) > 80
          for: 10m
          labels:
            severity: critical
          annotations:
            description: '{{$labels.instance}} MEM usage is above 80% (current value is {{ $value }})'
        - alert: NodeDiskUsage
          expr: (1-(node_filesystem_free_bytes{job="node-exporter",fstype=~"ext4|xfs"} / node_filesystem_size_bytes{job="node-exporter",fstype=~"ext4|xfs"}))*100 > 80
          for: 10m
          labels:
            severity: critical
          annotations:
            description: '{{$labels.instance}} Disk usage is above 80% (current value is {{ $value }})'
        - alert: API response time per min
          expr: increase(http_server_requests_seconds_sum{uri!="/actuator/health"}[1m])/increase(http_server_requests_seconds_count{uri!="/actuator/health"}[1m])>2
          for: 1m 
          labels:
            severity: critical
          annotations:
            description: '{{$labels.job}} {{$labels.url}}  response time more than 2s. current value is {{ $value }}'
        - alert: Count of API request times per min
          expr: increase(http_server_requests_seconds_count{uri!="/actuator/health",uri!="/actuator/prometheus",status!="200"}[1m])>1
          for: 1m
          labels:
            severity: critical
          annotations:
            description: '{{$labels.job}} {{$labels.url}}  request error times is {{ $value }} in recent one min'
      - name: rabbitmq-monitoring
        rules:
        - alert: rabbitmq_queue_messages
          expr: rabbitmq_queue_messages{queue!~".*_DL"} > 10
          for: 5m
          labels:
            severity: critical
          annotations:
            description: 'queue name:{{$labels.queue}} is blocked. current count is {{ $value }}'
        - alert: rabbitmq_consumer_error_total
          expr: increase(rabbitmq_consumer_error_total[1m]) > 10
          for: 1m
          labels:
            severity: critical
          annotations:
            description: 'service name:{{$labels.job}} cannot consume the queues. current count is {{ $value }}'
        - alert: rabbitmq_connection_recovery_total
          expr: increase(rabbitmq_connection_recovery_total[1m]) > 10
          for: 1m
          labels:
            severity: critical
          annotations:
            description: 'service name:{{$labels.job}} connection recovery total is {{ $value }}'
  • 相关阅读:
    剑指OFFER----面试题17- 打印从1到最大的n位数
    剑指OFFER----面试题16. 数值的整数次方
    剑指OFFER----面试题15. 二进制中1的个数
    剑指OFFER----面试题14- II. 剪绳子II
    07 多层if判断
    08 while循环
    06 if 流程控制
    03 身份运算符、逻辑运算符
    04 位运算符、运算符优先级
    02 赋值运算符、成员运算符
  • 原文地址:https://www.cnblogs.com/malukang/p/12786507.html
Copyright © 2011-2022 走看看