Prometheus Alert Rules with Some Metrics
Using Prometheus as a monitor system, it is quite efficent. The most important one is that alert template is quite flexible,
I can alert the message with some other metrics value except the current metric value, it is quite convient. For example,
groups:
- name: example
rules:
- alert: Load alert
expr: node_load1 >
for: 5s
labels:
severity: page
annotations:
title: 'load1: {{ $value }}, load5: {{ printf `node_load5{instance="%s"}` $labels.instance | query | first | value }}, load15: {{ printf `node_load15{instance="%s"}` $labels.instance | query | first | value}}'
summary: High load
After configuring alertmanager and adding webhook_configs, I can capture the result of alert as following:
{"receiver":"default","status":"firing","alerts":[{"status":"firing","labels":{"alertname":"Load alert","instance":"127.0.0.1:9100","job":"prometheus","severity":"page"},"annotations":{"summary":"High load","title":"load1: 60.1494140625, load5: 38.009765625, load15: 23.18359375"},"startsAt":"2018-07-15T22:59:09.508199934+08:00","endsAt":"0001-01-01T00:00:00Z","generatorURL":"http://bogon:9090/graph?g0.expr=node_load1+%3E+1\u0026g0.tab=1"}],"groupLabels":{},"commonLabels":{"alertname":"Load alert","instance":"127.0.0.1:9100","job":"prometheus","severity":"page"},"commonAnnotations":{"summary":"High load","title":"load1: 60.1494140625, load5: 38.009765625, load15: 23.18359375"},"externalURL":"http://bogon:9093","version":"","groupKey":"{}:{}"}
We can get the values of load average in annotations:
load1: 60.1494140625, load5: 38.009765625, load15: 23.18359375
Afert receiving the message, we know the detail of load average in a machine.
Prometheus Alert Rules with Some Metrics的更多相关文章
- prometheus alert rules文件格式化
1.下载go(version>1.9,否则promtool工具不好使) https://golang.org/doc/install?download=go1.10.2.linux-amd64. ...
- 使用prometheus抓取k8s的metrics作监控时,cAdvisor和kubelet配置有何差别?
按网上说法: 目前cAdvisor集成到了kubelet组件内,可以在kubernetes集群中每个启动了kubelet的节点使用cAdvisor提供的metrics接口获取该节点所有容器相关的性能指 ...
- Prometheus 入门与实践
原文链接:https://www.ibm.com/developerworks/cn/cloud/library/cl-lo-prometheus-getting-started-and-practi ...
- 0基础入门 docker 部署 各种 Prometheus 案例 - 程序员学点xx 总集篇
目录 大家好, 学点xx 系列也推出一段时间了.虽然 yann 能力有限,但还是收到了很多鼓励与赞赏.对这个系列 yann 还是很喜欢的,特别是 Prometheus 篇,在期间经历公众号 100 篇 ...
- SpringBoot进阶教程(七十一)详解Prometheus+Grafana
随着容器技术的迅速发展,Kubernetes已然成为大家追捧的容器集群管理系统.Prometheus作为生态圈Cloud Native Computing Foundation(简称:CNCF)中的重 ...
- 监控生产线上服务器的docker容器及主机
1. 部署cadvisor容器,用来收集host上的容器信息,该容器部署在需要收集容器信息的每一个主机上部署: docker run -v /:/rootfs:ro -v /var/run:/var ...
- Spring Boot Metrics监控之Prometheus&Grafana(转)
欢迎来到Spring Boot Actuator教程系列的第二部分.在第一部分中,你学习到了spring-boot-actuator模块做了什么,如何配置spring boot应用以及如何与各样的ac ...
- kubernetes之监控Operator部署Prometheus(三)
第一章和第二章中我们配置Prometheus的成本非常高,而且也非常麻烦.但是我们要考虑Prometheus.AlertManager 这些组件服务本身的高可用的话,成本就更高了,当然我们也完全可以用 ...
- k8s部署prometheus
https://www.kancloud.cn/huyipow/prometheus/527092 https://songjiayang.gitbooks.io/prometheus/content ...
随机推荐
- 爬虫之Splash
Splash 是一个JavaScript渲染服务,是一个带有HTTP API 的轻量级浏览器,同时它对接了Python中Twisted和QT库. 1.功能介绍 1)异步方法处理多个网页渲染过程: 2) ...
- 项目(七)SVN版本管理与大型代码上线方案
SVN介绍 Svn(subversion)是近年来崛起的非常优秀的版本管理工具,与CVS管理工具一样,SVN是一个跨平台的开源的版本控制系统.Svn版本管理工具管理着随时间改变的各种数据.这些数据放置 ...
- winform UI 设计方法
这里主要提供了一种设计思路,你可以将成套的UI图像添加或替换到本程序中.在设计过程中,还存在许多疏漏,懒得仔细修改了,在使用过程中自行修改添加.这里的函数基本上都可以单独使用,需要哪个将cs文件加入到 ...
- linux学习笔记:关于环境变量
(摘自https://blog.csdn.net/llzk_/article/details/53813266之后整合) 1.linux系统的条件 Linux是一个多用户的操作系统,每个用户登录系统时 ...
- Exp5 MSF基础应用 20165110
Exp5 MSF基础应用 20165110 一.实践要求(3.5分) 实践目标是掌握metasploit的基本应用方式,重点常用的三种攻击方式的思路.具体需要完成: 1.一个主动攻击实践;(1分) m ...
- 求数组中两数之和等于target的两个数的下标
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标. 你可以假设每种输入只会对应一个答案.但是,你不能重复利用这个数组中同样的元 ...
- SUBMIT WITHOUT ALV
data:seltab type table of rsparams, seltab_wa like line of seltab. define add_seltab. if &1 is n ...
- pythone函数基础(13)发送网络请求
需要导入urllib模块,request模块发送网络请求有两种方法 第一种方法# from urllib.request import urlopen# from urllib.parse impor ...
- MVC Request生命周期(综合总结)
当用户在浏览器输入一个URL地址后,浏览器会发送一个请求到服务器.这时候在服务器上第一个负责处理请求的是IIS.然后IIS再根据请求的URL扩展名将请求分发给不同的处理程序处理. 流程如下: 当请求一 ...
- vs2013 v8编译
最新v8,只能在vs2015编译(在官网看了资料,新版本v8/chrome使用的c++11特性只能用vs2015编译) vs2015 vc需要的dll有近50个,发布不太方便,所以采用vs2013up ...