Prometheus初次使用

1.背景

为了增强新系统的稳定性,需增加监控和预警。
Zabbix vs Prometheus

2.Prometheus试用

# Prometheus collects metrics from targets by scraping metrics HTTP endpoints. Since Prometheus exposes data in the same manner about itself, it can also scrape and monitor its own health.
# (1)编写配置文件

# (2)启动Prometheus 服务,且修改默认端口9090为8072,http://localhost:8072/metrics 或 http://localhost:8072
./prometheus --config.file=prometheus.yml --web.listen-address=0.0.0.0:8072

# (3)表达式
prometheus_target_interval_length_seconds
prometheus_target_interval_length_seconds{quantile="0.99"}
count(prometheus_target_interval_length_seconds)

# (4)启动node_exporter [收集服务器信息]
nohup ./node_exporter --web.listen-address 0.0.0.0:8873

# (5)重新加载配置文件
kill -s SIGHUP [PID]

3.引用

prometheus get start
prometheus端口修改指引
[如何用Prometheus和Grafana实现集群的监控预警?](https://zhuanlan.zhihu.com/p/588254228)

4.问题

# Prometheus relies on accurate time and time drift might cause unexpected query results.
[root@c1 bonc_zj]# ntpdate ntp.aliyun.com
14 Nov 16:53:58 ntpdate[2349]: the NTP socket is in use, exiting
[root@c1 bonc_zj]# service ntpd stop
Redirecting to /bin/systemctl stop ntpd.service
[root@c1 bonc_zj]# ntpdate ntp.aliyun.com
14 Nov 17:05:31 ntpdate[4251]: step time server 203.107.6.88 offset 552.115921 sec
[root@c1 bonc_zj]# date
Tue Nov 14 17:05:33 CST 2023

posted @   钱塘江畔  阅读(18)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2022-11-14 mysql8创建组合索引
点击右上角即可分享
微信分享提示