我node_cpu_seconds_total
为此使用指标。
基本上,我想mode="idle"
从总 CPU 使用率中减去,然后取结果的平均速率,然后计算百分比。
我试过类似的东西:
100 - (avg(rate(node_cpu_seconds_total{instance="ip-X-X-X-X.eu-west-1.compute.internal:9100",job="rabbitmq-prod-node-exporter",replica="prometheus-prod"} - node_cpu_seconds_total{instance="ip-X-X-X-X.eu-west-1.compute.internal:9100",mode="idle",job="rabbitmq-prod-node-exporter",replica="prometheus-aws-prod"}))[1m] * 100)
但似乎不正确,并且还显示解析错误:
Error executing query: parse error at char 177: range specification must be preceded by a metric selector, but follows a *promql.AggregateExpr instead