songjiayang / prometheus_practice Goto Github PK
View Code? Open in Web Editor NEW包括 Prometheus 基础知识,性能优化和大量实战经验。
Home Page: https://song-jia-yang.gitbook.io/prometheus/
包括 Prometheus 基础知识,性能优化和大量实战经验。
Home Page: https://song-jia-yang.gitbook.io/prometheus/
alertmanager发送到wechat的消息原始格式不易读,使用templates文件也无法实现wechat消息的格式化。
请问如何实现wechat text消息的内容和格式定制?谢谢!
我用yaml集成到prometheus operator里,发现获取不到数据,问一下,我用pushgateway写成yaml方式应该如何做呢
返回错误:{"error":"no such domain"}
import (
"strings"
)
{{- define "_alert_list" -}}
{{- range .Alerts.Firing -}}
--------
告警类型:{{ .Labels.alertname }}
告警主题: {{ .Annotations.summary }}
告警机器:{{ strings.Join("***",strings.Split(.Labels.instance, ".")[3])}} {{ .Labels.device }}
告警详情: {{ .Annotations.description }}
触发时间: {{ (.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}
{{ end -}}
{{- end -}}
{{- define "_resolve_list" -}}
{{- range .Alerts.Resolved -}}
************
告警类型:{{ .Labels.alertname }}
告警主题: {{ .Annotations.summary }}
告警机器:{{ strings.Join("***",strings.Split(.Labels.instance, ".")[3])}} {{ .Labels.device }}
告警详情: {{ .Annotations.description }}
触发时间: {{ (.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}
恢复时间: {{ (.EndsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}
{{ end -}}
{{- end -}}
{{- define "wechat.html" -}}
{{- if and (gt (len .Alerts.Firing) 0) (gt (len .Alerts.Resolved) 0) -}}
Alerts Firing:{{.Alerts.Firing | len}}
Alerts Resolved:{{len .Alerts.Resolved}}
{{ template "_alert_list" . }}
{{ template "_resolve_list" . }}
{{- else -}}
{{- if gt (len .Alerts.Firing) 0 -}}
Alerts Firing:{{.Alerts.Firing | len}}
{{ template "_alert_list" . }}
{{- end -}}
{{- if gt (len .Alerts.Resolved) 0 -}}
Alerts Resolved:{{len .Alerts.Resolved}}
{{ template "_resolve_list" . }}
{{- end -}}
{{- end -}}
{{- end -}}
报错信息如下:failed to reload config: template: wechat.tmpl:4: function "strings" not defined,请问如何在go template中引入strings
http://127.0.0.1:9090/api/v1/query_range?query=sum_over_time(Jvm_Thread_MemUsage[10s])&start=2018-10-18T02:00:00Z&end=2018-10-18T02:00:15Z&step=15s
对于上面的语句有一些不明白,希望大佬可以解答一下。
1:sum_over_time这个函数在查询时是否已经对时间进行分组。
2:这个语句对应的SQL语句是什么样的。
3:为什么通过这个语句查出的数据结果与我自己算的结果有些差异。
4:我想取规定时间、固定时间间隔的数据总和应该怎么取,就像下图这样
刚开始接触prometheus数据库,问题比较多,麻烦大佬了,非常感谢。
test
书稿中的图片存在以下问题:
建议:
while open this page
http://192.168.17.179:4000/container/k8s.html
http://192.168.17.179:4000/container/nginx.html
no message on the srceen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.