# Metrics类型

Prometheus定义了4中不同的指标类型(metric type)：Counter（计数器）、Gauge（仪表盘）、Histogram（直方图）、Summary（摘要）。

在NodeExporter返回的样本数据中，其注释中也包含了该样本的类型。例如：

```
# 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"} 927490.95
node_cpu_seconds_total{cpu="0",mode="iowait"} 27.74
...
```

上面的就是counter类型的指标。

## Counter：只增不减的计数器

Counter类型的指标数据，只增不减（除非系统发生重置）。常见的有`node_cpu_seconds_total{cpu="x",mode="idle"}`，它表示的意思是序号为`x`的cpu从开机到当前的这段时间内，cpu处于空闲（`idle`）状态的时间总和。

## Gauge：可增可减的仪表盘

Gauge类型的指标数据，可增可减，比如内存剩余量`node_memory_MemAvailable`

## to be continued


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pshizhsysu.gitbook.io/prometheus/4e8c29-tan-suo-promql/metricslei-xing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
