2025-03-27 16:27:00
github.com
- tiny one-shot monitoring service
- remote configuration of independent ‘dish network’ (via
-source ${REMOTE_JSON_API_URL}
flag) - fast concurrent testing, low overall execution time, 10-sec timeout per socket by default
- 0 dependencies
go install go.vxn.dev/dish/cmd/dish@latest
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")
-source string
a string, path to/URL JSON socket list (default "./configs/demo_sockets.json")
-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, URL of the source api instance
-verbose
a bool, console stdout logging toggle
-webhookURL string
a string, URL of webhook endpoint
The list of sockets can be provided via a local JSON-formated file (e.g. demo_sockets.json
file in the CWD), or via a remote REST/RESTful JSON API.
# local JSON file
dish -source /opt/dish/sockets.json
# remote JSON API source
dish -source http://restapi.example.com/dish/sockets/:instance
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 (via
-updateURL
flag) - failed sockets list as the Telegram message body (via Telegram-related flags, see the help output above)
- failed count and last test timestamp update to Pushgateway for Prometheus (via
-pushgw
and-target
flags) - test results push to a webhook URL (via the
webhookURL
andwebhooks
flags)
(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 -source sockets.json -telegram -telegramChatID "-123456789" \
-telegramBotToken "123:AAAbcD_ef"
# Use remote JSON API service as socket source, and push
# the results to Pushgateway
dish -source https://api.example.com/dish/sockets -pushgw \
-target https://pushgw.example.com/
# 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.7.1-go1.23 \
-verbose \
-source https://api.example.com \
-pushgw \
-target https://pushgateway.example.com
Create a bash script to easily deploy dish and update its settings:
#!/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.6.0-go1.22
INSTANCE_NAME=tiny-dish
SWAPI_TOKEN=AbCd
docker run --rm \
${DISH_TAG} \
-name ${INSTANCE_NAME} \
-source ${SOURCE_URL} \
-hvalue ${SWAPI_TOKEN} \
-hname X-Auth-Token \
-pushgw \
-target ${TARGET_URL} \
-update \
-updateURL ${UPDATE_URL} \
-telegram \
-telegramBotToken ${TELEGRAM_TOKEN} \
-telegramChatID ${TELEGRAM_CHATID} \
-timeout 15 \
-verbose
Make it an executable:
chmod +x tiny-dish-run.sh
# m h dom mon dow command
MAILTO=monitoring@example.com
*/2 * * * * /home/user/tiny-dish-run.sh
The idea of a tiny one-shot service comes with the need for a quick monitoring service implementation to test HTTP/S and generic TCP endpoints (or just sockets in general = hosts and their ports).
Keep your files stored safely and securely with the SanDisk 2TB Extreme Portable SSD. With over 69,505 ratings and an impressive 4.6 out of 5 stars, this product has been purchased over 8K+ times in the past month. At only $129.99, this Amazon’s Choice product is a must-have for secure file storage.
Help keep private content private with the included password protection featuring 256-bit AES hardware encryption. Order now for just $129.99 on Amazon!
Help Power Techcratic’s Future – Scan To Support
If Techcratic’s content and insights have helped you, consider giving back by supporting the platform with crypto. Every contribution makes a difference, whether it’s for high-quality content, server maintenance, or future updates. Techcratic is constantly evolving, and your support helps drive that progress.
As a solo operator who wears all the hats, creating content, managing the tech, and running the site, your support allows me to stay focused on delivering valuable resources. Your support keeps everything running smoothly and enables me to continue creating the content you love. I’m deeply grateful for your support, it truly means the world to me! Thank you!
BITCOIN bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge Scan the QR code with your crypto wallet app |
DOGECOIN D64GwvvYQxFXYyan3oQCrmWfidf6T3JpBA Scan the QR code with your crypto wallet app |
ETHEREUM 0xe9BC980DF3d985730dA827996B43E4A62CCBAA7a Scan the QR code with your crypto wallet app |
Please read the Privacy and Security Disclaimer on how Techcratic handles your support.
Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.