System Load Monitor

System load monitoring and task control skill. Monitors CPU and memory usage rates, automatically pauses tasks when the load exceeds the threshold, and resum...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 175 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name/description (monitor and control tasks) aligns with the provided script and usage patterns. The bundled script reports CPU/memory and top processes and returns recommendations; it does not itself forcibly stop/kill other processes (task control is left to the caller or the example loop), and the SKILL.md mentions Feishu notifications that are not implemented in the code.
Instruction Scope
SKILL.md instructs the agent to run the included script and shows a safe example monitoring loop that queries the script and pauses via sleep. All referenced actions are local (reading /proc/meminfo, running ps). A minor practical issue: some examples use '~' in subprocess invocations which won't be shell-expanded when passed as an argv list.
Install Mechanism
No install spec — instruction-only with a small Python script. Nothing is downloaded or written to disk by an installer.
Credentials
The skill requests no environment variables or credentials and the code only reads local system state (/proc and ps). No network calls or secret access are present.
Persistence & Privilege
always is false and the skill is user-invocable. It does not modify agent/system configuration or claim permanent presence.
Assessment
This skill appears to be a small, local monitoring helper that is safe to inspect and run on Linux servers. Before installing or automating: 1) confirm you run it on Linux (it reads /proc/meminfo and uses getloadavg), 2) note the script only recommends pausing/resuming — it does not kill or manage other processes automatically (you must implement task-control or use the provided example loop), 3) the SKILL.md mentions sending Feishu notifications but no code for that is included (implement securely if needed), and 4) the example command lines use '~' which may not expand in subprocess calls — update paths to absolute ones when embedding the script. If you need automatic remote notifications or actions, review and add those integrations explicitly and securely (do not add credentials you do not trust).

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk97198d42pzyd6dpyc1ex7sst182pm34

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

System Load Monitor

Core Functions

Monitors the CPU and memory load of the server, automatically controls the execution of system tasks, and prevents the server from downtime due to excessive load.

When to Use This Skill

Use this skill when the user mentions the following situations:

  • The server has low configuration (e.g., 2 cores 2GB) and is prone to downtime
  • Need to execute resource-intensive tasks
  • Previous downtime caused by excessive load
  • Need to intelligently control the rhythm of task execution
  • Need to monitor server status in real time

Configuration Parameters

ParameterDefault ValueDescription
cpu_threshold90CPU load threshold (percentage)
memory_threshold90Memory usage threshold (percentage)
check_interval30Check interval (seconds)
cool_down60Cool-down time after excessive load (seconds)

Usage Methods

1. Check Current System Status

# Quick check
python3 ~/.openclaw/workspace/skills/system-load-monitor/scripts/check_load.py

# View detailed JSON output
python3 ~/.openclaw/workspace/skills/system-load-monitor/scripts/check_load.py --json

# Custom thresholds
python3 ~/.openclaw/workspace/skills/system-load-monitor/scripts/check_load.py --cpu-threshold 80 --memory-threshold 85

2. Load Check Process Before Task Execution

Before executing any resource-consuming tasks:

  1. Run load check

    python3 ~/.openclaw/workspace/skills/system-load-monitor/scripts/check_load.py --json
    
  2. Parse return results

    • status: "ok" / "warning" / "critical"
    • recommendation: "CONTINUE" / "PAUSE"
    • cpu.load_percent: CPU load percentage
    • memory.used_percent: Memory usage percentage
  3. Make decisions based on status

    • ok: Continue executing the task
    • warning: Execute cautiously and consider batch processing
    • critical: Pause the task and retry after cooling down

3. Monitoring Loop for Long-Running Tasks

For long-running tasks, use the following pattern:

import subprocess
import time
import json

def check_load():
    result = subprocess.run(
        ['python3', '~/.openclaw/workspace/skills/system-load-monitor/scripts/check_load.py', '--json'],
        capture_output=True, text=True
    )
    return json.loads(result.stdout)

def run_with_load_monitor(task_func, cpu_threshold=90, memory_threshold=90):
    """Continuously monitor load while executing tasks"""
    while True:
        status = check_load()
        
        if status['status'] == 'critical':
            print(f"⚠️ Excessive load, pausing task...")
            print(f"CPU: {status['cpu']['load_percent']}%, Memory: {status['memory']['used_percent']}%")
            time.sleep(60)  # Wait for 60 seconds
            continue
        
        # Load is normal, execute the task
        task_func()
        break

Status Code Explanation

Exit CodeStatusMeaning
0okLoad is normal, can continue
1warningLoad is relatively high, recommended to proceed with caution
2criticalLoad is excessively high, must pause

Recommendations for Low-Configured Servers (2 Cores 2GB)

For your 2-core 2GB server:

  1. Lower the threshold: It is recommended to use 70-80% as the warning line

    python3 ~/.openclaw/workspace/skills/system-load-monitor/scripts/check_load.py --cpu-threshold 75 --memory-threshold 80
    
  2. Execute in batches: Split large tasks into small batches

  3. Avoid concurrency: Only perform one task at a time

  4. Regular checks: Check the load every 30 seconds for long-running tasks

Alert Notifications

When a critical status is detected, you should:

  1. Immediately pause the current task
  2. Notify the user (via Feishu message)
  3. Retry after the cool-down period

Script Output Example

{
  "status": "critical",
  "cpu": {
    "load_avg_1m": 3.8,
    "cpu_count": 2,
    "load_percent": 190.0
  },
  "memory": {
    "total_mb": 2048,
    "used_mb": 1843,
    "available_mb": 205,
    "used_percent": 90.0
  },
  "top_processes": [
    {"user": "node", "cpu_percent": 45.2, "mem_percent": 32.1, "command": "node /usr/bin/openclaw"}
  ],
  "thresholds": {"cpu": 90, "memory": 90},
  "recommendation": "PAUSE"
}

Notes

  1. This skill is an independent monitoring tool and does not rely on Fairy's built-in judgment
  2. The check should be invoked before executing any important tasks
  3. For long-running tasks, a cyclic monitoring mechanism should be established
  4. Threshold parameters can be adjusted according to actual conditions

Files

2 total
Select a file
Select a file to preview.

Comments

Loading comments…