*: bump to Go 1.17 (#2792)

* *: bump to Go 1.17

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* *: fix yamllint errors

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2021-12-22 14:03:53 +01:00 committed by GitHub
parent dcaa3a05be
commit 48a99764a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 410 additions and 451 deletions

View File

@ -1,10 +1,8 @@
--- ---
version: 2.1 version: 2.1
orbs: orbs:
prometheus: prometheus/prometheus@0.11.0 prometheus: prometheus/prometheus@0.11.0
go: circleci/go@0.2.0 go: circleci/go@1.7.0
jobs: jobs:
test_frontend: test_frontend:
# We need to use a machine executor because the front-end validation runs # We need to use a machine executor because the front-end validation runs
@ -12,144 +10,138 @@ jobs:
# executor (even with setup_remote_docker). # executor (even with setup_remote_docker).
machine: true machine: true
steps: steps:
- checkout - checkout
- run: sudo service docker restart - run: sudo service docker restart
- run: - run:
name: Remove existing Go installation name: Remove existing Go installation
command: sudo rm -rf /usr/local/go command: sudo rm -rf /usr/local/go
# Whenever the Go version is updated here, .promu.yml should also be updated. # Whenever the Go version is updated here, .promu.yml should also be updated.
- go/install: - go/install:
version: "1.16" version: "1.17"
- run: - run:
name: Remove generated code name: Remove generated code
command: make clean command: make clean
- run: - run:
name: Generate front-end code name: Generate front-end code
command: make all command: make all
working_directory: ~/project/ui/app working_directory: ~/project/ui/app
environment: environment:
JUNIT_DIR: ~/test-results JUNIT_DIR: ~/test-results
- run: - run:
name: Generate assets name: Generate assets
command: make assets command: make assets
- run: - run:
name: Generate API v2 code name: Generate API v2 code
command: make apiv2 command: make apiv2
- run: git diff --exit-code - run: git diff --exit-code
- store_test_results: - store_test_results:
path: ~/test-results path: ~/test-results
test: test:
docker: docker:
# Whenever the Go version is updated here, .promu.yml should also be updated. # Whenever the Go version is updated here, .promu.yml should also be updated.
- image: circleci/golang:1.16 - image: quay.io/prometheus/golang-builder:1.17-base
# maildev containers are for running the email tests against a "real" SMTP server. # maildev containers are for running the email tests against a "real" SMTP server.
# See notify/email_test.go for details. # See notify/email_test.go for details.
- image: djfarrelly/maildev:1.1.0 - image: djfarrelly/maildev:1.1.0
name: maildev-noauth name: maildev-noauth
entrypoint: bin/maildev entrypoint: bin/maildev
command: command:
- -v - -v
- image: djfarrelly/maildev:1.1.0 - image: djfarrelly/maildev:1.1.0
name: maildev-auth name: maildev-auth
entrypoint: bin/maildev entrypoint: bin/maildev
command: command:
- -v - -v
- --incoming-user - --incoming-user
- user - user
- --incoming-pass - --incoming-pass
- pass - pass
environment: environment:
EMAIL_NO_AUTH_CONFIG: /tmp/smtp_no_auth.yml EMAIL_NO_AUTH_CONFIG: /tmp/smtp_no_auth.yml
EMAIL_AUTH_CONFIG: /tmp/smtp_auth.yml EMAIL_AUTH_CONFIG: /tmp/smtp_auth.yml
steps: steps:
- prometheus/setup_environment - prometheus/setup_environment
- go/load-cache: - go/load-cache:
key: v1-go-mod key: v1-go-mod
- run: - run:
command: | command: |
cat \<<EOF > $EMAIL_NO_AUTH_CONFIG cat \<<EOF > $EMAIL_NO_AUTH_CONFIG
smarthost: maildev-noauth:1025 smarthost: maildev-noauth:1025
server: http://maildev-noauth:1080/ server: http://maildev-noauth:1080/
EOF EOF
cat \<<EOF > $EMAIL_AUTH_CONFIG cat \<<EOF > $EMAIL_AUTH_CONFIG
smarthost: maildev-auth:1025 smarthost: maildev-auth:1025
server: http://maildev-auth:1080/ server: http://maildev-auth:1080/
username: user username: user
password: pass password: pass
EOF EOF
- run: - run:
command: make command: make
environment: environment:
# By default Go uses GOMAXPROCS but a Circle CI executor has many # By default Go uses GOMAXPROCS but a Circle CI executor has many
# cores (> 30) while the CPU and RAM resources are throttled. If we # cores (> 30) while the CPU and RAM resources are throttled. If we
# don't limit this to the number of allocated cores, the job is # don't limit this to the number of allocated cores, the job is
# likely to get OOMed and killed. # likely to get OOMed and killed.
GOOPTS: "-p 2" GOOPTS: "-p 2"
- prometheus/check_proto: - prometheus/check_proto:
version: "3.15.8" version: "3.15.8"
- prometheus/store_artifact: - prometheus/store_artifact:
file: alertmanager file: alertmanager
- prometheus/store_artifact: - prometheus/store_artifact:
file: amtool file: amtool
- go/save-cache: - go/save-cache:
key: v1-go-mod key: v1-go-mod
- store_test_results: - store_test_results:
path: test-results path: test-results
mixin: mixin:
docker: docker:
# Whenever the Go version is updated here, .promu.yml should also be updated. # Whenever the Go version is updated here, .promu.yml should also be updated.
- image: circleci/golang:1.16 - image: quay.io/prometheus/golang-builder:1.17-base
steps: steps:
- checkout - checkout
- run: cd doc/alertmanager-mixin; go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest - run: cd doc/alertmanager-mixin; go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest
- run: cd doc/alertmanager-mixin; go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest - run: cd doc/alertmanager-mixin; go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
- run: cd doc/alertmanager-mixin; go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest - run: cd doc/alertmanager-mixin; go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
- run: cd doc/alertmanager-mixin; make lint - run: cd doc/alertmanager-mixin; make lint
workflows: workflows:
version: 2 version: 2
alertmanager: alertmanager:
jobs: jobs:
- test_frontend: - test_frontend:
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- test: - test:
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- prometheus/build: - prometheus/build:
name: build name: build
parallelism: 8 parallelism: 8
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- mixin: - mixin:
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- prometheus/publish_main: - prometheus/publish_main:
context: org-context context: org-context
requires: requires:
- test_frontend - test_frontend
- test - test
- build - build
filters: filters:
branches: branches:
only: main only: main
- prometheus/publish_release: - prometheus/publish_release:
context: org-context context: org-context
requires: requires:
- test_frontend - test_frontend
- test - test
- build - build
filters: filters:
tags: tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches: branches:
ignore: /.*/ ignore: /.*/

View File

@ -1,13 +1,11 @@
--- ---
run: run:
deadline: 5m deadline: 5m
issues: issues:
exclude-rules: exclude-rules:
- path: _test.go - path: _test.go
linters: linters:
- errcheck - errcheck
linters-settings: linters-settings:
errcheck: errcheck:
exclude: scripts/errcheck_excludes.txt exclude: scripts/errcheck_excludes.txt

View File

@ -1,7 +1,7 @@
go: go:
# Whenever the Go version is updated here, .travis.yml and # Whenever the Go version is updated here, .travis.yml and
# .circle/config.yml should also be updated. # .circle/config.yml should also be updated.
version: 1.16 version: 1.17
repository: repository:
path: github.com/prometheus/alertmanager path: github.com/prometheus/alertmanager
build: build:

17
.yamllint Normal file
View File

@ -0,0 +1,17 @@
---
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
commas: disable
comments: disable
comments-indentation: disable
document-start: disable
indentation:
spaces: consistent
line-length: disable

View File

@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:build dev
// +build dev // +build dev
package asset package asset

View File

@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:build ignore
// +build ignore // +build ignore
package main package main

View File

@ -1,5 +1,6 @@
// Code generated by vfsgen; DO NOT EDIT. // Code generated by vfsgen; DO NOT EDIT.
//go:build !dev
// +build !dev // +build !dev
package asset package asset

View File

@ -1015,7 +1015,7 @@ func TestOpsGenieDeprecatedTeamSpecified(t *testing.T) {
} }
const expectedErr = `yaml: unmarshal errors: const expectedErr = `yaml: unmarshal errors:
line 18: field teams not found in type config.plain` line 16: field teams not found in type config.plain`
if err.Error() != expectedErr { if err.Error() != expectedErr {
t.Errorf("Expected: %s\nGot: %s", expectedErr, err.Error()) t.Errorf("Expected: %s\nGot: %s", expectedErr, err.Error())
} }

View File

@ -5,22 +5,16 @@ global:
smtp_auth_password: '' smtp_auth_password: ''
smtp_hello: '' smtp_hello: ''
slack_api_url: 'https://slack.com/webhook' slack_api_url: 'https://slack.com/webhook'
templates: templates:
- '/etc/alertmanager/template/*.tmpl' - '/etc/alertmanager/template/*.tmpl'
route: route:
group_by: ['alertname', 'cluster', 'service'] group_by: ['alertname', 'cluster', 'service']
receiver: team-X-mails receiver: team-X-mails
routes: routes:
- match_re: - match_re:
service: ^(foo1|foo2|baz)$ service: ^(foo1|foo2|baz)$
receiver: team-X-mails receiver: team-X-mails
receivers: receivers:
- name: 'team-X-mails' - name: 'team-X-mails'
email_configs: email_configs:
- to: 'team-X+alerts@example.org' - to: 'team-X+alerts@example.org'

View File

@ -8,129 +8,110 @@ global:
slack_api_url: "http://mysecret.example.com/" slack_api_url: "http://mysecret.example.com/"
http_config: http_config:
proxy_url: 'http://127.0.0.1:1025' proxy_url: 'http://127.0.0.1:1025'
# The directory from which notification templates are read. # The directory from which notification templates are read.
templates: templates:
- '/etc/alertmanager/template/*.tmpl' - '/etc/alertmanager/template/*.tmpl'
# The root route on which each incoming alert enters. # The root route on which each incoming alert enters.
route: route:
# The labels by which incoming alerts are grouped together. For example, # The labels by which incoming alerts are grouped together. For example,
# multiple alerts coming in for cluster=A and alertname=LatencyHigh would # multiple alerts coming in for cluster=A and alertname=LatencyHigh would
# be batched into a single group. # be batched into a single group.
group_by: ['alertname', 'cluster', 'service'] group_by: ['alertname', 'cluster', 'service']
# When a new group of alerts is created by an incoming alert, wait at # When a new group of alerts is created by an incoming alert, wait at
# least 'group_wait' to send the initial notification. # least 'group_wait' to send the initial notification.
# This way ensures that you get multiple alerts for the same group that start # This way ensures that you get multiple alerts for the same group that start
# firing shortly after another are batched together on the first # firing shortly after another are batched together on the first
# notification. # notification.
group_wait: 30s group_wait: 30s
# When the first notification was sent, wait 'group_interval' to send a batch # When the first notification was sent, wait 'group_interval' to send a batch
# of new alerts that started firing for that group. # of new alerts that started firing for that group.
group_interval: 5m group_interval: 5m
# If an alert has successfully been sent, wait 'repeat_interval' to # If an alert has successfully been sent, wait 'repeat_interval' to
# resend them. # resend them.
repeat_interval: 3h repeat_interval: 3h
# A default receiver # A default receiver
receiver: team-X-mails receiver: team-X-mails
# All the above attributes are inherited by all child routes and can # All the above attributes are inherited by all child routes and can
# overwritten on each. # overwritten on each.
# The child route trees. # The child route trees.
routes: routes:
# This routes performs a regular expression match on alert labels to # This routes performs a regular expression match on alert labels to
# catch alerts that are related to a list of services. # catch alerts that are related to a list of services.
- match_re: - match_re:
service: ^(foo1|foo2|baz)$ service: ^(foo1|foo2|baz)$
receiver: team-X-mails receiver: team-X-mails
# The service has a sub-route for critical alerts, any alerts # The service has a sub-route for critical alerts, any alerts
# that do not match, i.e. severity != critical, fall-back to the # that do not match, i.e. severity != critical, fall-back to the
# parent node and are sent to 'team-X-mails' # parent node and are sent to 'team-X-mails'
routes: routes:
- match:
severity: critical
receiver: team-X-pager
- match: - match:
severity: critical service: files
receiver: team-X-pager receiver: team-Y-mails
- match: routes:
service: files - match:
receiver: team-Y-mails severity: critical
receiver: team-Y-pager
routes: # This route handles all alerts coming from a database service. If there's
# no team to handle it, it defaults to the DB team.
- match: - match:
severity: critical service: database
receiver: team-Y-pager receiver: team-DB-pager
# Also group alerts by affected database.
# This route handles all alerts coming from a database service. If there's group_by: [alertname, cluster, database]
# no team to handle it, it defaults to the DB team. routes:
- match: - match:
service: database owner2: team-X
receiver: team-DB-pager receiver: team-X-pager
# Also group alerts by affected database. continue: true
group_by: [alertname, cluster, database] - match:
routes: owner: team-Y
- match: receiver: team-Y-pager
owner2: team-X # continue: true
receiver: team-X-pager
continue: true
- match:
owner: team-Y
receiver: team-Y-pager
# continue: true
# Inhibition rules allow to mute a set of alerts given that another alert is # Inhibition rules allow to mute a set of alerts given that another alert is
# firing. # firing.
# We use this to mute any warning-level notifications if the same alert is # We use this to mute any warning-level notifications if the same alert is
# already critical. # already critical.
inhibit_rules: inhibit_rules:
- source_match: - source_match:
severity: 'critical' severity: 'critical'
target_match: target_match:
severity: 'warning' severity: 'warning'
# Apply inhibition if the alertname is the same. # Apply inhibition if the alertname is the same.
equal: ['alertname', 'cluster', 'service'] equal: ['alertname', 'cluster', 'service']
receivers: receivers:
- name: 'team-X-mails' - name: 'team-X-mails'
email_configs: email_configs:
- to: 'team-X+alerts@example.org' - to: 'team-X+alerts@example.org'
- name: 'team-X-pager'
- name: 'team-X-pager' email_configs:
email_configs: - to: 'team-X+alerts-critical@example.org'
- to: 'team-X+alerts-critical@example.org' pagerduty_configs:
pagerduty_configs: - routing_key: "mysecret"
- routing_key: "mysecret" - name: 'team-Y-mails'
email_configs:
- name: 'team-Y-mails' - to: 'team-Y+alerts@example.org'
email_configs: - name: 'team-Y-pager'
- to: 'team-Y+alerts@example.org' pagerduty_configs:
- routing_key: "mysecret"
- name: 'team-Y-pager' - name: 'team-DB-pager'
pagerduty_configs: pagerduty_configs:
- routing_key: "mysecret" - routing_key: "mysecret"
- name: victorOps-receiver
- name: 'team-DB-pager' victorops_configs:
pagerduty_configs: - api_key: mysecret
- routing_key: "mysecret" routing_key: Sample_route
- name: victorOps-receiver - name: opsGenie-receiver
victorops_configs: opsgenie_configs:
- api_key: mysecret - api_key: mysecret
routing_key: Sample_route - name: pushover-receiver
- name: opsGenie-receiver pushover_configs:
opsgenie_configs: - token: mysecret
- api_key: mysecret user_key: key
- name: pushover-receiver - name: slack-receiver
pushover_configs: slack_configs:
- token: mysecret - channel: '#my-channel'
user_key: key image_url: 'http://some.img.com/img.png'
- name: slack-receiver
slack_configs:
- channel: '#my-channel'
image_url: 'http://some.img.com/img.png'

View File

@ -1,10 +1,8 @@
route: route:
group_by: [...] group_by: ['...']
group_wait: 30s group_wait: 30s
group_interval: 5m group_interval: 5m
repeat_interval: 3h repeat_interval: 3h
receiver: team-X receiver: team-X
receivers: receivers:
- name: 'team-X' - name: 'team-X'

View File

@ -5,7 +5,7 @@ global:
route: route:
receiver: team-X-slack receiver: team-X-slack
receivers: receivers:
- name: 'team-X-slack' - name: 'team-X-slack'
slack_configs: slack_configs:
- http_config: - http_config:
proxy_url: foo proxy_url: foo

View File

@ -1,10 +1,8 @@
route: route:
receiver: empty receiver: empty
routes: routes:
- match_re: - match_re:
invalid_label: invalid_label:
receiver: empty receiver: empty
receivers: receivers:
- name: empty - name: empty

View File

@ -1,11 +1,9 @@
route: route:
receiver: empty receiver: empty
receivers: receivers:
- name: empty - name: empty
inhibit_rules: inhibit_rules:
- source_match_re: - source_match_re:
invalid_source_label: invalid_source_label:
target_match_re: target_match_re:
severity: critical severity: critical

View File

@ -1,11 +1,9 @@
route: route:
receiver: empty receiver: empty
receivers: receivers:
- name: empty - name: empty
inhibit_rules: inhibit_rules:
- source_match: - source_match:
severity: critical severity: critical
target_match_re: target_match_re:
invalid_target_label: invalid_target_label:

View File

@ -1,7 +1,6 @@
global: global:
opsgenie_api_key: asd132 opsgenie_api_key: asd132
opsgenie_api_key_file: '/global_file' opsgenie_api_key_file: '/global_file'
route: route:
group_by: ['alertname', 'cluster', 'service'] group_by: ['alertname', 'cluster', 'service']
group_wait: 30s group_wait: 30s
@ -9,19 +8,18 @@ route:
repeat_interval: 3h repeat_interval: 3h
receiver: escalation-Y-opsgenie receiver: escalation-Y-opsgenie
routes: routes:
- match: - match:
service: foo service: foo
receiver: team-X-opsgenie receiver: team-X-opsgenie
receivers: receivers:
- name: 'team-X-opsgenie' - name: 'team-X-opsgenie'
opsgenie_configs: opsgenie_configs:
- responders: - responders:
- name: 'team-X' - name: 'team-X'
type: 'team' type: 'team'
- name: 'escalation-Y-opsgenie' - name: 'escalation-Y-opsgenie'
opsgenie_configs: opsgenie_configs:
- responders: - responders:
- name: 'escalation-Y' - name: 'escalation-Y'
type: 'escalation' type: 'escalation'
api_key: qwe456 api_key: qwe456

View File

@ -1,6 +1,5 @@
global: global:
opsgenie_api_key_file: '/global_file' opsgenie_api_key_file: '/global_file'
route: route:
group_by: ['alertname', 'cluster', 'service'] group_by: ['alertname', 'cluster', 'service']
group_wait: 30s group_wait: 30s
@ -8,19 +7,18 @@ route:
repeat_interval: 3h repeat_interval: 3h
receiver: escalation-Y-opsgenie receiver: escalation-Y-opsgenie
routes: routes:
- match: - match:
service: foo service: foo
receiver: team-X-opsgenie receiver: team-X-opsgenie
receivers: receivers:
- name: 'team-X-opsgenie' - name: 'team-X-opsgenie'
opsgenie_configs: opsgenie_configs:
- responders: - responders:
- name: 'team-X' - name: 'team-X'
type: 'team' type: 'team'
- name: 'escalation-Y-opsgenie' - name: 'escalation-Y-opsgenie'
opsgenie_configs: opsgenie_configs:
- responders: - responders:
- name: 'escalation-Y' - name: 'escalation-Y'
type: 'escalation' type: 'escalation'
api_key_file: /override_file api_key_file: /override_file

View File

@ -1,6 +1,5 @@
global: global:
opsgenie_api_key: asd132 opsgenie_api_key: asd132
route: route:
group_by: ['alertname', 'cluster', 'service'] group_by: ['alertname', 'cluster', 'service']
group_wait: 30s group_wait: 30s
@ -8,10 +7,9 @@ route:
repeat_interval: 3h repeat_interval: 3h
receiver: escalation-Y-opsgenie receiver: escalation-Y-opsgenie
routes: routes:
- match: - match:
service: foo service: foo
receiver: team-X-opsgenie receiver: team-X-opsgenie
receivers: receivers:
- name: 'team-X-opsgenie' - name: 'team-X-opsgenie'
opsgenie_configs: opsgenie_configs:

View File

@ -1,6 +1,5 @@
global: global:
opsgenie_api_key: asd132 opsgenie_api_key: asd132
route: route:
group_by: ['alertname', 'cluster', 'service'] group_by: ['alertname', 'cluster', 'service']
group_wait: 30s group_wait: 30s
@ -8,19 +7,18 @@ route:
repeat_interval: 3h repeat_interval: 3h
receiver: escalation-Y-opsgenie receiver: escalation-Y-opsgenie
routes: routes:
- match: - match:
service: foo service: foo
receiver: team-X-opsgenie receiver: team-X-opsgenie
receivers: receivers:
- name: 'team-X-opsgenie' - name: 'team-X-opsgenie'
opsgenie_configs: opsgenie_configs:
- responders: - responders:
- name: 'team-X' - name: 'team-X'
type: 'team' type: 'team'
- name: 'escalation-Y-opsgenie' - name: 'escalation-Y-opsgenie'
opsgenie_configs: opsgenie_configs:
- responders: - responders:
- name: 'escalation-Y' - name: 'escalation-Y'
type: 'escalation' type: 'escalation'
api_key: qwe456 api_key: qwe456

View File

@ -5,13 +5,12 @@ route:
repeat_interval: 3h repeat_interval: 3h
receiver: team-X-opsgenie receiver: team-X-opsgenie
routes: routes:
- match: - match:
service: foo service: foo
receiver: team-X-opsgenie receiver: team-X-opsgenie
receivers: receivers:
- name: 'team-X-opsgenie' - name: 'team-X-opsgenie'
opsgenie_configs: opsgenie_configs:
- responders: - responders:
- name: 'team-X' - name: 'team-X'
type: 'team' type: 'team'

View File

@ -1,13 +1,11 @@
global: global:
slack_api_url: "http://mysecret.example.com/" slack_api_url: "http://mysecret.example.com/"
slack_api_url_file: '/global_file' slack_api_url_file: '/global_file'
route: route:
receiver: 'slack-notifications' receiver: 'slack-notifications'
group_by: [alertname, datacenter, app] group_by: [alertname, datacenter, app]
receivers: receivers:
- name: 'slack-notifications' - name: 'slack-notifications'
slack_configs: slack_configs:
- channel: '#alerts1' - channel: '#alerts1'
text: 'test' text: 'test'

View File

@ -1,21 +1,19 @@
global: global:
slack_api_url_file: '/global_file' slack_api_url_file: '/global_file'
route: route:
receiver: 'slack-notifications' receiver: 'slack-notifications'
group_by: [alertname, datacenter, app] group_by: [alertname, datacenter, app]
receivers: receivers:
- name: 'slack-notifications' - name: 'slack-notifications'
slack_configs: slack_configs:
# Use global # Use global
- channel: '#alerts1' - channel: '#alerts1'
text: 'test' text: 'test'
# Override global with other file # Override global with other file
- channel: '#alerts2' - channel: '#alerts2'
text: 'test' text: 'test'
api_url_file: '/override_file' api_url_file: '/override_file'
# Override global with inline URL # Override global with inline URL
- channel: '#alerts3' - channel: '#alerts3'
text: 'test' text: 'test'
api_url: 'http://mysecret.example.com/' api_url: 'http://mysecret.example.com/'

View File

@ -1,9 +1,8 @@
route: route:
receiver: 'slack-notifications' receiver: 'slack-notifications'
group_by: [alertname, datacenter, app] group_by: [alertname, datacenter, app]
receivers: receivers:
- name: 'slack-notifications' - name: 'slack-notifications'
slack_configs: slack_configs:
- channel: '#alerts' - channel: '#alerts'
text: 'test' text: 'test'

View File

@ -1,7 +1,6 @@
route: route:
receiver: 'sns-api-notifications' receiver: 'sns-api-notifications'
group_by: [alertname] group_by: [alertname]
receivers: receivers:
- name: 'sns-api-notifications' - name: 'sns-api-notifications'
sns_configs: sns_configs:

View File

@ -1,15 +1,14 @@
route: route:
receiver: 'sns-api-notifications' receiver: 'sns-api-notifications'
group_by: [alertname] group_by: [alertname]
receivers: receivers:
- name: 'sns-api-notifications' - name: 'sns-api-notifications'
sns_configs: sns_configs:
- api_url: https://sns.us-east-2.amazonaws.com - api_url: https://sns.us-east-2.amazonaws.com
topic_arn: arn:aws:sns:us-east-2:123456789012:My-Topic topic_arn: arn:aws:sns:us-east-2:123456789012:My-Topic
sigv4: sigv4:
region: us-east-2 region: us-east-2
access_key: access_key access_key: access_key
secret_key: secret_ket secret_key: secret_ket
attributes: attributes:
severity: Sev2 severity: Sev2

View File

@ -1,6 +1,5 @@
global: global:
victorops_api_key: asd132 victorops_api_key: asd132
route: route:
group_by: ['alertname', 'cluster', 'service'] group_by: ['alertname', 'cluster', 'service']
group_wait: 30s group_wait: 30s
@ -8,15 +7,14 @@ route:
repeat_interval: 3h repeat_interval: 3h
receiver: team-Y-victorops receiver: team-Y-victorops
routes: routes:
- match: - match:
service: foo service: foo
receiver: team-X-victorops receiver: team-X-victorops
receivers: receivers:
- name: 'team-X-victorops' - name: 'team-X-victorops'
victorops_configs: victorops_configs:
- routing_key: 'team-X' - routing_key: 'team-X'
- name: 'team-Y-victorops' - name: 'team-Y-victorops'
victorops_configs: victorops_configs:
- routing_key: 'team-Y' - routing_key: 'team-Y'
api_key: qwe456 api_key: qwe456

View File

@ -5,11 +5,10 @@ route:
repeat_interval: 3h repeat_interval: 3h
receiver: team-X-victorops receiver: team-X-victorops
routes: routes:
- match: - match:
service: foo service: foo
receiver: team-X-victorops receiver: team-X-victorops
receivers: receivers:
- name: 'team-X-victorops' - name: 'team-X-victorops'
victorops_configs: victorops_configs:
- routing_key: 'team-X' - routing_key: 'team-X'

View File

@ -7,7 +7,7 @@ global:
# The directory from which notification templates are read. # The directory from which notification templates are read.
templates: templates:
- '/etc/alertmanager/template/*.tmpl' - '/etc/alertmanager/template/*.tmpl'
# The root route on which each incoming alert enters. # The root route on which each incoming alert enters.
route: route:
@ -45,42 +45,42 @@ route:
# The child route trees. # The child route trees.
routes: routes:
# This routes performs a regular expression match on alert labels to # This routes performs a regular expression match on alert labels to
# catch alerts that are related to a list of services. # catch alerts that are related to a list of services.
- matchers:
- service=~"foo1|foo2|baz"
receiver: team-X-mails
# The service has a sub-route for critical alerts, any alerts
# that do not match, i.e. severity != critical, fall-back to the
# parent node and are sent to 'team-X-mails'
routes:
- matchers: - matchers:
- severity="critical" - service=~"foo1|foo2|baz"
receiver: team-X-pager receiver: team-X-mails
- matchers: # The service has a sub-route for critical alerts, any alerts
- service="files" # that do not match, i.e. severity != critical, fall-back to the
receiver: team-Y-mails # parent node and are sent to 'team-X-mails'
routes:
- matchers:
- severity="critical"
receiver: team-X-pager
- matchers:
- service="files"
receiver: team-Y-mails
routes: routes:
- matchers: - matchers:
- severity="critical" - severity="critical"
receiver: team-Y-pager receiver: team-Y-pager
# This route handles all alerts coming from a database service. If there's # This route handles all alerts coming from a database service. If there's
# no team to handle it, it defaults to the DB team. # no team to handle it, it defaults to the DB team.
- matchers:
- service="database"
receiver: team-DB-pager
# Also group alerts by affected database.
group_by: [alertname, cluster, database]
routes:
- matchers: - matchers:
- owner="team-X" - service="database"
receiver: team-X-pager receiver: team-DB-pager
continue: true # Also group alerts by affected database.
- matchers: group_by: [alertname, cluster, database]
- owner="team-Y" routes:
receiver: team-Y-pager - matchers:
- owner="team-X"
receiver: team-X-pager
continue: true
- matchers:
- owner="team-Y"
receiver: team-Y-pager
# Inhibition rules allow to mute a set of alerts given that another alert is # Inhibition rules allow to mute a set of alerts given that another alert is
@ -88,35 +88,35 @@ route:
# We use this to mute any warning-level notifications if the same alert is # We use this to mute any warning-level notifications if the same alert is
# already critical. # already critical.
inhibit_rules: inhibit_rules:
- source_matchers: [ severity="critical" ] - source_matchers: [severity="critical"]
target_matchers: [ severity="warning" ] target_matchers: [severity="warning"]
# Apply inhibition if the alertname is the same. # Apply inhibition if the alertname is the same.
# CAUTION: # CAUTION:
# If all label names listed in `equal` are missing # If all label names listed in `equal` are missing
# from both the source and target alerts, # from both the source and target alerts,
# the inhibition rule will apply! # the inhibition rule will apply!
equal: [ alertname, cluster, service ] equal: [alertname, cluster, service]
receivers: receivers:
- name: 'team-X-mails' - name: 'team-X-mails'
email_configs: email_configs:
- to: 'team-X+alerts@example.org' - to: 'team-X+alerts@example.org'
- name: 'team-X-pager' - name: 'team-X-pager'
email_configs: email_configs:
- to: 'team-X+alerts-critical@example.org' - to: 'team-X+alerts-critical@example.org'
pagerduty_configs: pagerduty_configs:
- service_key: <team-X-key> - service_key: <team-X-key>
- name: 'team-Y-mails' - name: 'team-Y-mails'
email_configs: email_configs:
- to: 'team-Y+alerts@example.org' - to: 'team-Y+alerts@example.org'
- name: 'team-Y-pager' - name: 'team-Y-pager'
pagerduty_configs: pagerduty_configs:
- service_key: <team-Y-key> - service_key: <team-Y-key>
- name: 'team-DB-pager' - name: 'team-DB-pager'
pagerduty_configs: pagerduty_configs:
- service_key: <team-DB-key> - service_key: <team-DB-key>

View File

@ -5,9 +5,9 @@ route:
repeat_interval: 1h repeat_interval: 1h
receiver: 'web.hook' receiver: 'web.hook'
receivers: receivers:
- name: 'web.hook' - name: 'web.hook'
webhook_configs: webhook_configs:
- url: 'http://127.0.0.1:5001/' - url: 'http://127.0.0.1:5001/'
inhibit_rules: inhibit_rules:
- source_match: - source_match:
severity: 'critical' severity: 'critical'

View File

@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:build tools
// +build tools // +build tools
// Package tools tracks dependencies for tools that are required to generate the protobuf code. // Package tools tracks dependencies for tools that are required to generate the protobuf code.