hacks/forward-email-to-slack-webhook/README.md

37 lines
842 B
Markdown
Raw Normal View History

2019-03-27 16:06:23 +00:00
# send emails to root to slack
2019-03-27 16:13:16 +00:00
## slack side
2019-03-27 16:06:23 +00:00
2019-03-27 16:13:16 +00:00
First you must go [here](https://api.slack.com/incoming-webhooks) and create
a new slack app and choose a channel and get a webhook URL.
2019-03-27 16:06:23 +00:00
2019-03-27 16:13:16 +00:00
```
mkdir -p /etc/environment.d
echo 'https://hooks.slack.com/services/XXXXXX/XXXXXXX/xxxxxxxxxxxxxxxx' >
/etc/environment.d/SLACK_WEBHOOK_URL
```
## prerequisites
```
export DEBIAN_FRONTEND=noninteractive
apt update
apt -y install git python3 make postfix daemontools
```
## install helper
2019-03-27 16:06:23 +00:00
```
mkdir -p /etc/environment.d
git clone https://github.com/sneak/hacks.git /tmp/hacks && \
cd /tmp/hacks/forward-email-to-slack-webhook && \
make install
```
2019-03-27 16:13:16 +00:00
## example usage
2019-03-27 16:06:23 +00:00
2019-03-27 16:13:16 +00:00
`apt install -y smartmontools`
Now you'll get a slack notification when your disk is going to die, because
smartmontools emails root by default when it detects problems.