Skip to content

Commit

Permalink
Add alert manager
Browse files Browse the repository at this point in the history
  • Loading branch information
making committed Feb 19, 2020
1 parent 30ca162 commit 6766086
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
blackbox_exporter-*
prometheus-*
grafana-*
grafana-*
alertmanager-*
3 changes: 3 additions & 0 deletions alertmanager/.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set -e

sed -i "s|SLACK_WEBHOOK_URL|${SLACK_WEBHOOK_URL}|" /home/vcap/app/alertmanager.yml
15 changes: 15 additions & 0 deletions alertmanager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```
ALERTMANAGER_VERSION=0.20.0
if [ ! -d alertmanager-${ALERTMANAGER_VERSION}.linux-amd64 ];then
wget https://github.com/prometheus/alertmanager/releases/download/v${ALERTMANAGER_VERSION}/alertmanager-${ALERTMANAGER_VERSION}.linux-amd64.tar.gz
tar xzf alertmanager-${ALERTMANAGER_VERSION}.linux-amd64.tar.gz
rm -f alertmanager-${ALERTMANAGER_VERSION}.linux-amd64.tar.gz
fi
```


```
cf push alertmanager -m 64m -b binary_buildpack -c "./alertmanager-${ALERTMANAGER_VERSION}.linux-amd64/alertmanager --web.listen-address=:8080 --config.file=./alertmanager.yml --web.external-url=https://alertmanager.apps.pcfone.io" --no-start
cf set-env alertmanager SLACK_WEBHOOK_URL https://hooks.slack.com/services/**********
cf start alertmanager
```
16 changes: 16 additions & 0 deletions alertmanager/alertmanager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
global:
templates:
route:
receiver: default
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
group_by:
- alertname
routes: []
receivers:
- name: default
slack_configs:
- api_url: SLACK_WEBHOOK_URL
channel: alert
send_resolved: true
7 changes: 7 additions & 0 deletions prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager.apps.pcfone.io:443
scheme: https
timeout: 10s
rule_files:
- /home/vcap/app/rule_files/*.alerts.yml
scrape_configs:
Expand Down

0 comments on commit 6766086

Please sign in to comment.