1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1、 /api/v1/query (GET /POST ) 即时查询,使用参数如下: - query=<查询语句> - time =<rfc3339 | unix_timestamp>时间戳,可选项 - timeout=<duration>: 超时时间,-query.timeout限制,可选项 若 time 不给定,默认为服务器当前时间。 curl 'http://localhost:9090/api/v1/query?query=up' curl 'http://localhost:9090/api/v1/query?query=up&time=2022-11-28T02:10:30.781Z' 2、 /api/v1/query_range (GET /POST ) 范围查询,使用参数如下: - query=<查询语句> - start=<rfc3339 | unix_timestamp>:开始时间(包含该值) - end=<rfc3339 | unix_timestamp>:结束时间(包含该值) - step=<duration | float>duration:浮点格式的步长 - timeout=<duration>: 超时时间 curl 'http://localhost:9090/api/v1/query_range?query=up&start=2022-11-28T02:10:30.781Z&end=2022-11-29T20:11:00.781Z&step=15m' 3、 /api/v1/series (GET /POST ) 元数据序列查询,使用参数如下: - match[]=<series_selector>:选择返回参数 - start=<rfc3339 | unix_timestamp>:开始时间 - end=<rfc3339 | unix_timestamp>:结束时间 curl -g 'http://localhost:9090/api/v1/series?' 'match[]=up' 4、 /api/v1/labels 获取元数据标签 - match[]=<series_selector>:选择返回参数 - start=<rfc3339 | unix_timestamp>:开始时间 - end=<rfc3339 | unix_timestamp>:结束时间 删除数据 curl -X POST -g 'http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series?match[]=node_cpu_seconds_total{mode="idle"}' <br>curl -X POST -g 'http://127.0.0.1:8001/api/v1/admin/tsdb/delete_series?match[]=node_cpu_seconds_total{mode="idle"}&start=684810073&end=1685069273' <br> #注:需加上 --web.enable-admin-api 启动参数才能删除操作#nohup ./prometheus --config.file=prometheus.yml --web.listen-address=:8001 --storage.tsdb.retention.time=90d --web.enable-lifecycle --web.enable-admin-api &<br> |
分类:
prometheus
标签:
prometheus 接口
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?