Prometheus
Last updated
Last updated
[TOC]
官方文档:
中文文档:
非官方:https://songjiayang.gitbooks.io/prometheus/content/
新建配置文件prometheus.yml:
源码包部署
各自参考官网部署方式即可。
docker部署
docker部署(保存监控数据)
docker-compose部署
docker-compose部署(保存监控数据)
Prometheus提供了一组管理API,以简化自动化和集成。
注意:{ip:port} 是普罗米修斯所在的IP和端口
1、健康检查
该端点始终返回200,应用于检查Prometheus的运行状况。
2、准备检查
当Prometheus准备服务流量(即响应查询)时,此端点返回200。
3、刷新
该端点触发Prometheus配置和规则文件的重新加载。默认情况下它是禁用的,可以通过该--web.enable-lifecycle
标志启用。
docker,如下拼接命令接口
docker-compose
触发配置重新加载的另一种方法是将a发送SIGHUP
给Prometheus进程。
4、放弃
该端点触发Prometheus的正常关闭。默认情况下它是禁用的,可以通过该--web.enable-lifecycle
标志启用。
触发正常关闭的另一种方法是将a发送SIGTERM
给Prometheus进程。
以下是经常使用到的储存配置:
--storage.tsdb.path
: Prometheus监控的数据存放点. 默认data/
.
--storage.tsdb.retention.time
: 数据保存最长时间. 默认 15d
. 此配置会覆盖掉storage.tsdb.retention
(storage.tsdb.retention
是过时配置) .
--storage.tsdb.retention.size
: [EXPERIMENTAL] This determines the maximum number of bytes that storage blocks can use (note that this does not include the WAL size, which can be substantial). The oldest data will be removed first. Defaults to 0
or disabled. This flag is experimental and can be changed in future releases. Units supported: KB, MB, GB, PB. Ex: "512MB"
--storage.tsdb.wal-compression
: 配置是否打开WAL的压缩功能。你可以期望WAL的大小减少一半,而只增加很少的cpu负载。请注意,如果您启用了这个标记,并随后将Prometheus降级到2.11.0以下的版本,您将需要删除WAL,因为它将无法读取。.