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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.