Rules vs Alerts

363 views
Skip to first unread message

Cemalettin Koc

unread,
Apr 30, 2017, 4:28:07 PM4/30/17
to Prometheus Users
What is the difference with Rules and Alerts. In the documentation I can see that

# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.

In the documentation of "alerting rules", almost all paragraphs are including words of "alerting rules". So what are "rules" and "alerts" implying? For alerts: alerting rules, and for rules: "recording rules" ? 

Thanks

Ben Kochie

unread,
Apr 30, 2017, 4:56:11 PM4/30/17
to Cemalettin Koc, Prometheus Users
Rules files contain two basic kinds of configurations.

Recording rules[0], and alerts[1].

Recording rules allow you to transform a query into a new set of metrics;
# The count of CPUs per node, useful for getting CPU time as a percent of total.
instance:node_cpus:count = count(node_cpu{mode="idle"}) without (cpu,mode)
Alerting rules create alert messages that can be routed through the alert manager.

ALERT InstanceIsDown
  IF up == 0
  FOR 5m
  LABELS {
    severity = "critical"
  }
  ANNOTATIONS {
    summary = "An instance is down"
    description = ""{{$labels.job}} on {{$labels.instance}} is down"
}


--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/03a0af30-8bb7-4733-8a70-a4c83863896e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cemalettin Koc

unread,
May 1, 2017, 6:24:18 AM5/1/17
to Prometheus Users, cemalet...@gmail.com
I would go to separate these files by contextual meanings. I mean for etcd, kubernetes components, database etc.. I will use separate files. This makes much more sense for me. This will also help me to reuse these files.

Thanks for clarification. 



To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.

Ben Kochie

unread,
May 2, 2017, 2:56:11 AM5/2/17
to Cemalettin Koc, Prometheus Users
The current implementation evaluates all rules from all files with a single timer, so the organization of what goes in which file is left entirely up to the user.

To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/3ad22555-080f-4185-8da7-0cc68405d140%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages