prometheus安装
2024-09-05记录
安装下载
https://prometheus.io/download
https://www.cnblogs.com/ExMan/p/12567247.html
创建目录
mkdir /usr/local/prometheus
进入目录
cd /usr/local/prometheus
解压
tar -zxf prometheus-2.53.1.linux-amd64.tar.gz
修改配置文件
prometheus.yml
检查配置文件
./promtool check config prometheus.yml
./promtool --help
./prometheus --help
chmod a+x "prometheus"
启动
./prometheus --config.file=./prometheus.yml --web.enable-lifecycle
静默启动
nohup ./prometheus --config.file=./prometheus.yml --web.enable-lifecycle --storage.tsdb.retention.time=20d --web.external-url=http://8.219.198.22:9090 > server_prometheus.log 2>&1 &
查看进程
ps -ef | grep prometheus
kill -9 xxx
查找端口盏用情况
lsof -i :9094
netstat -tulnp | grep :9093
rule
https://samber.github.io/awesome-prometheus-alerts/rules
groups:
- name: exceptionRule
rules:- alert: exceptionAlert
expr: application_exception{application="userDemo"} < 10
for: 10s
labels:
severity: warning
team: frontend
annotations:
summary: "服务器频繁报错"
description: "报错的频率达到(当前值:{{ $value }}%)"
- alert: exceptionAlert
- name: ckExceptionRule
rules:- alert: ckExceptionAlert
expr: sum(increase(bbc_request_timer_ID_seconds_count{}[5m])) by (business_name) > 10
for: 10s
labels:
severity: warning
app: "gateway"
annotations:
summary: "test系统最近5分钟服务异常"
description: "报错的频率达到(当前值:{{ $value }})"
- alert: ckExceptionAlert
检查模版
./promtool check rules first_rules.yml
关闭
ps -ef |grep prometheus |awk '{print $2}'|xargs kill -9
启动
nohup ./prometheus --config.file=./prometheus.yml --web.enable-lifecycle --storage.tsdb.retention.time=20d --web.external-url=http://8.219.198.22:9090 > server_prometheus.log 2>&1 &
重启
curl -X POST http://localhost:9090/-/reload
介绍:counter、timer、Gauge
https://blog.csdn.net/qq_20107237/article/details/125741018
https://blog.csdn.net/qq_34556414/article/details/138495421
https://zhuanlan.zhihu.com/p/675205581
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构