- Home
- Skills
- DevOps & Cloud
- Uptime Healthcheck Monitor
Works with the AI Agents you already use
Uptime Healthcheck Monitor
Lightweight Python uptime monitor for HTTP and Docker with state-change Telegram alerts and systemd scheduling.
$6.99
Uptime Healthcheck Monitor
Example session with this skill installed
Design a monitor for my website https://example.com and a Docker container named 'db-worker'. I need Telegram alerts for state changes and a systemd timer to run it every 5 minutes.
- Read your context and instructions
- Compiled the uptime healthcheck monitor
I have designed a lightweight Python monitor for your HTTP endpoint and Docker container. The implementation uses a state-change logic to ensure you only receive Telegram notifications when a service goes down or recovers.
Uptime Monitor Implementation
1. Python Monitor Script (monitor.py)
import os
import json
import requests
import subprocess
from datetime import datetime
# Configuration from environment
TELEGRAM_TOKEN = os.getenv("TELEGRAM_TOKEN")
CHAT_ID = os.getenv("CHAT_ID")
STATE_FILE = "monitor_state.json"
TARGETS = [
{"type": "http", "name": "example-site", "url": "https://example.com", "timeout": 10},
{"type": "docker", "name": "db-worker", "container": "db-worker"}
]
def get_state():
if os.path.exists(STATE_FILE):
with open(STATE_FILE, 'r') as f:
return json.load(f)
return {}
def save_state(state):
with open(STATE_FILE, 'w') as f:
json.dump(state, f)
def notify(msg):
url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage"
payload = {"chat_id": CHAT_ID, "text": msg, "parse_mode": "Markdown"}
try:
requests.post(url, json=payload, timeout=10)
except Exception as e:
print(f"Failed to send alert: {e}")
def check_http(target):
try:
r = requests.get(target['url'], timeout=target['timeout'])
return "UP" if r.status_code == 200 else "DOWN"
except:
return "DOWN"
def check_docker(target):
try:
res = subprocess.run(["docker", "inspect", "-f", "{{.State.Running}}", target['container']],
capture_output=True, text=True)
return "UP" if res.stdout.strip() == "true" else "DOWN"
except:
return "DOWN"
def main():
current_state = get_state()
for t in TARGETS:
status = check_http(t) if t['type'] == 'http' else check_docker(t)
last_status = current_state.get(t['name'])
if last_status and status != last_status:
emoji = "✅" if status == "UP" else "🚨"
notify(f"{emoji} *{t['name']}* state changed to {status}")
current_state[t['name']] = status
save_state(current_state)
if __name__ == "__main__":
main()
2. Systemd Configuration (uptime-monitor.timer)
[Unit]
Description=Run Uptime Monitor every 5 minutes
[Timer]
OnBootSec=2min
OnUnitActiveSec=5min
Unit=uptime-monitor.service
[Install]
WantedBy=timers.target
Next steps
- Create a
.envfile with yourTELEGRAM_TOKENandCHAT_ID. - Ensure your user is in the
dockergroup to allow the script to inspect containers. - Copy the unit files to
/etc/systemd/system/and runsystemctl enable --now uptime-monitor.timer.
Connects securely to your tools. The creator never sees your data.
About this skill
This skill solves the problem of unreliable service monitoring by generating a lightweight Python healthcheck system. It replaces heavy monitoring suites with a focused script that tracks HTTP endpoints and Docker containers, sending Telegram alerts only when a state change occurs. The skill provides the complete implementation: from Python code using standard libraries to systemd unit files for reliability.
What it does
- Multi-target monitoring tracks both HTTP/HTTPS endpoints and local Docker container health states.
- State-change alerting prevents notification fatigue by only messaging Telegram when a target moves between UP and DOWN states.
- Resilient execution generates systemd service and timer configurations to ensure the monitor persists across reboots.
- Secure secret management designs environment variable patterns to keep Telegram bot tokens out of source code and logs.
- Atomic state tracking manages a local JSON or SQLite store to handle persistence and prevent duplicate alerts after restarts.
How it works
- Define targets by specifying URLs, expected status codes, response markers, or Docker container IDs.
- Configure thresholds to set custom timeouts, retry counts, and failure limits for each specific service.
- Generate implementation including the Python monitoring logic, environment templates, and systemd unit files.
- Execute verification using the provided test plan to simulate outages, TLS failures, and Telegram rate limiting.
Frameworks & tools
Python 3.x, Docker API, Telegram Bot API, systemd, and standard libraries like requests or urllib.
Why this beats prompting it yourself
Generic prompts often produce scripts that spam notifications on every poll or leak bot tokens in logs. This skill enforces state-transition logic, atomic state writes, and explicit permission models for Docker socket access that casual prompting misses.
Use cases
- Monitor critical web services and API endpoints for status code or content changes.
- Track local Docker containers to ensure background workers stay in a running state.
- Deploy a low-resource monitoring agent on a Raspberry Pi or small VPS.
- Replace manual service checks with automated systemd-managed health reports.
Known limitations
Requires local filesystem access for state persistence and Docker socket permissions for container inspection. Telegram delivery depends on outbound HTTPS connectivity.
Requires Python 3.x and systemd. Docker monitoring requires host socket access. Telegram alerts require an active internet connection and valid bot token.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 14 days ago
- Software
Python