Uptime Kuma monitoring agent for internal server monitoring. Execute custom checks, scan ports, monitor backups and storage—then report to Uptime Kuma via push API.
Project description
Kuma-Scout 🧭
Uptime Kuma's monitoring agent. Execute custom checks locally or remotely via SSH and report results to Uptime Kuma's push API.
Monitor anything that can be checked with a shell command: system health, backups, storage, ports, network devices, and custom scripts. Deploy via cron, systemd timer, or Docker.
Quick Start
# Install
pip install kuma-scout
# Single check via CLI
kuma-scout cmdcheck "systemctl is-active nginx" \
--uptime-kuma-url http://uptime-kuma:3001/api/push \
--token YOUR_TOKEN \
# Multiple checks via YAML config
kuma-scout run /etc/kuma-scout/config.yaml
# Remote execution via SSH
kuma-scout cmdcheck "systemctl is-active nginx" \
--ssh user@remote-server \
--uptime-kuma-url http://uptime-kuma:3001/api/push \
--token YOUR_TOKEN \
Result: ✅ UP (all checks pass) or ⚠️ DOWN (any check fails) in Uptime Kuma dashboard.
Features
- Command Execution: Execute arbitrary shell commands and monitor results (cmdcheck plugin)
- SSH Remote Execution: Run checks remotely on any SSH-accessible system
- Port Scanning: Scan TCP ports across IP ranges using nmap (portscan plugin)
- Backup Monitoring: Monitor Kopia backup snapshot freshness (kopiasnapshotstatus plugin)
- Storage Monitoring: Monitor ZFS pool health and free space (zfspoolstatus plugin)
- Heartbeat Monitoring: Send periodic health signals during long operations with configurable URL and token
- Pattern Matching: Use regex patterns for flexible success/failure detection
- Multi-Check Support: Run multiple checks with per-check configuration and tokens
- Tag-Based Aggregation: Automatically aggregate check results by tag and report aggregated status to shared tokens
- Plugin Architecture: Extensible system with auto-discovery
- Flexible Configuration: YAML config files, environment variables, CLI arguments
- Security First: Commands executed safely without shell injection; SSH with host key verification
Installation
Via pip (PyPI)
pip install kuma-scout
From source
git clone https://go.hugobatista.com/gh/kuma-scout.git
cd kuma-scout
pip install -e .
Docker
See doc/DOCKER.md for Docker installation and usage.
Documentation
- Configuration Guide - Detailed configuration reference with all options and examples
- CLI Usage - Command-line interface documentation and examples
- Security - Security considerations and best practices
- Docker - Docker installation and containerized deployment
- Migration Guide - Upgrading between versions
- Development - Plugin development and contributing
Use Cases
Universal Monitoring
Monitor any condition using shell commands:
- Service health:
systemctl is-active nginx - Database connectivity:
psql -c "SELECT 1" - Health endpoints:
curl -sf http://api:8080/health - Custom scripts:
/usr/local/bin/custom-check.sh
Remote Infrastructure Monitoring
Monitor systems remotely via SSH without installing agents:
CLI - Single remote check:
kuma-scout cmdcheck "systemctl is-active nginx" \
--ssh admin@remote-server \
--uptime-kuma-url http://uptime-kuma:3001/api/push \
--token YOUR_TOKEN \
YAML - Multiple remote servers:
uptime_kuma:
url: http://uptime-kuma:3001/api/push
token: ${UPTIME_KUMA_TOKEN}
ssh:
host: app-server.prod.example.com
user: monitoring
key_file: /root/.ssh/prod_key
checks:
- name: app_service
type: cmdcheck
command: "systemctl is-active myapp"
- name: db_health
type: cmdcheck
command: "systemctl is-active postgresql"
ssh:
host: db-server.prod.example.com
Backup Monitoring
Ensure backups are running on schedule with Kopia snapshot checks:
checks:
- name: daily_backup
type: kopiasnapshotstatus
path: "/data"
max_age_hours: 24
Storage Health
Monitor ZFS pools and ensure adequate free space:
checks:
- name: tank_pool
type: zfspoolstatus
pool: "tank"
min_free_percent: 10
Network Security
Monitor exposed ports on your infrastructure:
kuma-scout portscan 192.168.1.0/24 \
--uptime-kuma-url http://uptime-kuma:3001/api/push \
--token YOUR_TOKEN \
How It Works
- Define checks in YAML config or via CLI
- Run checks locally or remotely via SSH
- Get results as UP/DOWN status in Uptime Kuma dashboard
- Receive alerts when checks fail
Help
kuma-scout --help # Show available commands
kuma-scout cmdcheck --help # Show command execution options
kuma-scout run --help # Show run command options
Requirements
- Python 3.10+
- nmap (for port scanning)
- Kopia (for backup monitoring)
- ZFS tools (for storage monitoring)
Quick Example
Configuration File
Create /etc/kuma-scout/config.yaml:
uptime_kuma:
url: http://uptime-kuma:3001/api/push
token: ${UPTIME_KUMA_TOKEN}
logging:
level: INFO
# Heartbeat configuration - sends periodic pings during long operations
heartbeat:
enabled: true
interval: 300 # Send heartbeat every 5 minutes
uptime_kuma:
token: ${HEARTBEAT_TOKEN}
# URL is optional - if not set, inherits from global uptime_kuma.url
# Tag-based result aggregation tokens
# Each tag automatically aggregates results of all checks tagged with it
tags:
web:
uptime_kuma:
token: ${WEB_AGGREGATION_TOKEN}
# Optional: override URL for this tag (inherits global URL if not set)
description: "Aggregated status for web services"
storage:
uptime_kuma:
token: ${STORAGE_AGGREGATION_TOKEN}
description: "Aggregated status for storage checks"
backups:
uptime_kuma:
token: ${BACKUP_AGGREGATION_TOKEN}
# Example: send this tag's results to a different Uptime Kuma instance
# url: "http://secondary-uptimekuma:3001/api/push"
description: "Aggregated status for backup checks"
checks:
- name: nginx_health
type: cmdcheck
command: "systemctl is-active nginx"
tags: [web]
- name: disk_space
type: cmdcheck
command: "df -h / | grep -E '^/'"
tags: [storage]
timeout: 10
- name: backup_check
type: kopiasnapshotstatus
path: "/data"
max_age_hours: 24
tags: [backups]
# Optional: override Uptime Kuma token for this specific check
uptime_kuma:
token: ${BACKUP_SPECIFIC_TOKEN}
# URL inherits from global if not overridden
Run
export UPTIME_KUMA_TOKEN=your-push-token
export WEB_AGGREGATION_TOKEN=your-web-aggregation-token
export STORAGE_AGGREGATION_TOKEN=your-storage-aggregation-token
export BACKUP_AGGREGATION_TOKEN=your-backup-aggregation-token
# Run all checks - results aggregate by tag automatically
kuma-scout run /etc/kuma-scout/config.yaml
What happens:
Each check sends two reports automatically:
-
Individual Result - to the check's Uptime Kuma token
- Uses the check's
uptime_kumaconfig if set, otherwise inherits globaluptime_kuma - If check overrides
tokenbut noturl, URL is inherited from global config - Examples:
nginx_health→${UPTIME_KUMA_TOKEN}(uses global URL + global token)backup_check→${BACKUP_SPECIFIC_TOKEN}@ global URL (token overridden, URL inherited)
- Uses the check's
-
Aggregated Result - automatically combined by tag and sent to tag tokens
- Tag uses its
uptime_kumaconfig if set, otherwise inherits globaluptime_kuma - If tag overrides
tokenbut noturl, URL is inherited from global config - Examples:
webtag →${WEB_AGGREGATION_TOKEN}@ global URL (aggregated nginx_health)storagetag →${STORAGE_AGGREGATION_TOKEN}@ global URL (aggregated disk_space)backupstag →${BACKUP_AGGREGATION_TOKEN}@ global URL (aggregated backup_check)
- Tag uses its
Example with all scenarios:
uptime_kuma:
url: http://uptimekuma:3001/api/push
token: DEFAULT_TOKEN
tags:
web:
uptime_kuma:
token: WEB_TAG_TOKEN
backup:
uptime_kuma:
url: "http://secondary:3001/api/push" # Override URL only
token: BACKUP_TAG_TOKEN
checks:
- name: nginx
type: cmdcheck
command: "systemctl is-active nginx"
tags: [web]
# No uptime_kuma override - uses: DEFAULT_TOKEN @ http://uptimekuma:3001/api/push
- name: mysql
type: cmdcheck
command: "systemctl is-active mysql"
tags: [backup]
uptime_kuma:
token: MYSQL_CUSTOM_TOKEN
# URL not overridden - inherits: http://uptimekuma:3001/api/push
Results sent:
- nginx individual: DEFAULT_TOKEN @ uptimekuma (no per-check override)
- nginx tag aggregation: WEB_TAG_TOKEN @ uptimekuma (web tag, global URL)
- mysql individual: MYSQL_CUSTOM_TOKEN @ uptimekuma (token overridden, URL inherited)
- mysql tag aggregation: BACKUP_TAG_TOKEN @ secondary (backup tag, URL overridden)
- Total: 4 API calls to Uptime Kuma (2 individual + 2 aggregated)
Or schedule with cron:
# Run every 5 minutes
*/5 * * * * kuma-scout run /etc/kuma-scout/config.yaml
Security
⚠️ Key Points:
- Configuration files contain authentication tokens - restrict permissions to
600 - Run as non-root user with minimal privileges when possible
- Commands executed without shell interpretation (injection-safe)
- SSH strict host key checking enabled by default
See doc/SECURITY.md for comprehensive security guidance.
Upgrading
For migration notes between versions, see doc/MIGRATION.md.
License
MIT License - See LICENSE file for details
Contributing
Contributions welcome! See doc/DEVELOPMENT.md for development setup.
- Fork and create a feature branch
- Make your changes with tests
- Run
hatch run checkto validate - Submit a pull request
Issues
Report bugs on GitHub Issues
Related
- Uptime Kuma - Self-hosted monitoring tool
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kuma_scout-0.2.0.tar.gz.
File metadata
- Download URL: kuma_scout-0.2.0.tar.gz
- Upload date:
- Size: 70.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f8310d18125402102d6461d75c5a9776d3d47bc8514dc68528f38317fb4d24e
|
|
| MD5 |
f08b27546045e6ee2d793db1b764bd46
|
|
| BLAKE2b-256 |
c2e7814f35bd5530744398ad7df4e844db33506630c23bf7792aa8b2873c34f4
|
Provenance
The following attestation bundles were made for kuma_scout-0.2.0.tar.gz:
Publisher:
pypi.yml on hugobatista/kuma-scout
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kuma_scout-0.2.0.tar.gz -
Subject digest:
6f8310d18125402102d6461d75c5a9776d3d47bc8514dc68528f38317fb4d24e - Sigstore transparency entry: 938292803
- Sigstore integration time:
-
Permalink:
hugobatista/kuma-scout@2a366d467c211d522dafef739935acbc0ccdae32 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hugobatista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2a366d467c211d522dafef739935acbc0ccdae32 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kuma_scout-0.2.0-py3-none-any.whl.
File metadata
- Download URL: kuma_scout-0.2.0-py3-none-any.whl
- Upload date:
- Size: 50.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fcc74bae0cde764a90fc362d1b6e596379f005576c0b322a00bf23e561d99c1
|
|
| MD5 |
1540e6ddfd004a979c09591a8f08c93d
|
|
| BLAKE2b-256 |
a82baf5697bcbbf6c067904f02d128968cabd8808b014ad245296d835a6a3a51
|
Provenance
The following attestation bundles were made for kuma_scout-0.2.0-py3-none-any.whl:
Publisher:
pypi.yml on hugobatista/kuma-scout
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kuma_scout-0.2.0-py3-none-any.whl -
Subject digest:
2fcc74bae0cde764a90fc362d1b6e596379f005576c0b322a00bf23e561d99c1 - Sigstore transparency entry: 938292808
- Sigstore integration time:
-
Permalink:
hugobatista/kuma-scout@2a366d467c211d522dafef739935acbc0ccdae32 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hugobatista
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@2a366d467c211d522dafef739935acbc0ccdae32 -
Trigger Event:
release
-
Statement type: