You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/deploying-alertmanager/docker.mdx
+108Lines changed: 108 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,3 +96,111 @@ alerting:
96
96
```
97
97
98
98
</Steps>
99
+
100
+
## Add the Autometrics Slack App
101
+
102
+
Autometrics Slack App is a simple open-source, self-hosted Slack service for Autometrics SLO alerts. It integrates with the Alertmanager and adds more context for each triggered message: the Slack app pulls recent relevant Prometheus data and renders it as an image of the graph on Slack.
103
+
104
+
Autometrics Slack app is open-source and available as a [Docker image](https://hub.docker.com/r/autometrics/slack-app). Here's a quick guide how to add it and configure it with your Prometheus and Alertmanager setup.
105
+
106
+
<Steps>
107
+
108
+
### Create a new Slack application
109
+
110
+
Go to [https://api.slack.com/apps/](https://api.slack.com/apps/), select your workspace, and create an application **from manifest**.
111
+
112
+
This is a basic Slack application manifest with limited permissions to post chat messages on channels that the application gets added to. You can find the manifest below:
113
+
114
+
```yaml filename="manifest.yml"
115
+
_metadata:
116
+
major_version: 1
117
+
minor_version: 0
118
+
display_information:
119
+
name: Autometrics
120
+
description: This bot provides a way for our Autometrics slack-app to communicate with the Slack API.
121
+
long_description: |
122
+
This bot provides a way for our Autometrics slack-app to communicate with
123
+
the Slack API. The autometrics slack-app will post messages to a specified
124
+
channel whenever a alert occurs in your alertmanager (note this requires
125
+
modifications in your alertmanager configuration).
126
+
background_color: "#00FFAA"
127
+
settings:
128
+
org_deploy_enabled: false
129
+
socket_mode_enabled: false
130
+
token_rotation_enabled: false
131
+
features:
132
+
app_home:
133
+
home_tab_enabled: false
134
+
messages_tab_enabled: false
135
+
bot_user:
136
+
display_name: Autometrics
137
+
always_online: false
138
+
oauth_config:
139
+
scopes:
140
+
bot:
141
+
- chat:write
142
+
```
143
+
144
+
Install your new Slack application into your workspace in the *Install your app* section and grab the *Bot User OAuth Token*, starts with `xoxb-***`
145
+
146
+
### Deploy the Slack application
147
+
148
+
You can deploy the Slack application as any other Docker image. The Slack application requires some configuration passed in as environment variables and needs access to the Prometheus, Alertmanager and Slack API.
149
+
150
+
Here are the necessary environment variables:
151
+
152
+
| Variable | Description |
153
+
| -------- | ----------- |
154
+
| `LISTEN_HOST` | Make sure this address allows for remote connections |
155
+
| `BASE_URL` | The URL that the Slack should be accessible at (for Slack API) |
156
+
| `SLACK_CHANNEL` | Which Slack channel the app should post alerts to (make sure the application is invited to it!) |
157
+
| `SLACK_BOT_TOKEN` | The `xoxb-***` value we grabbed earlier when creating the application |
158
+
| `STORAGE_DIR` | The directory where the generated alert images should be stored. Make sure it's persistent storage |
159
+
| `DB_CONNECTION_STRING` | The sqlite connection string for historic alert storage. Make sure it's persistent |
160
+
161
+
Here's an example `docker-compose.yaml` file with the above configuration in place:
Copy file name to clipboardExpand all lines: src/pages/deploying-alertmanager/kubernetes.mdx
+136Lines changed: 136 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,3 +50,139 @@ This will install Alertmanager in your cluster along with Prometheus, Node Expor
50
50
</Steps>
51
51
52
52
You can now configure your Alertmanager to group, organize, and send alerts to whichever channel you're using for incident response. See [Alertmanager documentation](https://prometheus.io/docs/alerting/latest/configuration/) for details.
53
+
54
+
## Add the Autometrics Slack App
55
+
56
+
Autometrics Slack App is a simple open-source, self-hosted Slack service for Autometrics SLO alerts. It integrates with the Alertmanager and adds more context for each triggered message: the Slack app pulls recent relevant Prometheus data and renders it as an image of the graph on Slack.
57
+
58
+
Autometrics Slack app is open-source and available as a [Docker image](https://hub.docker.com/r/autometrics/slack-app). Here's a quick guide how to add it and configure it with your Prometheus and Alertmanager setup.
59
+
60
+
<Steps>
61
+
62
+
### Create a new Slack application
63
+
64
+
Go to [https://api.slack.com/apps/](https://api.slack.com/apps/), select your workspace, and create an application **from manifest**.
65
+
66
+
This is a basic Slack application manifest with limited permissions to post chat messages on channels that the application gets added to. You can find the manifest below:
67
+
68
+
```yaml filename="manifest.yml"
69
+
_metadata:
70
+
major_version: 1
71
+
minor_version: 0
72
+
display_information:
73
+
name: Autometrics
74
+
description: This bot provides a way for our Autometrics slack-app to communicate with the Slack API.
75
+
long_description: |
76
+
This bot provides a way for our Autometrics slack-app to communicate with
77
+
the Slack API. The autometrics slack-app will post messages to a specified
78
+
channel whenever a alert occurs in your alertmanager (note this requires
79
+
modifications in your alertmanager configuration).
80
+
background_color: "#00FFAA"
81
+
settings:
82
+
org_deploy_enabled: false
83
+
socket_mode_enabled: false
84
+
token_rotation_enabled: false
85
+
features:
86
+
app_home:
87
+
home_tab_enabled: false
88
+
messages_tab_enabled: false
89
+
bot_user:
90
+
display_name: Autometrics
91
+
always_online: false
92
+
oauth_config:
93
+
scopes:
94
+
bot:
95
+
- chat:write
96
+
```
97
+
98
+
Install your new Slack application into your workspace in the *Install your app* section and grab the *Bot User OAuth Token*, starts with `xoxb-***`
99
+
100
+
### Deploy the Slack application
101
+
102
+
You can deploy the Slack application as a Kubernetes deployment using the Docker image. The Slack application requires some configuration passed in as environment variables and needs access to the Prometheus, Alertmanager and Slack API.
103
+
104
+
Here are the necessary environment variables:
105
+
106
+
| Variable | Description |
107
+
| -------- | ----------- |
108
+
| `LISTEN_HOST` | Make sure this address allows for remote connections |
109
+
| `BASE_URL` | The URL that the Slack should be accessible at (for Slack API) |
110
+
| `SLACK_CHANNEL` | Which Slack channel the app should post alerts to (make sure the application is invited to it!) |
111
+
| `SLACK_BOT_TOKEN` | The `xoxb-***` value we grabbed earlier when creating the application |
112
+
| `STORAGE_DIR` | The directory where the generated alert images should be stored. Make sure it's persistent storage |
113
+
| `DB_CONNECTION_STRING` | The sqlite connection string for historic alert storage. Make sure it's persistent |
114
+
115
+
Here's an example Kubernetes deployment manifest with the above configuration in place:
116
+
117
+
```yaml filename="deployment.yaml"
118
+
---
119
+
apiVersion: apps/v1
120
+
kind: Deployment
121
+
metadata:
122
+
name: slack-app
123
+
labels:
124
+
app: slack-app
125
+
spec:
126
+
selector:
127
+
matchLabels:
128
+
app: slack-app
129
+
template:
130
+
metadata:
131
+
labels:
132
+
app: slack-app
133
+
spec:
134
+
containers:
135
+
- name: slack-app
136
+
image: "autometrics/slack-app:latest"
137
+
imagePullPolicy: Always
138
+
resources: {}
139
+
env:
140
+
- name: RUST_LOG
141
+
value: "info"
142
+
- name: LOG_JSON
143
+
value: "true"
144
+
- name: LISTEN_HOST
145
+
value: 0.0.0.0
146
+
- name: PORT
147
+
value: "3031"
148
+
- name: BASE_URL
149
+
value: "https://slack-app.example.com" # NOTE: this url should be accessible to Slack API
150
+
- name: EXPLORER_URL
151
+
value: https://explorer.autometrics.dev
152
+
- name: SLACK_CHANNEL
153
+
value: "test-slack-app"
154
+
- name: SLACK_BOT_TOKEN
155
+
value: xoxb-000000000-000000000-000000000
156
+
- name: PROMETHEUS_URL
157
+
value: http://prometheus:9090
158
+
- name: STORAGE_DIR
159
+
value: /data/
160
+
- name: DB_CONNECTION_STRING
161
+
value: "sqlite:///data/slack-app.db?mode=rwc"
162
+
ports:
163
+
- containerPort: 3031
164
+
volumeMounts:
165
+
- name: storage-volume
166
+
mountPath: /data
167
+
volumes:
168
+
- name: storage-volume
169
+
persistentVolumeClaim:
170
+
claimName: slack-app
171
+
```
172
+
173
+
### Update Alertmanager configuration
174
+
175
+
Finally we need to update the Alertmanager so that it sends a Webhook request whenever an alert is triggered to our newly deployed Slack application:
0 commit comments