65 lines
2.5 KiB
Markdown
65 lines
2.5 KiB
Markdown
---
|
||
title: "Exporter"
|
||
type: concept
|
||
aliases: [Prometheus Exporter, 指标导出器, Prometheus指标导出器]
|
||
tags: [prometheus, monitoring, metrics, infrastructure]
|
||
date: 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
|
||
```text
|
||
# 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
|
||
```yaml
|
||
scrape_configs:
|
||
- job_name: 'node_exporter'
|
||
static_configs:
|
||
- targets: ['192.168.1.10:9100']
|
||
```
|
||
|
||
## Related Entities
|
||
- [[Prometheus]] — 数据消费者
|
||
- [[node_exporter]] — 主机指标 exporter
|
||
- [[cAdvisor]] — 容器指标 exporter
|
||
- [[blackbox_exporter]] — 网络探测 exporter
|
||
- [[Alertmanager]] — 告警 exporter
|
||
|
||
## Related Concepts
|
||
- [[PromQL]] — 指标查询语言
|
||
- [[Prometheus告警规则]] — 基于 exporter 指标的告警条件
|
||
- [[时序数据库]] — exporter 产出的数据存储模型
|
||
- [[System Monitoring]] — 应用领域
|