- Tiny one-shot monitoring service
- Remote configuration of independent 'dish network' (via loading the socket list to be checked from a remote API)
- Fast concurrent testing, low overall execution time, 10-sec timeout per socket by default
- 0 dependencies
- Lightweight health checks of HTTP and/or TCP sockets
- Decentralized monitoring with standalone dish instances deployed on different hosts that pull configuration from a common API
- Cron-driven one-shot checks without the need for any long-running agents
go install go.vxn.dev/dish/cmd/dish@latest
dish [FLAGS] SOURCE
The list of sockets to be checked can be provided via a local JSON file (e.g. the ./configs/demo_sockets.json
file included in this repository as an example), or via a remote RESTful JSON API.
For the expected JSON schema of the list of sockets to be checked, see ./configs/demo_sockets.json
.
# local JSON file
dish /opt/dish/sockets.json
# remote JSON API source
dish http://restapi.example.com/dish/sockets/:instance
dish -h
Usage of dish:
-failedOnly
a bool, specifies whether only failed checks should be reported (default true)
-hname string
a string, custom additional header name
-hvalue string
a string, custom additional header value
-name string
a string, dish instance name (default "generic-dish")
-target string
a string, result update path/URL to pushgateway, plaintext/byte output
-telegramBotToken string
a string, Telegram bot private token
-telegramChatID string
a string, Telegram chat/channel ID
-timeout uint
an int, timeout in seconds for http and tcp calls (default 10)
-updateURL string
a string, API endpoint URL for pushing results
-verbose
a bool, console stdout logging toggle
-webhookURL string
a string, URL of webhook endpoint
When a socket test fails, it's always good to be notified. For this purpose, dish provides 4 different ways of doing so (can be combined):
- Test results upload to a remote JSON API (using the
-updateURL
flag) - Failed sockets list as the Telegram message body (via the
-telegramBotToken
and-telegramChatID
flags) - Failed count and last test timestamp update to Pushgateway for Prometheus (using the
-target
flag) - Test results push to a webhook URL (using the
webhookURL
flag)
(The screenshot above shows the Telegram alerting as of v1.5.0
.)
One way to run dish is to build and install a binary executable.
# Fetch and install the specific version
go install go.vxn.dev/dish/cmd/dish@latest
export PATH=$PATH:~/go/bin
# Load sockets from sockets.json file, and use Telegram
# provider for alerting
dish -telegramChatID "-123456789" \
-telegramBotToken "123:AAAbcD_ef" \
sockets.json
# Use remote JSON API service as socket source, and push
# the results to Pushgateway
dish -target https://pushgw.example.com/ \
https://api.example.com/dish/sockets
# Copy, and/or edit dot-env file (optional)
cp .env.example .env
vi .env
# Build a Docker image
make build
# Run using docker compose stack
make run
# Run using native docker run
docker run --rm \
dish:1.9.2-go1.24 \
-verbose \
-target https://pushgateway.example.com \
https://api.example.com
Create a bash script to easily deploy dish and update its settings:
vi tiny-dish-run.sh
#!/bin/bash
TELEGRAM_TOKEN="123:AAAbcD_ef"
TELEGRAM_CHATID="-123456789"
SOURCE_URL=https://api.example.com/dish/sockets
UPDATE_URL=https://api.example.com/dish/sockets/results
TARGET_URL=https://pushgw.example.com
DISH_TAG=dish:1.9.2-go1.24
INSTANCE_NAME=tiny-dish
API_TOKEN=AbCd
docker run --rm \
${DISH_TAG} \
-name ${INSTANCE_NAME} \
-hvalue ${API_TOKEN} \
-hname X-Auth-Token \
-target ${TARGET_URL} \
-updateURL ${UPDATE_URL} \
-telegramBotToken ${TELEGRAM_TOKEN} \
-telegramChatID ${TELEGRAM_CHATID} \
-timeout 15 \
-verbose \
${SOURCE_URL}
Make it an executable:
chmod +x tiny-dish-run.sh
crontab -e
# m h dom mon dow command
MAILTO=monitoring@example.com
*/2 * * * * /home/user/tiny-dish-run.sh