This program will constantly check for one or more http(-s), websocket or redis endpoints and notify you
whenever something goes down and also when it goes up again!
It will additionally expose an api with the current statuses of every endpoint
configured.
Example response:
{
"providers": [
{
"name": "Google",
"url": "https://www.google.com",
"status": true,
"responce_time": 103,
"code": 200,
"ready": true
},
{
"name": "WebSocket Echo",
"url": "wss://echo.websocket.org",
"status": true,
"responce_time": 550,
"code": 200,
"ready": true
},
{
"name": "Redis test",
"url": "redis://localhost:6379/0",
"status": true,
"responce_time": 7,
"code": 200,
"ready": true
}
]
}
Configuration
This health check needs a config.json
file with this minimal structure
{
"urlMonitors": [
{
"name": "Google",
"url": "https://www.google.com"
},
{
"name": "WebSocket Echo",
"url": "wss://echo.websocket.org"
},
{
"name": "Redis test",
"url": "redis://localhost:6379/0"
}
]
}
You can also specify the config file path with the -config
flag. For example:
healthcheck -config my/custom/dir/my_config.json
Check more configuration options in the conf.json.dist
Run
Golang
go get gitlab.com/rakshazi/healthcheck
cd $GOPATH/src/gitlab.com/rakshazi/healthcheck
go install
curl https://gitlab.com/rakshazi/healthcheck/raw/master/config.json.dist -o config.json
healthcheck
Binary
# release 0.1.2 from project -> releases
curl https://gitlab.com/rakshazi/healthcheck/uploads/1dd82551e81428947c9ae80e35d0b0bd/healthcheck_amd64_linux healthcheck
curl https://gitlab.com/rakshazi/healthcheck/raw/master/config.json.dist -o config.json
chmod +x ./healthcheck
healthcheck
Docker
curl https://gitlab.com/rakshazi/healthcheck/raw/master/config.json.dist -o config.json
docker run -d -v "$PWD/config.json:/etc/monitor.json" -p 80:8080 registry.gitlab.com/rakshazi/healthcheck
curl http://localhost
Fork differencies
This repository is fork of original Healtch Check Monitor
Status report
- Removed fields:
version
, environment
- Added field
code
for each provider with HTTP response code from last check
- IF anyone of providers will go down, status report will return HTTP status code
503
, otherwise - 200
Config
- Default port changed to
8080
- Default endpoint changed to
/
Code structure
- Renamed
main.go
files in subpackages
Docker
- Moved to multi-stage builds
- Updated compiler to latest stable version
- Used
scratch
as base image for compiled app
- Used non-privileged docker user for additional security
...and more
- WebSocket checks
- Redis checks
- GoDoc reference
- Telegram listener
- Response time measurements
- ...