diff --git a/backend/services/monitors.py b/backend/services/monitors.py index 37fc2f0..f856010 100644 --- a/backend/services/monitors.py +++ b/backend/services/monitors.py @@ -283,17 +283,19 @@ class MonitorService: write_cmd = f"sudo tee {script_path} > /dev/null << 'KUMA_SCRIPT_EOF'\n{script_content}KUMA_SCRIPT_EOF" result = ssh.execute(hostname, write_cmd, username, port) if not result.success: + error_detail = result.stderr or result.stdout or f"exit code {result.exit_code}" return { "status": "failed", - "error": f"Failed to write script: {result.stderr}", + "error": f"Failed to write script: {error_detail}", } # Make the script executable chmod_result = ssh.execute(hostname, f"sudo chmod +x {script_path}", username, port) if not chmod_result.success: + error_detail = chmod_result.stderr or chmod_result.stdout or f"exit code {chmod_result.exit_code}" return { "status": "failed", - "error": f"Failed to make script executable: {chmod_result.stderr}", + "error": f"Failed to make script executable: {error_detail}", } # Add cronjob entry (remove existing entry first to avoid duplicates)