vigil监控以及webhook使用
vigil 是基于rust 编写的轻量,高效,简洁的服务可用性服务,目前发布的版本已经支持webhook了(可以灵活扩展)
我同时修改了,支持多个发送邮件,这样多种报警方式就都包含了,以下是使用demo
环境准备
wdbhook 使用benthos
- docker-compose 文件
version: "3"
services:
webhook:
image: jeffail/benthos
volumes:
- "./webhook.yaml:/benthos.yaml"
ports:
- "4195:4195"
vigil:
image: dalongrong/vigil:v1.12.1
command: vigil -c /opt/config.cfg
volumes:
- "./config.cfg:/opt/config.cfg"
ports:
- "8080:8080"
- 配置说明
webhook.yaml:
输出到标准输出
input:
type: broker
broker:
inputs:
- type: http_server
http_server:
path: /
processors:
- type: text
text:
operator: prepend
value: "get message: "
output:
type: stdout
vigil 配置:
# Vigil
# Microservices Status Page
# Configuration file
# Example: https://github.com/valeriansaliou/vigil/blob/master/config.cfg
[server]
log_level = "debug"
inet = "0.0.0.0:8080"
workers = 4
reporter_token = "REPLACE_THIS_WITH_A_SECRET_KEY"
[assets]
path = "./res/assets/"
[branding]
page_title = "Crisp Status"
page_url = "https://status.crisp.chat/"
company_name = "Crisp IM SARL"
icon_color = "#1972F5"
icon_url = "https://valeriansaliou.github.io/vigil/images/crisp-icon.png"
logo_color = "#1972F5"
logo_url = "https://valeriansaliou.github.io/vigil/images/crisp-logo.svg"
website_url = "https://crisp.chat/"
support_url = "mailto:support@crisp.chat"
custom_html = ""
[metrics]
poll_interval = 120
poll_retry = 2
poll_http_status_healthy_above = 200
poll_http_status_healthy_below = 400
poll_delay_dead = 30
poll_delay_sick = 10
push_delay_dead = 20
push_system_cpu_sick_above = 0.90
push_system_ram_sick_above = 0.90
[plugins]
[plugins.rabbitmq]
api_url = "http://127.0.0.1:15672"
auth_username = "rabbitmq-administrator"
auth_password = "RABBITMQ_ADMIN_PASSWORD"
virtualhost = "crisp"
queue_ready_healthy_below = 500
queue_nack_healthy_below = 100
queue_ready_dead_above = 20000
queue_nack_dead_above = 5000
queue_loaded_retry_delay = 500
[notify]
reminder_interval = 300
[notify.email]
from = "status@crisp.chat"
to = "status@crisp.chat,demo@crisp.chat"
smtp_host = "localhost"
smtp_port = 587
smtp_username = "user-access"
smtp_password = "user-password"
smtp_encrypt = false
[notify.twilio]
to = [
"+336xxxxxxx",
"+337xxxxxxx"
]
service_sid = "service-sid"
account_sid = "account-sid"
auth_token = "auth-token"
reminders_only = true
[notify.slack]
hook_url = "https://hooks.slack.com/services/xxxx"
mention_channel = true
[notify.pushover]
app_token = "xxxx"
user_keys = ["xxxx"]
[notify.xmpp]
from = "vigil@valeriansaliou.name"
to = "valerian@valeriansaliou.name"
xmpp_password = "xmpp-password"
[notify.webhook]
hook_url = "http://webhook:4195/"
[probe]
[[probe.service]]
id = "web"
label = "Web nodes"
http_body_healthy_match=".+"
[[probe.service.node]]
id = "core"
label = "Core main load balancer"
mode = "poll"
replicas = [
"tcp://edge-1.pool.net.crisp.chat:80",
"tcp://edge-2.pool.net.crisp.chat:80"
]
[[probe.service.node]]
id = "help"
label = "Core help load balancer"
mode = "poll"
replicas = ["tcp://help-1.pool.net.crisp.chat:80","http://192.168.11.1"]
[[probe.service.node]]
id = "api"
label = "Access to API service"
mode = "poll"
replicas = ["https://api.crisp.chat/v1/_system/health"]
[[probe.service.node]]
id = "status"
label = "Access to status page"
mode = "poll"
replicas = ["https://status.crisp.chat/robots.txt"]
http_body_healthy_match = "User-agent:.*"
[[probe.service]]
id = "relay"
label = "Relay nodes"
[[probe.service.node]]
id = "socket-client"
label = "Visitor realtime sockets"
mode = "push"
rabbitmq_queue = "client"
启动&&测试
- 启动
docker-compose up -d
- 查看webhook log
docker-compose logs -f webhook
- 效果
UI:
webhook log
说明
关于vigil 的配置,可以参考官方文档,这里就没有详细介绍,使用还是很简单的,同时v1.12.1 多人邮件的docker 镜像也已经push dockerhub 了
参考资料
https://github.com/rongfengliang/vigil-webhook-learning
https://github.com/rongfengliang/vigil-multi-docker
https://github.com/servo/rust-smallvec/issues/187
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2019-01-03 masterlab 敏捷项目管理工具
2019-01-03 luarocks 自定义包发布试用
2018-01-03 jest js 测试框架-简单方便人性化
2014-01-03 Nginx 安装成Windows 服务方法
2014-01-03 Windows环境下用jwplayer+Nginx搭建视频点播服务器
2014-01-03 我的nginx iis 负载均衡学习(环境搭建)
2014-01-03 windows 版nginx 的一些基础知识