VictoriaMetrics 集成karma
以前有介绍过karma,以下是一个集成,实际上这个肯定是可以跑通的,因为依赖的都是alertmanager这个是都兼容的
环境准备
- docker-compose 文件
version: "3"
services:
vmstorage:
image: victoriametrics/vmstorage
ports:
- 8482:8482
- 8400:8482
- 8401:8482
volumes:
- ./strgdata:/storage
command:
- '--storageDataPath=/storage'
vmagent:
image: victoriametrics/vmagent
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- 8429:8429
command:
- -promscrape.config=/etc/prometheus/prometheus.yml
- -remoteWrite.basicAuth.username=dalong-insert-account-1
- -remoteWrite.basicAuth.password=dalong
- -remoteWrite.url=http://vmauth:8427
alertmanager:
image: prom/alertmanager:latest
volumes:
- "./alertmanager.yaml:/etc/alertmanager.yaml"
command:
- --config.file=/etc/alertmanager.yaml
- --storage.path=/tmp/alertmanager1
ports:
- 9093:9093
vmalert:
image: victoriametrics/vmalert
volumes:
- "./alert.rules:/etc/victoriametrics/alert.rules"
ports:
- 8880:8880
command:
- -rule=/etc/victoriametrics/alert.rules
- -datasource.url=http://vmauth:8427
- -datasource.basicAuth.password=dalong
- -datasource.basicAuth.username=dalong-select-account-1
- -notifier.url=http://alertmanager:9093
vmauth:
image: victoriametrics/vmauth
volumes:
- "./config.yaml:/etc/victoriametrics/config.yaml"
command:
- -auth.config=/etc/victoriametrics/config.yaml
- -http.disableResponseCompression
ports:
- 8427:8427
karma:
image: lmierzwa/karma:v0.63
volumes:
- "./karma.yaml:/etc/karma.yaml"
command: --config.file /etc/karma.yaml
ports:
- 8080:8080
kthxbye:
image: lmierzwa/kthxbye:v0.7
command: -alertmanager.uri http://alertmanager:9093 -interval 15s
vminsert:
image: victoriametrics/vminsert
command:
- '--storageNode=vmstorage:8400'
ports:
- 8480:8480
vmselect:
image: victoriametrics/vmselect
command:
- '--storageNode=vmstorage:8401'
ports:
- 8481:8481
grafana:
image: grafana/grafana
ports:
- 3000:3000
- 配置
主要包含vmagent,vmauth,vmalert.alertmanager,karma
vmagent(就是prometheus 的配置)
global:
scrape_interval: 1s
evaluation_interval: 1s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['prometheus:9090']
- job_name: 'vminsert'
static_configs:
- targets: ['vminsert:8480']
- job_name: 'vmselect'
static_configs:
- targets: ['vmselect:8481']
- job_name: 'vmstorage'
static_configs:
- targets: ['vmstorage:8482']
vmauth
users:
- username: "dalong-select-account-1"
password: "dalong"
url_prefix: "http://vmselect:8481/select/1/prometheus"
- username: "dalong-insert-account-1"
password: "dalong"
url_prefix: "http://vminsert:8480/insert/1/prometheus"
vmalert 主要是rules
groups:
- name: groupGorSingleAlert
rules:
- alert: VMRows
for: 10s
expr: vm_rows > 0
labels:
label: bar
host: "{{ $labels.instance }}"
annotations:
summary: "{{ $value|humanize }}"
description: "{{$labels}}"
- name: TestGroup
rules:
- alert: Conns
expr: sum(vm_tcplistener_conns) by(instance) > 1
annotations:
summary: "Too high connection number for {{$labels.instance}}"
description: "It is {{ $value }} connections for {{$labels.instance}}"
- alert: ExampleAlertAlwaysFiring
expr: sum by(job)
(up == 1)
alertmanager
global:
resolve_timeout: 30s
route:
group_by: ["alertname"]
group_wait: 5s
group_interval: 10s
repeat_interval: 999h
receiver: "default"
routes:
- receiver: "default"
group_by: []
match_re:
alertname: .*
continue: true
- receiver: "pagination"
group_by: ["alertname", "instance"]
match_re:
alertname: Pagination Test
continue: false
- receiver: "by-cluster-service"
group_by: ["alertname", "cluster", "service"]
match_re:
alertname: .*
continue: true
- receiver: "by-name"
group_by: [alertname]
match_re:
alertname: .*
continue: true
- receiver: "by-cluster"
group_by: [cluster]
match_re:
alertname: .*
continue: true
inhibit_rules:
- source_match:
severity: "critical"
target_match:
severity: "warning"
# Apply inhibition if the alertname and cluster is the same in both
equal: ["alertname", "cluster"]
receivers:
- name: "default"
- name: "pagination"
- name: "by-cluster-service"
- name: "by-name"
- name: "by-cluster"
karma
alertdashboard
- 启动
docker-compose up -d
- 一些说明
为了处理slice 报警使用了kthxbye
效果
说明
关于karma以及kthxbye的介绍可以参考以下连接
参考资料
https://github.com/prymitive/karma
https://github.com/prymitive/kthxbye
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2019-05-22 rpmlint 方便的rpm spec 以及rpm 文件检查工具
2019-05-22 linux patch 简单学习
2019-05-22 rpm 简单 package 创建demo
2019-05-22 fio 文件系统io 性能测试安装使用
2019-05-22 保护 SSH 的三把锁
2019-05-22 redis 设置为只读模式