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'

相关推荐
JasonChen@6662 天前
prometheus静态监控static_configs案例一(7)
prometheus
lisanmengmeng2 天前
prometheus的rules 配置说明
prometheus
fengkai45456 天前
Prometheus+K8s弹性伸缩综合项目
运维·kubernetes·k8s·prometheus·hpa·vpa
mengge.cloud8 天前
prometheus+k8s+弹性伸缩,综合项目
云原生·容器·kubernetes·prometheus
闲云野鹤在人间9 天前
Prometheus入门|搭建Prometheus+Node‑Exporter+Grafana完整主机监控平台
grafana·prometheus
疯子的梦想@18 天前
Prometheus 接入 Alertmanager 与钉钉机器人,附中文模板和完整踩坑记录
机器人·钉钉·prometheus
lbb 小魔仙19 天前
Windows搭建PaddleOCR+飞书Webhook自动打卡通知机器人:识别、推送与远程触发完整教程
数据库·人工智能·prometheus·时序数据库
云边有个稻草人20 天前
Prometheus Pushgateway教程:离线任务指标上报、Shell与Python示例、远程访问
开发语言·python·prometheus
广目软件21 天前
HA分布式架构采集节点变更操作手册20261029
运维·服务器·ansible·zabbix·prometheus
tianyuanwo25 天前
Prometheus 服务部署指南:从架构原理到生产级落地
架构·prometheus