rules_up.yml

groups:
- name: up
rules:
- alert: mysql
expr: up{instance="db1",job="mysql"} != 0
for: 10s
labels:
instance: '{{$labels.instance}}'
priority: "3"
type: 'mysql'
annotations:
description: '{{ $labels.instance }} nginx-vts-web is down please handle'
summary: 'jobname: {{$labels.instance}} nginx-vts-web is down please handle' - alert: node
expr: up{job="node"} != 0
for: 10s
labels:
instance: '{{$labels.instance}}'
priority: "3"
type: 'node'
annotations:
description: '{{ $labels.instance }} nginx-vts-web is down please handle'
summary: 'jobname: {{$labels.instance}} nginx-vts-web is down please handle' - alert: nginx
expr: up{instance="web",job="nginx"} != 0
for: 10s
labels:
instance: '{{$labels.instance}}'
priority: "3"
type: 'nginx'
annotations:
description: '{{ $labels.instance }} nginx-vts-web is down please handle'
summary: 'jobname: {{$labels.instance}} nginx-vts-web is down please handle'

rules_mysql.yml

groups:
- name: mysql.rules
rules:
- record: mysql_slave_lag_seconds
expr: mysql_slave_status_seconds_behind_master - mysql_slave_status_sql_delay
- record: mysql_heartbeat_lag_seconds
expr: mysql_heartbeat_now_timestamp_seconds - mysql_heartbeat_stored_timestamp_seconds
- record: job:mysql_transactions:rate5m
expr: sum(rate(mysql_global_status_commands_total{command=~"(commit|rollback)"}[5m]))
WITHOUT (command)
- alert: MySQLGaleraNotReady
expr: mysql_global_status_wsrep_ready != 1
for: 5m
labels:
severity: warning
annotations:
description: '{{$labels.job}} on {{$labels.instance}} is not ready.'
summary: Galera cluster node not ready
- alert: MySQLGaleraOutOfSync
expr: (mysql_global_status_wsrep_local_state != 4 and mysql_global_variables_wsrep_desync
== 0)
for: 5m
labels:
severity: warning
annotations:
description: '{{$labels.job}} on {{$labels.instance}} is not in sync ({{$value}}
!= 4).'
summary: Galera cluster node out of sync
- alert: MySQLGaleraDonorFallingBehind
expr: (mysql_global_status_wsrep_local_state == 2 and mysql_global_status_wsrep_local_recv_queue
> 100)
for: 5m
labels:
severity: warning
annotations:
description: '{{$labels.job}} on {{$labels.instance}} is a donor (hotbackup)
and is falling behind (queue size {{$value}}).'
summary: xtradb cluster donor node falling behind
- alert: MySQLReplicationNotRunning
expr: mysql_slave_status_slave_io_running == 0 or mysql_slave_status_slave_sql_running
== 0
for: 2m
labels:
severity: critical
annotations:
description: Slave replication (IO or SQL) has been down for more than 2 minutes.
summary: Slave replication is not running
- alert: MySQLReplicationLag
expr: (mysql_slave_lag_seconds > 30) and ON(instance) (predict_linear(mysql_slave_lag_seconds[5m],
60 * 2) > 0)
for: 1m
labels:
severity: critical
annotations:
description: The mysql slave replication has fallen behind and is not recovering
summary: MySQL slave replication is lagging
- alert: MySQLReplicationLag
expr: (mysql_heartbeat_lag_seconds > 30) and ON(instance) (predict_linear(mysql_heartbeat_lag_seconds[5m],
60 * 2) > 0)
for: 1m
labels:
severity: critical
annotations:
description: The mysql slave replication has fallen behind and is not recovering
summary: MySQL slave replication is lagging
- alert: MySQLInnoDBLogWaits
expr: rate(mysql_global_status_innodb_log_waits[15m]) > 10
labels:
severity: warning
annotations:
description: The innodb logs are waiting for disk at a rate of {{$value}} /
second
summary: MySQL innodb log writes stalling

rules_nginx.yml

groups:
- name: aws_ec2_nginx-vts-web
rules:
- alert: nginx-vts-web-status
expr: up{job="nginx-vts-web"} == 0
for: 1m
labels:
instance: '{{$labels.instance}}'
priority: "3"
type: 'nginx'
annotations:
description: '{{ $labels.instance }} nginx-vts-web is down please handle'
summary: 'jobname: {{$labels.instance}} nginx-vts-web is down please handle'
- alert: nginx application 5xx gt 10 per min
expr: sum(nginx_vts_filter_requests_total{direction="5xx",job="nginx-vts-web"} - nginx_vts_filter_requests_total{direction="5xx",job="nginx-vts-web"} offset 1m) by (application,direction) > 10
for: 1m
labels:
type: 'nginx'
priority: "4"
annotations:
description: ' {{$labels.application}} {{$labels.direction}} >10/m'
summary: ' {{$labels.application}} {{$labels.direction}} >10/m'
- alert: nginx application 5xx gt 1 per min
expr: sum(nginx_vts_filter_requests_total{direction="5xx",job="nginx-vts-web"} - nginx_vts_filter_requests_total{direction="5xx",job="nginx-vts-web"} offset 1m) by (application,direction,filter_name) > 1
for: 1m
labels:
type: 'nginx-detail'
priority: "4"
annotations:
description: ' {{$labels.application}} {{$labels.direction}}{{$labels.filter_name}} >10/m'
summary: ' {{$labels.application}} {{$labels.direction}} >10/m'
# - alert: nginx application 2xx gt 10 per min
# expr: sum(nginx_vts_filter_requests_total{direction="2xx",job="nginx-vts-web"} - nginx_vts_filter_requests_total{direction="2xx",job="nginx-vts-web"} offset 1m) by (application,direction) > 10
# for: 1m
# labels:
# test: 'yes'
# priority: "4"
# annotations:
# description: ' {{$labels.application}} {{$labels.direction}} >10/m'
# summary: ' {{$labels.application}} {{$labels.direction}} >10/m' - alert: nginx interface time gt 300ms
expr: nginx_vts_filter_request_seconds{job="nginx-vts-web",filter_name!="/v1/users/kyc/upload"}*1000 > 300
for: 1m
labels:
type: 'nginx'
priority: "4"
annotations:
description: ' {{$labels.application}} {{$labels.filter}} {{$labels.filter_name}} >300ms'
summary: ' {{$labels.application}} {{$labels.filter}} {{$labels.filter_name}} >300ms' - alert: nginx interface time gt 2s
expr: nginx_vts_filter_request_seconds{job="nginx-vts-web",filter_name="/v1/users/kyc/upload"}*1000 > 2000
for: 1m
labels:
type: 'nginx'
priority: "4"
annotations:
description: ' {{$labels.application}} {{$labels.filter}} {{$labels.filter_name}} >300ms'
summary: ' {{$labels.application}} {{$labels.filter}} {{$labels.filter_name}} >300ms'

rules_node.yml

groups:
- name: example-node-exporter-rules
rules:
# The count of CPUs per node, useful for getting CPU time as a percent of total.
- alert: instance:node_cpus:count
expr: count(node_cpu_seconds_total{mode="idle"}) without (cpu,mode) > 2
for: 1s
annotations:
description: ' {{$labels.application}} {{$labels.filter}} {{$labels.filter_name}} >300ms'
summary: ' {{$labels.application}} {{$labels.filter}} {{$labels.filter_name}} >300ms'
- name: node_up
rules:
# The count of CPUs per node, useful for getting CPU time as a percent of total.
- alert: instance:node_cpus:count
expr: up{instance="node",job="node"} != 1
for: 1s
annotations:
description: ' {{$labels.application}} {{$lables.instance}} is up'
summary: ' {{$labels.application}} {{$lables.instance}} is up'

prometheus告警规则模板:MySQL,nginx,node的更多相关文章

  1. Prometheus告警规则增删改自动化

    Prometheus告警规则增删改自动化 前言: 随着容器技术的发展,zabbix监控方式与k8s的结合不完善,导致不得不放弃zabbix,而新的监控工具prometheus的使用就越来越多了.但是经 ...

  2. prometheus简单监控Linux,mysql,nginx

    prometheus安装 下载安装 #官网下载 解压即可使用 https://prometheus.io/download/ #docker 方式安装 sudo docker run -n prome ...

  3. prometheus 告警规则

    GitHub网址1 https://github.com/samber/awesome-prometheus-alerts 网址2 https://awesome-prometheus-alerts. ...

  4. 02 . Prometheus告警处理

    Prometheus告警简介 告警能力在Prometheus的架构中被划分成两个独立的部分.如下所示,通过在Prometheus中定义AlertRule(告警规则),Prometheus会周期性的对告 ...

  5. Prometheus告警处理

    在Prometheus Server中定义告警规则以及产生告警,Alertmanager组件则用于处理这些由Prometheus产生的告警.Alertmanager即Prometheus体系中告警的统 ...

  6. Prometheus告警模型分析

    Prometheus作为时下最为流行的开源监控系统,其庞大的生态体系:包括针对各种传统应用的Exporter,完整的二次开发工具链,与Kubernetes等主流平台的高度亲和以及由此带来的强大的自发现 ...

  7. Prometheus自身的监控告警规则

    1.先在 Prometheus 主程序目录下创建rules目录,然后在该目录下创建 prometheus-test.yml文件,内容如下: 内容很多,可以根据实际情况进行调整. 规则参考网址:http ...

  8. 实用干货丨如何使用Prometheus配置自定义告警规则

    前 言 Prometheus是一个用于监控和告警的开源系统.一开始由Soundcloud开发,后来在2016年,它迁移到CNCF并且称为Kubernetes之后最流行的项目之一.从整个Linux服务器 ...

  9. Prometheus中使用的告警规则

    参考网站:https://awesome-prometheus-alerts.grep.to/rules 这个网站上有好多常用软件的告警规则,但是有些并不一定实用,有些使用起来会有错误,这里就把这些都 ...

随机推荐

  1. Map接口总结(如何使用默认方法)

    Map接口总结(如何使用默认方法) Map的基本使用 默认方法的问题,有什么坑 常用的默认方法应用场景 基本操作 get put(区别:Collection接口中添加为set) putAll remo ...

  2. APISpace 成语大全API接口 免费好用

    成语有一个很大一部分是从古代相承沿用下来的,在用词方面往往不同于现代汉语,它代表一个故事或者典故.成语又是一种现成的话,跟习用语.谚语相近,但是也略有区别.成语是中华文化中的一颗璀璨的明珠.   成语 ...

  3. 如何用天气预警API接口进行快速开发

    天气预警能够指导人们出行.同一种类的气象灾害预警信号级别不同,对应的防御措施也不尽相同,人们通过气象灾害预警信号,合理安排出行.公众要提高防范意识,养成接收和关注预警信息的习惯,了解预警信息背后的意义 ...

  4. 通过jmeter压测surging

    前言 surging是异构微服务引擎,提供了模块化RPC请求通道,引擎在RPC服务治理基础之上还提供了各种协议,并且还提供了stage组件,以便针对于网关的访问, 相对于功能,可能大家更想知道能承受多 ...

  5. 利用Kaptcha.jar生成图片验证码(以下源码可以直接复制并自定义修改)

    说明:Kaptcha是一个很实用的验证码生成工具,它可以生成各种样式的验证码,因为它是可以配置的 目录: 一 实现步骤 二 实例 A 编写jsp页面 B 配置web.xml C 验证输入正确与否. 一 ...

  6. sqlDeveloper工具快速入门

    场景 我们在连接oracle数据库的时候 常用方式一般有以下三种: pl/sql deceloper navicat sqlDeveloper 其中, pl/sql developer是最经典的,也是 ...

  7. Java开发学习(十七)----AOP案例之测量业务层接口执行效率

    一.需求分析 这个需求比较简单 需求:任意业务层接口执行均可显示其执行效率(执行时长) 这个的目的是查看每个业务层执行的时间,这样就可以监控出哪个业务比较耗时,将其查找出来方便优化. 具体实现的思路: ...

  8. GRPC头测试记录

    GRPC头记录 http://nodejs.cn/api/http2/note_on_authority_and_host.html https://cloud.tencent.com/develop ...

  9. SQL及常见的三种类型注释

    SQL(Structure Query Language)语言是数据库的核心语言. SQL的发展是从1974年开始的,其发展过程如下:1974年-----由Boyce和Chamberlin提出,当时称 ...

  10. 青峰Flutter视频播放软件

    下载地址: https://github.com/patton88/peak_flutter_player/raw/master/peak_flutter_player_v1.1.5_release0 ...