alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Alert routing usage

Open Alwaysc0d3 opened this issue 9 years ago • 4 comments

Hi guys,

Im having a alertmanager.yml file where i defined all of the alert routes, matches and receivers. Now im wondering the following:

What is the processing order of the alert routing? Top, down?

Im wondering this, because we have alerts created with the label 'severity', containing the possible values 'warning' or 'critical'.

We defined the alert routes as the following:

  • Routes:
    • match: severity:"warning" receiver: teamXHipChat

    • match_re: application:^(applicationone|twoapplication) receiver: teamXHipChat

    • match_re: application:^(appthree|appfour) receiver: teamYHipChat

receivers: (The hipchat receiver configured)

Then an alert is fired from prometheus with the following labels: application:"appthree",severity:"warning"

Where will the alert ends? And why? Does the latest matched label count? Or the first? Or is it wise to add multiple conditions in match statement? Is that even possible?

Question two: I saw a configuration file of somebody, he added multiple 'routes:' configuration in his alertmanager.yml, is that a good syntax/way of working? Or is it possible to add all the alerts in just one routes: group?

P.s. the entered configuration might not syntactically correct, it's just about the way of handling the alertmanager.yml file by alertmanager.

I would like to hear from you guys,

Alwaysc0d3 avatar Jun 16 '17 22:06 Alwaysc0d3

By the way,i'm willing to create some documentation for the alertmanager config as soon as i know this. For example, the hipchat receiver documentation still needs to be wrote, where should i add that?

Alwaysc0d3 avatar Jun 16 '17 22:06 Alwaysc0d3

This is a usage question, which should be directed to the prometheus-users mailing group.

As to your question, alertmanager does a depth-first search left to right search (https://github.com/prometheus/alertmanager/blob/master/dispatch/route.go#L114-L115). You can test your alert config out here: https://prometheus.io/webtools/alerting/routing-tree-editor/

stuartnelson3 avatar Jun 18 '17 09:06 stuartnelson3

@wombledmaize We welcome any kind of contributions to the documentation! As far as I can tell, the documentation of Alertmanager lives here: https://github.com/prometheus/docs/blob/master/content/docs/alerting/configuration.md

mxinden avatar Jun 18 '17 14:06 mxinden

@stuartnelson3 Thanks for the reply. With the online tool you provided, i was able to get a bright view of the routing / alerting in alertmanager.

@mxinden I will, thanks.

Alwaysc0d3 avatar Jun 19 '17 10:06 Alwaysc0d3