Skip to main content

Universal production server monitoring, healing, and reporting skill for cmdop

Project description

server-agent

CMDOP Skill — install and use via CMDOP agent:

cmdop-skill install server-agent

Universal production server monitoring, self-healing, and reporting skill for cmdop.

Watches over Docker containers, detects anomalies, heals what is safe to heal, scans for vulnerabilities, and writes structured Markdown reports — all driven by the cmdop agent.

Quick Start

# Install
pip install -e .
cmdop skills install .

# Quick status check
server-agent status

# Full health check (auto-heals safe issues)
server-agent check

# Security scan
server-agent scan

# Heal a specific container
server-agent heal --container reforms-django

# Daily report
server-agent report --type daily

Commands

Command Description
check Full health check: containers, disk, Redis. Auto-heals safe issues.
scan Security scan: trivy CVEs, open ports, auth logs.
heal Targeted remediation for a specific container.
report Write structured MD reports (daily, security).
status Quick server snapshot — no files written.

All commands support --json for structured output and --dry-run to preview actions without executing them.

Environment Variables

Variable Required Description
REPORTS_DIR yes Absolute path to reports directory
TELEGRAM_BOT_TOKEN no Bot token for Telegram notifications
TELEGRAM_CHAT_ID no Target chat/channel ID

Autonomy Model

  • SAFE (executes immediately): docker restart, docker system prune
  • ESCALATE (sends Telegram alert): image rebuild, config changes, containers with >2 restarts, OOM
  • NEVER: database commands, rm -rf outside /tmp, firewall changes

Protected containers (never auto-restarted): shared-db-redis, traefik

Setup on Production Server

# 1. Install
pip install server-agent
cmdop skills install server-agent

# 2. Set environment
export REPORTS_DIR=/root/server-agent/reports
export TELEGRAM_BOT_TOKEN=<token>
export TELEGRAM_CHAT_ID=<chat_id>

# 3. Verify
server-agent status --json

# 4. Generate port baseline
server-agent scan --baseline
# Review baseline/ports.json, then set reviewed: true

# 5. Start cmdop agent
cmdop agent start

# 6. Register triggers
cmdop trigger add --name "server-agent-check" --interval 300 \
  --prompt "Run command: server-agent check"

cmdop trigger add --name "server-agent-scan" --interval 1800 \
  --prompt "Run command: server-agent scan"

cmdop trigger add --name "server-agent-daily" --interval 86400 \
  --prompt "Run command: server-agent report --type daily"

Two Modes of Operation

Scheduled monitoring (Python CLI)

Triggers call server-agent binary directly. No LLM in the check loop — fast, deterministic, cheap.

# Runs every 5 min via trigger
server-agent check

Interactive investigation (cmdop skill)

Use when you need the agent to reason about an incident:

cmdop run server-agent "reforms-django keeps restarting, investigate and fix"

The agent reads skill/readme.md as its system prompt and uses server-agent CLI as a tool to gather data and take action.

Reports Structure

$REPORTS_DIR/
  index.md
  baseline/ports.json
  2026-03-14/
    10-23-incident-reforms-django.md
    14-05-security-scan.md
    daily-summary.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

server_agent-0.1.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

server_agent-0.1.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file server_agent-0.1.1.tar.gz.

File metadata

  • Download URL: server_agent-0.1.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for server_agent-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6fc3077d0b597329eb8e4d2724c0472b8eea9a3ee74bc259507ef90f70d38963
MD5 a0d03a21e7ccbac7467193903958e25d
BLAKE2b-256 0b36b45ec92f791d46590b6b35fadf9d0664a95c5ac1023ac49e1f0bcb03d2ff

See more details on using hashes here.

File details

Details for the file server_agent-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: server_agent-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for server_agent-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68aeed26cc8c1435b152b40dcd0a566c99f0cbbf628abd16c3b878ed620a508d
MD5 7796d605808d45a34400c3caf7731a0a
BLAKE2b-256 b1b52e013bfb4e9b2e69120c6eecc7b024437d7e64cf12c51a2426ae6bdada99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page