1. 传输参数参考:https://github.com/prometheus/pushgateway)(prometheus pushgateway 以及alertmanager都部署好了)
2.
3.
4.
5.
6.
7.
8.
9.
10
[root@k8s-master01 pushtogatewaytest]# cat push.sh
#!/bin/bash
cat <<EOF | curl --data-binary @- http://192.168.48.18:9091/metrics/job/some_job/instance/some_instance
another_metric 1601.284
EOF
[root@k8s-master01 pushtogatewaytest]#
- alert: "alert"
expr: another_metric{exported_instance="some_instance",exported_job="some_job"} > 500
for: 10s
labels:
severity: 比较严重
annotations:
summary: "{{$labels.mountpoint}} alert使用率过高!"
description: "{{$labels.mountpoint }} alert使用率连续 10min 大于95% (目前使用:{{$value}}%)"
11.接着测试自定义标签
多加几个脚本 push到 pushgateway
测试结果:
来源:oschina
链接:https://my.oschina.net/u/4266314/blog/4539168