Add push monitor script deployment via SSH
All checks were successful
Build and Push Container / build (push) Successful in 33s

- Add push_scripts.py with bash templates for heartbeat, disk, memory, cpu, and updates monitoring
- Modify kuma_client.py to return push token from created monitors
- Add deploy_push_script() to monitors.py for SSH-based script deployment
- Add heartbeat push_metric type to Claude agent suggestions
- Add /api/monitors/<id>/deploy-script and /api/monitors/deploy-all-scripts endpoints
- Update frontend to show push monitors with deployment status and retry buttons

Scripts are deployed to /usr/local/bin/kuma-push-{metric}-{id}.sh with cron entries.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-01-05 08:36:48 +00:00
parent 908d147235
commit ae814c1aea
7 changed files with 577 additions and 21 deletions

View File

@@ -49,7 +49,7 @@ Always respond with valid JSON in this structure:
"port": 80,
"interval": 60,
"reason": "Why this should be monitored",
"push_metric": "disk|memory|cpu|updates (only for push type)"
"push_metric": "heartbeat|disk|memory|cpu|updates (only for push type)"
}
],
"additional_commands": [
@@ -72,25 +72,30 @@ Always respond with valid JSON in this structure:
## Push Monitors for System Metrics
Always suggest push monitors for system health metrics. These run as cron jobs on the host and push status to Uptime Kuma. Suggest these based on what you see:
1. **Disk Space** - Alert when any partition exceeds 85% usage
1. **Heartbeat** - Simple "I'm alive" check for hosts that can't be reached directly (behind NAT/firewall)
- Name: "{hostname} - Heartbeat"
- push_metric: "heartbeat"
- Use this INSTEAD of ping for remote hosts that Uptime Kuma cannot reach directly
2. **Disk Space** - Alert when any partition exceeds 90% usage
- Name: "{hostname} - Disk Space"
- push_metric: "disk"
2. **Memory Usage** - Alert when RAM exceeds 90% usage
3. **Memory Usage** - Alert when RAM exceeds 90% usage
- Name: "{hostname} - Memory"
- push_metric: "memory"
3. **CPU Load** - Alert when load average exceeds CPU count
4. **CPU Load** - Alert when 5-min load average exceeds 95% of CPU cores
- Name: "{hostname} - CPU Load"
- push_metric: "cpu"
4. **System Updates** - Alert when security updates are pending (Debian/Ubuntu)
5. **System Updates** - Alert when security updates are pending (Debian/Ubuntu/RHEL)
- Name: "{hostname} - Updates"
- push_metric: "updates"
For push monitors, set:
- type: "push"
- target: the metric type (disk, memory, cpu, updates)
- target: the metric type (heartbeat, disk, memory, cpu, updates)
- interval: 300 (5 minutes is typical for system metrics)
Be thorough but not excessive. Quality over quantity - suggest monitors that will actually catch real problems."""