Hi Brain
Thanks for the reply
I have created another rule with more straightforward logic and I get the
same sort of error.
groups:
- name: MiscellaneousRules
- alert: HostOutOfMemory
expr: node_memory_MemAvailable_bytes{job=”node_exporter”} /
node_memory_MemTotal_bytes{job=”node_exporter”} * 100 < 10
for: 5m
labels:
severity: warning
annotations:
summary: "Host out of memory (instance {{ $labels.instance }})"
description: "Node memory is filling up"
FAILED: [yaml: line 3: mapping values are not allowed in this context]
What I am trying to undertstand is exactly what is being mapped to where.
Thanks
On Monday, November 2, 2020 at 11:32:03 AM UTC [email protected] wrote:
> The top level of a rules file must be rule *groups*.
>
> groups:
> - name: MiscellaneousRules
> rules:
> - alert: PrometheusAllTargetsMissing
> expr: count by (job) (up) == 0
> ... etc
>
> Documentation references:
> https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/
> https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/
>
>
> <https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/>
> N
> <https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/>ote:
>
> I don't think that expression does what you want. If there are no targets
> for job "foo" then there will be no metrics with 'up{job="foo"}', hence
> there will be no output from that 'count by (job)' expression with label
> job="foo"; *not* a metric with a value of zero.
>
> I can't think of a way to find configured jobs which have no instances.
> You may have to use absent() or unless() with an offset to compare current
> scrapes with previous ones.
>
--
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/df80e5fd-8d2d-4cc8-8223-12bc55ee536an%40googlegroups.com.