May I ask how to check all the available labels for this? Can we define new
labels?
For instances, we use file discovery to get the monitored target list.
On Monday, December 6, 2021 at 4:29:27 PM UTC+8 Stuart Clark wrote:
> 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/a8c52031-e828-429a-9f19-15412b6c1b30n%40googlegroups.com.