Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and configuration of prometheus-operator

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Install prometheus-operator. Link to specific installation steps: https://www.qikqiak.com/k8s-book/docs/58.Prometheus%20Operator.html

2. Modify the configuration file

/ root/prometheus-operator/kube-prometheus/manifests

Vim alertmanager.yaml

Global:

Resolve_timeout: 60m

Smtp_smarthost: 'smtp.139.com:25'

Smtp_from: '15859527102' 139.com

Smtp_auth_username: '15859527102' 139.com

Smtp_auth_password: 'x84lingual asussimak'

Smtp_hello: '139.com'

Smtp_require_tls: false

Wechat_api_url: 'https://qyapi.weixin.qq.com/cgi-bin/'

Wechat_api_secret: '03vUA6wHSOtfCwfi8f7DkfXc0G4V6juaYOPDRjspnGU'

Wechat_api_corp_id: 'wwae01588e36d3f448'

Templates:

"* .tmpl"

Route:

Group_by: ['job',' severity']

Group_wait: 30s

Group_interval: 60m

Repeat_interval: 12h

Receiver: default

Routes:receiver: wechat

Match:

Alertname: CPUThrottlingHigh

Receivers:name: 'default'

Email_configs:to: '313841662 qq.com'

Send_resolved: truename: 'webhook'

Webhook_configs:url: 'http://dingtalk-hook.kube-system.svc.cluster.local:5000'

Send_resolved: truename: 'wechat'

Wechat_configs:

Send_resolved: true

Agent_id: '1000002'

To_user:'@ all'

Corp_id: 'wwae01588e36d3f448'

Api_secret: '03vUA6wHSOtfCwfi8f7DkfXc0G4V6juaYOPDRjspnGU'

PS: for more information on generating WeCom id and secret, please see the previous zabbix configuration Wechat alarm.

3. Create Wechat alarm template

Vim wechat.tmpl

{{define "wechat.default.message"}}

{{range .Alerts}}

= start=

Alarm program: prometheus_alert

Alarm level: {{.Labels.serverity}}

Alarm type: {{.Labels.alertname}}

Failed host: {{.Labels.instance}}

Alarm topic: {{.Annotations.summary}}

Alarm details: {{.Annotations.description}}

Trigger time: {{(.StartsAt.Add 28800e9) .Format "2006-01-02 15:04:05"}}

= end=

{{end}}

{{end}}

4. # first delete the previous secret object and recreate it

$kubectl delete secret alertmanager-main-n monitoring

Secret "alertmanager-main" deleted

Kubectl create secret generic alertmanager-main-from-file=alertmanager.yaml-from-file=wechat.tmpl-n monitoring

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report