Files
nexus/wiki/concepts/Exporter.md

2.5 KiB
Raw Blame History

title, type, aliases, tags, date
title type aliases tags date
Exporter concept
Prometheus Exporter
指标导出器
Prometheus指标导出器
prometheus
monitoring
metrics
infrastructure
2025-11-11

Exporter

Overview

Exporter指标导出器是 Prometheus 生态中的核心组件,负责从各类目标系统采集指标数据,并通过 HTTP /metrics 端点暴露 Prometheus 格式的指标,供 Prometheus 服务器定期抓取。Exporter 不处理数据存储和告警,只做"采集 + 暴露"这一件事。

Design Philosophy

  • 无代理Agentless:大多数 exporter 作为独立进程运行,不需要在被监控系统上安装额外软件
  • HTTP 暴露:通过标准的 /metrics 端点提供文本格式的指标
  • 松耦合Exporter 与 Prometheus 通过 HTTP 协议解耦,可独立部署和升级
  • Pull 模式Prometheus 主动抓取,而非 exporter 主动推送

Official Exporters

Exporter 指标来源 默认端口
node_exporter Linux/Unix 主机CPU/内存/磁盘/网络) 9100
cAdvisor Docker 容器 8080
blackbox_exporter HTTP/TCP/DNS/TLS 端点 9115
alertmanager Alertmanager 实例 9093
postgres_exporter PostgreSQL 数据库 9187
mysql_exporter MySQL/MariaDB 数据库 9104
redis_exporter Redis 缓存 9121
nginx-exporter Nginx 状态页 9113

/metrics Format

# 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"} 123456.789
node_cpu_seconds_total{cpu="0",mode="user"} 98765.432

Key Fields

  • # HELP:指标说明(人类可读描述)
  • # TYPE指标类型gauge / counter / histogram / summary
  • 指标行:<metric_name>{<labels>} <value>

Prometheus scrape_config

scrape_configs:
  - job_name: 'node_exporter'
    static_configs:
      - targets: ['192.168.1.10:9100']