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/ba6d180b-6fde-4ac5-8500-b24991303962o%40googlegroups.com.