prometheus时序数据库

时序数据库理论部分,参考时序数据库_vm时序数据库-CSDN博客

时序数据库一般采取拉的方式,在配置文件中配置每个采集任务的url地址,采集周期,然后周期到每个采集节点去http get数据。

需要先启动一个exporter(即上报器,其实是个http服务,等待prometheus或其它时序数据库周期拉取数据)

1、下载node_exporter-1.11.1.linux-amd64,解压后执行node_exporter

2、可以看到这个node_exporter的端口是9100

time=2026-09-19T19:29:14.811+08:00 level=INFO source=tls_config.go:354 msg="Listening on" address=:::9100

time=2026-09-19T19:29:14.811+08:00 level=INFO source=tls_config.go:357 msg="TLS is disabled." http2=false address=:::9100

3、在浏览器中输入http://localhost:9100/metrics,可以看到上报了很多测量指标,如下是node_cpu_seconds_total这个指标,标签是cpu和mode,值是最后一列

复制代码
# HELP node_cpu_seconds_total Seconds the CPUs spent in each mode.
# TYPE node_cpu_seconds_total counter
node_cpu_seconds_total{cpu="0",mode="idle"} 5.07908674e+06
node_cpu_seconds_total{cpu="0",mode="iowait"} 969.37
node_cpu_seconds_total{cpu="0",mode="irq"} 32883.31
node_cpu_seconds_total{cpu="0",mode="nice"} 7.24
node_cpu_seconds_total{cpu="0",mode="softirq"} 20080.27
node_cpu_seconds_total{cpu="0",mode="steal"} 5129.01
node_cpu_seconds_total{cpu="0",mode="system"} 424382.12
node_cpu_seconds_total{cpu="0",mode="user"} 572838.97
node_cpu_seconds_total{cpu="1",mode="idle"} 5.12986934e+06
node_cpu_seconds_total{cpu="1",mode="iowait"} 734.44
node_cpu_seconds_total{cpu="1",mode="irq"} 30868.19
node_cpu_seconds_total{cpu="1",mode="nice"} 6.8
node_cpu_seconds_total{cpu="1",mode="softirq"} 22270.78
node_cpu_seconds_total{cpu="1",mode="steal"} 5002.12
node_cpu_seconds_total{cpu="1",mode="system"} 419887.83
node_cpu_seconds_total{cpu="1",mode="user"} 534317.43
node_cpu_seconds_total{cpu="2",mode="idle"} 5.0708136e+06
node_cpu_seconds_total{cpu="2",mode="iowait"} 911.12
node_cpu_seconds_total{cpu="2",mode="irq"} 34315.67
node_cpu_seconds_total{cpu="2",mode="nice"} 6.49
node_cpu_seconds_total{cpu="2",mode="softirq"} 19021.82
node_cpu_seconds_total{cpu="2",mode="steal"} 5081.08
node_cpu_seconds_total{cpu="2",mode="system"} 428523.02
node_cpu_seconds_total{cpu="2",mode="user"} 575346.52

然后下载解压prometheus-3.11.3.linux-386,

1、在prometheus.yml中配置这个exporter

javascript 复制代码
global:
  scrape_interval: 15s

scrape_configs:
  # 已有的 Prometheus 自身监控任务
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  # 新增:Node Exporter 监控任务
  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']
        labels:
          instance: 'my-server'

2、启动prometheus

3、打开http://127.0.0.1:9090/

点击 Status->Target Health可以看到这个采集点的URL和状态。

3.1 在查询页面可以输入PromQL查询条件,

比如直接输入指标名称node_cpu_seconds_total

或者node_cpu_seconds_total{cpu="2",mode="user"} ,

或者5分钟内的数据node_cpu_seconds_total{cpu="2",mode="user"}5m

3.2 也可以调用http接口查询,比如

curl -G 'http://localhost:9090/api/v1/query' --data-urlencode 'query=node_cpu_seconds_total{cpu="0",mode="idle"}5m'

相关推荐
广目软件11 小时前
HA分布式架构采集节点变更操作手册20261029
运维·服务器·ansible·zabbix·prometheus
tianyuanwo5 天前
Prometheus 服务部署指南:从架构原理到生产级落地
架构·prometheus
看浪的路人8 天前
第8讲:记忆系统的监控与运维——Prometheus 指标、Grafana 面板与告警体系
运维·grafana·prometheus
爬也要爬着前进9 天前
Prometheus通过Nginx-vts-exporter模块监控nginx服务
运维·nginx·prometheus
Crayon Lin9 天前
Prometheus
prometheus
川石课堂软件测试11 天前
JMeter异步接口测试实战
数据库·python·jmeter·mysql·kubernetes·测试用例·prometheus
lbb 小魔仙14 天前
Redis运行状态总靠手动查?我用redis_exporter+Prometheus把指标、告警和远程抓取全接起来了
redis·bootstrap·prometheus
程序员-Benothing14 天前
Linux系统监控工具全家桶:sar、dstat、glances、Prometheus
linux·运维·prometheus
wzq11_66615 天前
Prometheus监控——云原生与非云原生监控
云原生·prometheus
东风微鸣15 天前
把 Tailscale 接进 Prometheus 监控
java·数据库·prometheus