karma prometheus alertmanager dashboard简单试用

官方提供了一个简单的all-in-one 的dockerfile 我们可以学习下karma,了解下karma的处理机制,同时在这个all-in-one 中
也还包含了kthxbye一个方便的报警确认进程,整个项目基于supervisord运行(当然这个也是大家基于all-in-one容器的一个套路)

环境准备

  • Dockerfile
 
FROM node:12.16.3-alpine3.11 as nodejs-builder
RUN mkdir -p /src/ui
COPY ui/package.json ui/package-lock.json /src/ui/
RUN cd /src/ui && npm install
RUN apk add make git
COPY ui /src/ui
RUN make -C /src/ui build
FROM golang:1.14.2-alpine3.11 as go-builder
RUN apk add make git
COPY Makefile /src/Makefile
COPY make /src/make
COPY go.mod /src/go.mod
COPY go.sum /src/go.sum
RUN make -C /src download-deps-go
RUN make -C /src install-deps-build-go
COPY --from=nodejs-builder /src/ui/src /src/ui/src
COPY --from=nodejs-builder /src/ui/build /src/ui/build
COPY cmd /src/cmd
COPY internal /src/internal
ARG VERSION
RUN CGO_ENABLED=0 make -C /src VERSION="${VERSION:-dev}" karma
FROM alpine:3.11
COPY --from=lmierzwa/kthxbye:v0.7 /kthxbye /kthxbye
COPY --from=prom/alertmanager:v0.20.0 /bin/alertmanager /alertmanager
RUN apk add supervisor python && rm  -rf /tmp/* /var/cache/apk/*
COPY demo/supervisord.conf /etc/supervisord.conf
COPY demo/alertmanager.yaml /etc/alertmanager.yaml
COPY demo/generator.py /generator.py
COPY --from=go-builder /src/karma /karma
COPY demo/karma.yaml /etc/karma.yaml
COPY demo/acls.yaml /etc/acls.yaml
COPY demo/custom.js /custom.js
RUN adduser -D karma
USER karma
ENV GOGC=20
CMD supervisord --nodaemon --configuration /etc/supervisord.conf 
  • supervisord.conf
[supervisord]
nodaemon=true
pidfile=/tmp/supervisord.pid
logfile = /tmp/supervisord.log
logfile_maxbytes = 1MB
logfile_backups=0
loglevel = info
[program:alertmanager1]
command=/alertmanager --config.file=/etc/alertmanager.yaml --storage.path=/tmp/alertmanager1 --web.listen-address=:9093  --cluster.listen-address=127.0.0.1:8001 --cluster.peer=127.0.0.1:8002 --cluster.settle-timeout=1s
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:alertmanager2]
command=/alertmanager --config.file=/etc/alertmanager.yaml --storage.path=/tmp/alertmanager1 --web.listen-address=:9094  --cluster.listen-address=127.0.0.1:8002 --cluster.peer=127.0.0.1:8001 --cluster.settle-timeout=1s
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:generator]
command=/generator.py
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:karma]
command=/karma --config.file /etc/karma.yaml
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:kthxbye]
command=/kthxbye -listen :8081
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
 
 

运行

我已经构建好了一个all-in-one 的docker,可以直接运行

  • 命令
 
docker run -d -p 8080:8080 -p 9093:9093 -p 9094:9094 -p 8081:8081 dalongrong/karma-all-in-one 
  • 效果

 

 

说明

karma 是一个不错的prometheus alertmanager dashboard,而且和kthxbye集成起来会更好

参考资料

https://github.com/prymitive/karma
https://prometheus.io/docs/alerting/alertmanager/
https://hub.docker.com/repository/docker/dalongrong/karma-all-in-one
https://github.com/prymitive/kthxbye

posted on   荣锋亮  阅读(1200)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2019-05-13 gitbase cube.js schema 文件项目
2014-05-13 oracle 获取星期日期
2014-05-13 oracle 查某一列有重复值的记录

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示