51 lines
1.1 KiB
Markdown
51 lines
1.1 KiB
Markdown
|
# Watchdog
|
||
|
|
||
|
Webhooks for all the times that something doesn't go right.
|
||
|
|
||
|
# Install
|
||
|
|
||
|
```bash
|
||
|
git clone https://git.coolaj86.com/coolaj86/watchdog.go.git
|
||
|
```
|
||
|
|
||
|
# Usage
|
||
|
|
||
|
```bash
|
||
|
pushd watchdog.go/
|
||
|
go run ./watchdog.go -c dog.json
|
||
|
```
|
||
|
|
||
|
## Sample Config
|
||
|
|
||
|
```json
|
||
|
{
|
||
|
"watches": [
|
||
|
{
|
||
|
"name": "Example Site",
|
||
|
"url": "https://example.com/",
|
||
|
"webhook": "twilio",
|
||
|
"keywords": "My Site",
|
||
|
"recover_script": "systemctl restart example-site"
|
||
|
}
|
||
|
],
|
||
|
"webhooks": [
|
||
|
{
|
||
|
"name": "twilio",
|
||
|
"config": {
|
||
|
"sid": "AC00000000000000000000000000000000",
|
||
|
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||
|
},
|
||
|
"configs": [{ "To": "+1 555 555 5555", "From": "+1 555 234 5678" }],
|
||
|
"url": "https://api.twilio.com/2010-04-01/Accounts/{{ .sid }}/Messages.json",
|
||
|
"auth": { "user": "{{ .sid }}", "pass": "{{ .token }}" },
|
||
|
"_TODO_Body": "switch template if hardfail",
|
||
|
"form": {
|
||
|
"To": "{{ .To }}",
|
||
|
"From": "{{ .From }}",
|
||
|
"Body": "[{{ .name }}] The system is down. The system is down."
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
```
|