On 06/12/2021 08:19, nina guo wrote:
Thank you for your reply.

Let me clarify what we are going to do more.

We have the following alert rules for a container. But we still want to include the CPU usage of the corresponding host which host this container. That is:  - when CPU usage for container is larger than 85%, and CPU usage for host is larger than 85%, then the alert is triggered.

#rules for container
- alert: ContainerCpuUsage
        expr: (sum(rate(container_cpu_usage_seconds_total{name=~".+"}[3m])) BY (instance, name) * 100) > 85
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "Container CPU usage (instance {{ $labels.instance }})"
          description: "Container CPU usage is above 80%\n VALUE = {{ $value }}\n  LABELS: {{ $labels }}"

#rules for host
- alert: HighCpuLoad
          expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 85
          for: 5m
          labels:
            severity: critical
          annotations:
            summary: "High CPU load (instance {{ $labels.instance }})"
            description: "[TEST] CPU load is > 80%\n VALUE = {{ $value }}\n  LABELS: {{ $labels }}"

#rules for

Are there any labels for container_cpu_usage_seconds_total & node_cpu_seconds_total which match?

--
Stuart Clark

--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/edc9005f-71d9-7b1f-b13c-feb7a70656d3%40Jahingo.com.

Reply via email to