Skip to main content

Prometheus 入门指南

·129 words·1 min
Author
lyonmu

什么是 Prometheus
#

Prometheus 是一个开源的监控和告警系统。

核心特性
#

  • 多维度数据模型
  • 强大的查询语言 PromQL
  • 拉取模式收集指标
  • 内置 Alertmanager

安装与启动
#

./prometheus --config.file=prometheus.yml

PromQL 示例
#

100 - (avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)

常用 Exporters
#

  • node-exporter:系统监控
  • cadvisor:容器监控

最佳实践
#

  1. 合理设置采集间隔
  2. 使用标签
  3. 配置长期存储