prometheus
Contents
Prometheus collects and stores its metrics as time series data
Components
- Prometheus server: scrapes and stores time series data 单文件
- alertmanager
- exporter https://www.prometheus.wang/exporter/what-is-prometheus-exporter.html
- node_exporter
- Grafana, for visualize [optional]
play - node info metrics
- run exporter to generate metrics
- add config to server to listen
1
2
3
4
5
6
7
8
9
10
11
12
13
14scrape_configs:
- job_name: 'node'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
static_configs:
- targets: ['192.168.56.105:8081', '192.168.56.105:8082']
labels:
group: 'production'
- targets: ['localhost:8082']
labels:
group: 'canary'
定义了4中不同的指标类型(metric type):Counter(计数器)、Gauge(仪表盘)、Histogram(直方图)、Summary(摘要)。
Counter:只增不减的计数器
rate(http_requests_total[5m])
topk(10, http_requests_total)
Gauge:可增可减的仪表盘
node_memory_MemFree
delta(cpu_temp_celsius{host=”zeus”}[2h])