夜莺监控使用指南
夜莺监控使用指南
本文用于解决在部署和应用夜莺监控中遇到的一些问题以及官方文档缺失的某些步骤可能会遇到的坑。
安装过程
我使用是Nightingale
+Categraf
+Prometheus
的架构。
- Nightingale安装文档:https://flashcat.cloud/docs/content/flashcat-monitor/nightingale-v7/install/intro/
- Categraf安装文档:https://flashcat.cloud/docs/content/flashcat-monitor/categraf/2-installation/
# 以service方式安装, 相当于添加service文件+systemctl daemon-reload
sudo ./categraf --install
# 以service方式卸载, 相当于systemctl stop categraf + 删除service文件
sudo ./categraf --remove
# 以service方式启动categraf ,相当于systemctl start categraf
# 如果之前有nohup启动的categraf进程,需要先人工停掉原来的categraf进程
sudo ./categraf --start
# 以service方式停止categraf,相当于systemctl stop categraf
sudo ./categraf --stop
# 以service方式查看categraf,相当于systemctl status categraf
sudo ./categraf --status
查看采集器输出哪些监控指标:
./categraf --test --inputs mysql
一次性测试、查看多个插件的输出:
# 注意使用冒号来分割多个插件
./categraf --test --inputs mysql:cpu:mem
- Prometheus安装文档:https://prometheus.fuckcloudnative.io/di-san-zhang-prometheus/di-2-jie-an-zhuang/gettingstarted
其中Prometheus
启动时,应使用./prometheus --web.enable-remote-write-receiver
作为启动语句,同时Categraf
配置文件应做如下改动:
# 找到此行配置
[[writers]]
url = "http://127.0.0.1:17000/prometheus/v1/write"
# 改成如下配置,根据Prometheus的部署确定IP和端口
[[writers]]
url = "http://localhost:9090/api/v1/write"
更改完配置后,在Prometheus
或者Nightingale
前端已经可以看到安装了Categraf
机器的相关监控信息。
采集过程
Categraf
自带的插件配置已经比较完善了,但是更改配置后,需要重启Categraf
或者执行
kill -HUP `pidof categraf`
这样在监控前端才能看到插件的监控数据。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步