I'm trying to create a prometheus rule that will detect when CPU usage is above 95%
only on hostnames matching a string (eg: "^as(.*)" which are my application servers.
The problem is that my "instance" fields are IP address:port (eg:
10.123.5.5:9182).
So this query returns the instances and what looks like % cpu utilization:
( 100 - (avg by (instance) (irate(windows_cpu_time_total{mode="idle"}[5m])) * 100) > 95)
And this query gets me the hostnames I'm looking for:
windows_cs_hostname{hostname=~".*as.*"}
So how do I combine them so that I get the CPU utilization value for ONLY hostnames
starting with "as" (here again, the instance fields are the same ipaddress:port pairs.
Regards,
Alan