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 }}'
  • 相关阅读:
    django之表多对多查询
    Django之ORMselect_related和prefetch_related
    django中用户登入时初始化session中保存的数据
    django中间件判断用户有无权限访问当前的url
    django中自定议rbac权限model类
    django中的inclusion_tag配置和实现
    docker命令
    JS设置cookie、读取cookie、删除cookie
    MySQL Community Downloads
    44个CSS3制作的形状图形
  • 原文地址:https://www.cnblogs.com/malukang/p/12786507.html
Copyright © 2011-2022 走看看