Skip to content

Commit

Permalink
Merge pull request #235 from m-lab/sandbox-soltesz
Browse files Browse the repository at this point in the history
Add a link to slack messages with a link to open github alerts
  • Loading branch information
stephen-soltesz authored Jun 4, 2018
2 parents 9c1f7e1 + 71f879c commit b605b9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apply-global-prometheus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,17 @@ kubectl create configmap grafana-env \
# Note: Only enable the github reciever for the production project: mlab-oti.
SLACK_CHANNEL_URL_NAME=AM_SLACK_CHANNEL_URL_${PROJECT/-/_}
GITHUB_RECEIVER_URL=
GITHUB_ISSUE_QUERY=
SHORT_PROJECT=${PROJECT/mlab-/}

if [[ ${PROJECT} = "mlab-oti" ]] ; then
# Only create one instance of the github-receiver across all projects.
kubectl create secret generic github-secrets \
"--from-literal=auth-token=${GITHUB_RECEIVER_AUTH_TOKEN}" \
--dry-run -o json | kubectl apply -f -

# For production, annotate slack messages with a link to view open alert issues.
GITHUB_ISSUE_QUERY="https://github.com/issues?q=is%3Aissue+user%3Am-lab+author%3Ameasurementlab+is%3Aopen"
fi

# Note: without a url, alertmanager will fail to start. But, for non-production
Expand All @@ -128,6 +132,7 @@ GITHUB_RECEIVER_URL=http://github-receiver-service.default.svc.cluster.local:939
sed -e 's|{{SLACK_CHANNEL_URL}}|'${!SLACK_CHANNEL_URL_NAME}'|g' \
-e 's|{{GITHUB_RECEIVER_URL}}|'$GITHUB_RECEIVER_URL'|g' \
-e 's|{{SHORT_PROJECT}}|'$SHORT_PROJECT'|g' \
-e 's|{{GITHUB_ISSUE_QUERY}}|'$GITHUB_ISSUE_QUERY'|g' \
config/federation/alertmanager/config.yml.template > \
config/federation/alertmanager/config.yml

Expand Down
2 changes: 2 additions & 0 deletions config/federation/alertmanager/config.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ receivers:
api_url: {{SLACK_CHANNEL_URL}}
channel: alerts-{{SHORT_PROJECT}}
username: alert-page
text: '{{GITHUB_ISSUE_QUERY}}'
webhook_configs:
- url: '{{GITHUB_RECEIVER_URL}}'

Expand All @@ -92,5 +93,6 @@ receivers:
api_url: {{SLACK_CHANNEL_URL}}
channel: alerts-{{SHORT_PROJECT}}
username: alert-email
text: '{{GITHUB_ISSUE_QUERY}}'
webhook_configs:
- url: '{{GITHUB_RECEIVER_URL}}'

0 comments on commit b605b9e

Please sign in to comment.