VictoriaMetrics stack Cluster 0.14.17 安装配置

  • Post author:
  • Post category:其他


文章目录

// 添加 repo

$ helm repo add vm https://victoriametrics.github.io/helm-charts/

// 使用自定义 value 文件安装

$ helm install vm-stack vm/victoria-metrics-k8s-stack \
  -f https://gitee.com/jack_zang/monitor/raw/master/vm/install/stack/rancher/vm-stack-0.14.17-value.yaml \
  --version 0.14.17 -n kube-vm

// 安装 alertmanager

$ kubectl apply -n kube-vm \
  -f https://gitee.com/jack_zang/monitor/raw/master/vm/install/stack/rancher/alertmanager/alertmanager.yaml

修改 VMalert vm-stack-victoria-metrics-k8s-stack yaml 文件中的 通知地址:

notifiers:
  - url: http://alertmanager.kube-vm.svc:9093

// 安装集中告警中心

$ kubectl apply -n kube-vm \
  -f https://gitee.com/jack_zang/monitor/raw/master/prometheus-alert/prometheus-alert-deploy.yaml

// 配置钉钉模板

{{ $var := .externalURL}}{{ range $k,$v:=.alerts }}
{{if eq $v.status "resolved"}}
## [恢复信息]({{$v.generatorURL}})
##### 恢复项目:{{$v.labels.alertname}}
###### 告警级别:{{$v.labels.severity}}
###### 开始时间:{{TimeFormat $v.startsAt "2006-01-02 15:04:05"}}  
###### 结束时间:{{TimeFormat $v.endsAt "2006-01-02 15:04:05"}}  
###### 故障主机IP:{{$v.labels.instance}}
##### {{$v.annotations.description}}
![Prometheus](https://gitee.com/jack_zang/monitor/raw/master/prometheus-alert/image/success.png)
{{else}}
{{if eq $v.labels.severity "warning"}}
## [告警信息]({{$v.generatorURL}})
##### 告警项目:{{$v.labels.alertname}}
###### 告警级别:{{$v.labels.severity}}
###### 开始时间:{{TimeFormat $v.startsAt "2006-01-02 15:04:05"}}  
###### 故障主机IP:{{$v.labels.instance}}
##### {{$v.annotations.description}}
![Prometheus](https://gitee.com/jack_zang/monitor/raw/master/prometheus-alert/image/warning.png)
{{else}}
## [告警信息]({{$v.generatorURL}})
##### 告警项目:{{$v.labels.alertname}}
###### 告警级别:{{$v.labels.severity}}
###### 开始时间:{{TimeFormat $v.startsAt "2006-01-02 15:04:05"}}
###### 故障主机IP:{{$v.labels.instance}}
##### {{$v.annotations.description}}
![Prometheus](https://gitee.com/jack_zang/monitor/raw/master/prometheus-alert/image/danger.png)
{{end}}
{{end}}
{{ end }}
{{ $urimsg:=""}}{{ range $key,$value:=.commonLabels }}{{$urimsg =  print $urimsg $key "%3D%22" $value "%22%2C" }}{{end}}

// 创建自定义抓取 altermanager

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
  name: custom-scrape-svc-alertmanager
spec:
  endpoints:
  - port: web
  selector:
    matchLabels:
      app.kubernetes.io/instance: vm-stack
      app.kubernetes.io/name: alertmanager

// 应用配置

$ kubectl apply -n kube-vm \
  -f https://gitee.com/jack_zang/monitor/raw/master/vm/install/stack/rancher/alertmanager/alertmanager-scope.yaml



版权声明:本文为zangxueyuan88原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。