prometheus告警规则模板:MySQL,nginx,node
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的更多相关文章
- Prometheus告警规则增删改自动化
Prometheus告警规则增删改自动化 前言: 随着容器技术的发展,zabbix监控方式与k8s的结合不完善,导致不得不放弃zabbix,而新的监控工具prometheus的使用就越来越多了.但是经 ...
- prometheus简单监控Linux,mysql,nginx
prometheus安装 下载安装 #官网下载 解压即可使用 https://prometheus.io/download/ #docker 方式安装 sudo docker run -n prome ...
- prometheus 告警规则
GitHub网址1 https://github.com/samber/awesome-prometheus-alerts 网址2 https://awesome-prometheus-alerts. ...
- 02 . Prometheus告警处理
Prometheus告警简介 告警能力在Prometheus的架构中被划分成两个独立的部分.如下所示,通过在Prometheus中定义AlertRule(告警规则),Prometheus会周期性的对告 ...
- Prometheus告警处理
在Prometheus Server中定义告警规则以及产生告警,Alertmanager组件则用于处理这些由Prometheus产生的告警.Alertmanager即Prometheus体系中告警的统 ...
- Prometheus告警模型分析
Prometheus作为时下最为流行的开源监控系统,其庞大的生态体系:包括针对各种传统应用的Exporter,完整的二次开发工具链,与Kubernetes等主流平台的高度亲和以及由此带来的强大的自发现 ...
- Prometheus自身的监控告警规则
1.先在 Prometheus 主程序目录下创建rules目录,然后在该目录下创建 prometheus-test.yml文件,内容如下: 内容很多,可以根据实际情况进行调整. 规则参考网址:http ...
- 实用干货丨如何使用Prometheus配置自定义告警规则
前 言 Prometheus是一个用于监控和告警的开源系统.一开始由Soundcloud开发,后来在2016年,它迁移到CNCF并且称为Kubernetes之后最流行的项目之一.从整个Linux服务器 ...
- Prometheus中使用的告警规则
参考网站:https://awesome-prometheus-alerts.grep.to/rules 这个网站上有好多常用软件的告警规则,但是有些并不一定实用,有些使用起来会有错误,这里就把这些都 ...
随机推荐
- throws关键字_异常处理的第一种方式(交给别人处理)和try_catch_异常处理的第二种方式(自己处理)
throws关键字:异常处理的第一种方式,交给别人处理 作用: 当方法内部抛出异常对象的时候,那么我们就必须处理这个异常对象 可以使用throws关键字处理异常对象, 会把异常对象声明抛出给方法的调用 ...
- shell脚本三剑客:grep、sed、awk
shell脚本三剑客:grep sed awk grep语法: grep [OPTIONS] PATTERN [FILE] 常用选项 -c 统计匹配到的 ...
- DBUS接口和三极管反向电路
三极管反向电路,DR16的接收机接收的信号是反向的 电路描述:VEE为低电平时NPN三极管Q1截止,A点为高电平:VEE为高电平时NPN三极管Q1导通,A点为低电平:从而实现了电平反向.阻R1作用是在 ...
- hive SQL 初学者题目,实战题目 字符串函数,日期拼接,开窗函数。。。。
sql:Hive实现按照指定格式输出每七天的消费平均数输出格式:2018-06-01~2018-06-07 12.29...2018-08-10~2018-08-16 80.67 答案:-- 1.先将 ...
- TFrecord写入与读取
Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializi ...
- 20220723-Mac上使用IntelliJ IDEA
目录 IDEA快捷键 IDEA模板 常用模板快捷键 个人随笔 软件:IntelliJ IDEA 电脑:Mac IDEA快捷键 打开/关闭 项目视图 快捷键:⌘ + 1 运行项目 快捷键:⌃ + ⇧ + ...
- 「POJ 3666」Making the Grade 题解(两种做法)
0前言 感谢yxy童鞋的dp及暴力做法! 1 算法标签 优先队列.dp动态规划+滚动数组优化 2 题目难度 提高/提高+ CF rating:2300 3 题面 「POJ 3666」Making th ...
- Apache Dolphinscheduler 1.3.x 系列配置文件指南
前言 本文档为dolphinscheduler配置文件指南,针对版本为 dolphinscheduler-1.3.x 版本. 考虑公众号对markdown文件格式支持不那么友好的问题,建议大家在PC端 ...
- 如何在BI中增加“路线地图”并进行数据分析?
随着客户的需求越来越"百变",最近在做大屏设计的葡萄陷入了困境. 近期客户提出的需求是想在BI工具中增加 "路线地图"展示功能并进行数据分析. 不仅如此,这个& ...
- 元数据治理利器 - Apache Atlas
一.功能简介 Atlas 是一组可扩展的核心基础治理服务,使企业能够高效地满足其在 Hadoop 中的合规性要求,并允许与整个企业数据生态系统集成.Apache Atlas 为组织提供开放的元数据管理 ...