Script based monitoring behind a network e.g. k8s
837
Open WebUI configured path: $URL_BASE_PATH (e.g.: http://localhost/monitoring)
Use our own scripts to monitor a endpoint or maschine e.q. in a cluster of Kubernetes.
Just create the script so that it returns an output in JSON format and place it in: /scripts
Supported file extensions:
*.sh / *.bash*.pyFor example with PRTG output:
#!/usr/bin/env bash
timestamp="$(date +%s%3N)"
# --- Configuration ---
URL="https://www.google.com"
CURL_OUTPUT="$(curl -o /dev/null -s -w "%{http_code}\n" $URL)"
exec_time="$(( "$(date +%s%3N)" - "${timestamp}" ))"
# --- JSON output (PRTG compatible) ---
cat <<EOF
{
"prtg": {
"result": [
{
"channel": "HTTP Status Code",
"unit": "custom",
"limitmode": 1,
"limitmaxerror": 399,
"limitmaxwarning": 299,
"value": ${CURL_OUTPUT}
},
{
"channel": "Execution Time",
"unit": "TimeResponse",
"value": ${exec_time}
}
],
"text": "HTTP Check OK"
}
}
EOF
---
services:
monitoring:
container_name: monitoring
hostname: monitoring
image: monitoring:latest
restart: unless-stopped
network_mode: bridge
mem_limit: 256m
environment:
HEALTHCHECK_INTERVAL: 10
NGINX_LOG_LEVEL: warn
NGINX_ACCESS_TO_CONSOLE: false
NGINX_ERROR_TO_CONSOLE: true
LOGROTATE_INTERVAL: daily
LOGROTATE_ROTATE: 7
URL_BASE_PATH: /monitoring
HEADER_NAME: Monitoring
HEADER_PATH: /output
FOOTER_NAME: <FOOTER_NAME>
FOOTER_URL: https://hub.docker.com/r/amaneswiss/monitoring?tag=latest
TZ: Europe/Zurich
volumes:
- ./scripts:/scripts:rw
ports:
- "80:80"
Content type
Image
Digest
sha256:5a1f60096…
Size
26.5 MB
Last updated
11 months ago
docker pull amaneswiss/monitoring