redis主从切换告警

delta(redis_connected_slaves[5m]) > 0 or delta(redis_connected_slaves[5m]) < 0
changes(redis_connected_slaves[5m]) >0
redis_connected_slaves offset 10m < redis_connected_slaves or redis_connected_slaves offset 10m > redis_connected_slaves


  - alert: RedisReplicationBroken
    expr: delta(redis_connected_slaves[1m]) < 0
    for: 0m
    annotations:
      description: "Redis instance lost a slave\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
      summary: Redis replication broken (instance {{ $labels.instance }})
  - alert: Redis主从切换
    expr: changes(redis_connected_slaves[5m]) >0
    for: 1m
    labels:
      severity: warning
    annotations:
      description: "Redis instance lost a slave\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
      summary: Redis master-slave changes (instance {{ $labels.instance }})
  - alert: Redis主从切换-email
    expr: changes(redis_connected_slaves[5m]) >0
    for: 1m
    labels:
      severity: info
    annotations:
      description: "Redis instance lost a slave\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
      summary: Redis master-slave changes (instance {{ $labels.instance }})

 

当redis_connected_slaves值5分钟内变动的次数大于0时触发告警

changes(redis_connected_slaves[5m]) >0

 

参考连接:
https://help.aliyun.com/document_detail/196117.html?utm_content=g_1000230851&spm=5176.20966629.toubu.3.f2991ddcpxxvD1#title-2cw-c1q-crw

https://awesome-prometheus-alerts.grep.to/alertmanager

java客户端连接redis自动刷新

https://www.cnblogs.com/kiko2014551511/p/13383983.html
https://blog.csdn.net/u010046887/article/details/106948341

 

posted @ 2021-09-09 13:36  夜辰雪扬  阅读(439)  评论(2)    收藏  举报