api-watchdog is an uptime monitor written in Go It pings your http endpoints and alerts when an API goes down (and when it recovers)
| Feature | Description |
|---|---|
| HTTP checks | Monitor urls on a set interval |
| Latency tracking | tracks response times in notifications |
| Status monitoring | Marks a service as down if it doesn’t return 200 |
| Discord notifications | Posts clear DOWN and RECOVERED messages |
- Go (1.22+)
# Clone & enter project
git clone https://github.com/yourpov/api-watchdog
cd api-watchdog
# Install deps
go mod tidy
# Build
go build -o api-watchdog .{
"global": {
"discord_webhook": "",
"request_timeout_ms": 8000
},
"checks": [
{ "name": "API 1", "url": "https://api.com/", "check_interval_seconds": 60 },
{ "name": "Local API", "url": "http://127.0.0.1:8080","check_interval_seconds": 15 }
]
}request_timeout_ms: how long to wait before marking a request as failed- Each check needs a
name,url, andcheck_interval_seconds - All checks default to HTTP GET and expect
200 OK
# Run once
./api-watchdog -once
# Run continuously
./api-watchdog -config ./config/config.json- Sends DOWN when a healthy check becomes unhealthy
- Sends RECOVERED when an unhealthy check becomes healthy again
- Each alert includes the endpoint URL and measured latency (if available)
-
No alerts sending
Make surediscord_webhookis a a valid webhook -
Always shows “DOWN”
Make sure the API returns200 OK(you can adjust the code if you want to allow other statuses) -
False alarms from slow APIs
Raiserequest_timeout_msinglobal -
Multiple APIs fire at the same time
Checks are staggered, but you can raisecheck_interval_secondsto send them further apart