2019-06-08 02:37:53 +00:00
|
|
|
# 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
|
|
|
|
{
|
2019-06-08 09:14:12 +00:00
|
|
|
"watches": [
|
|
|
|
{
|
|
|
|
"name": "Example Site",
|
|
|
|
"url": "https://example.com/",
|
|
|
|
"webhooks": ["twilio"],
|
|
|
|
"keywords": "My Site",
|
|
|
|
"recover_script": "systemctl restart example-site"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"webhooks": [
|
|
|
|
{
|
|
|
|
"name": "twilio",
|
|
|
|
"url": "https://api.twilio.com/2010-04-01/Accounts/AC00000000000000000000000000000000/Messages.json",
|
|
|
|
"auth": {
|
|
|
|
"user": "AC00000000000000000000000000000000",
|
|
|
|
"pass": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
|
|
},
|
|
|
|
"form": {
|
|
|
|
"To": "+1 801 555 1234",
|
|
|
|
"From": "+1 800 555 4321",
|
|
|
|
"Body": "[{{ .Name }}] The system is down. The system is down."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2019-06-08 09:11:42 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
<!--
|
2019-06-08 02:37:53 +00:00
|
|
|
"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."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2019-06-08 09:11:42 +00:00
|
|
|
-->
|