Label matchers

Matchers are employed to restrict a query search to a specific set of label values. We'll be using the node_cpu_seconds_total metric to exemplify the four available label matcher operators: =, !=, =~, and !~. Without any matching specification, this metric alone returns an instant vector with all the available time series containing the metric name, as well as all combinations of the CPU core numbers (cpu=”0”, cpu=”1”) and CPU modes (mode="idle", mode="iowait", mode="irq", mode="nice", mode="softirq", mode="steal", mode="user", mode="system"), which makes a grand total of 16 time series, as shown in the following screenshot:

Figure 7.2: node_cpu_seconds_total query resulting in 16 time series being returned

Now, let's use ...

Get Hands-On Infrastructure Monitoring with Prometheus now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.