猫头鹰介绍

猫头鹰(owl) ,基于夜莺(nightingale),使用zorm替换gorm,兼容国产数据库和clickhouse

普罗米修斯配置修改

夜莺的告警数据依赖prometheus,实现宕机告警需要普罗米修斯推送监控信息

在普罗米修斯中prometheus.yml配置如下配置

- job_name: blackbox_http
  metrics_path: /probe
  params:
    module:
    - http_2xx
  static_configs:
  - targets:
    - https://xhbhs.cn//此处是你需要告警的网站地址
  relabel_configs:
  - source_labels:
    - __address__
    target_label: __param_target
  - source_labels:
    - __param_target
    target_label: instance
  - target_label: __address__
    replacement: 127.0.0.1:9115

修改配置后需要重启普罗米修斯重启后需等待一会,在夜莺监控即时查询中可以查到监听到的信息image-20240407171802126.png#860px #412px

配置告警规则

image-20240407173701353.png#946px #453px 例如博客官网配置 PromQL:probe_ip_protocol{instance="https://xhbhs.cn", job="blackbox_http"}==0 image.png#1466px #702px

  • 执行频率多少秒执行一次
  • 持续时长连续多少秒符合规则后触发

可以根据自己的需求配置生效时间,通知配置,恢复通知等(用户的通知地址在人员管理中配置)image-20240407174015185.png#1155px #553px

设置钉钉通知地址

image-20240407174155282.png#1405px #672px 配置地址image-20240407174221283.png

网站宕机后即可收到告警通知image.png