Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Remove the /system process and service routes

Juan Denis9d750a4f6fba
diff --git a/backend/app/api/system.py b/backend/app/api/system.py
index fe77635f..68b5b9f0 100644
--- a/backend/app/api/system.py
+++ b/backend/app/api/system.py
@@ -500,56 +500,3 @@ def set_timezone():
return jsonify(result), 400
-@system_bp.route('/processes', methods=['GET'])
-@jwt_required()
-def get_processes():
- require_admin_user()
-
- processes = []
- for proc in psutil.process_iter(['pid', 'name', 'cpu_percent', 'memory_percent', 'status']):
- try:
- pinfo = proc.info
- if pinfo['cpu_percent'] > 0 or pinfo['memory_percent'] > 0.1:
- processes.append({
- 'pid': pinfo['pid'],
- 'name': pinfo['name'],
- 'cpu_percent': pinfo['cpu_percent'],
- 'memory_percent': round(pinfo['memory_percent'], 2),
- 'status': pinfo['status']
- })
- except (psutil.NoSuchProcess, psutil.AccessDenied):
- pass
-
- # Sort by CPU usage
- processes.sort(key=lambda x: x['cpu_percent'], reverse=True)
-
- return jsonify({
- 'processes': processes[:50] # Top 50 processes
- }), 200
-
-
-@system_bp.route('/services', methods=['GET'])
-@jwt_required()
-def get_services():
- require_admin_user()
-
- # Common services to check
- service_names = ['nginx', 'mysql', 'postgresql', 'redis', 'docker', 'php-fpm']
- services = []
-
- for name in service_names:
- running = False
- for proc in psutil.process_iter(['name']):
- try:
- if name.lower() in proc.info['name'].lower():
- running = True
- break
- except (psutil.NoSuchProcess, psutil.AccessDenied):
- pass
-
- services.append({
- 'name': name,
- 'status': 'running' if running else 'stopped'
- })
-
- return jsonify({'services': services}), 200
diff --git a/docs/API.md b/docs/API.md
index 1539aea5..112434cd 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -300,48 +300,6 @@ GET /system/disk
GET /system/network
```
-### Get Running Processes
-
-```http
-GET /system/processes
-```
-
-**Response (200):**
-```json
-{
- "processes": [
- {
- "pid": 1234,
- "name": "python",
- "cpu_percent": 5.2,
- "memory_percent": 2.1,
- "status": "running"
- }
- ]
-}
-```
-
----
-
-### Get Services Status
-
-```http
-GET /system/services
-```
-
-**Response (200):**
-```json
-{
- "services": [
- {"name": "nginx", "status": "running"},
- {"name": "mysql", "status": "running"},
- {"name": "docker", "status": "stopped"}
- ]
-}
-```
-
----
-
### Health Check
No authentication required.
diff --git a/docs/API_SURFACE.md b/docs/API_SURFACE.md
index 4009e331..8de818bc 100644
--- a/docs/API_SURFACE.md
+++ b/docs/API_SURFACE.md
@@ -678,9 +678,7 @@ Regenerate (backend/):
- `GET /system/network`
- `GET /system/notices`
- `GET /system/performance-history`
-- `GET /system/processes`
- `GET /system/resource-tier`
-- `GET /system/services`
- `GET /system/storage`
- `GET /system/time`
- `GET /system/timezones`
diff --git a/frontend/src/services/__tests__/apiRegistry.test.mjs b/frontend/src/services/__tests__/apiRegistry.test.mjs
index a1d82046..372f3686 100644
--- a/frontend/src/services/__tests__/apiRegistry.test.mjs
+++ b/frontend/src/services/__tests__/apiRegistry.test.mjs
@@ -45,14 +45,13 @@ test('previously colliding operations have distinct URLs, preserving public winn
const paths = [];
const client = { request: async (path) => { paths.push(path); } };
bindApiMethods(client, [apps, system, jobs, servers, plugins]);
- await client.getServices();
await client.getAppServices();
await client.getJobStats();
await client.getBackgroundJobStats();
await client.uninstallPlugin('panel');
await client.uninstallPluginInstall('agent');
assert.deepEqual(paths, [
- '/system/services', '/apps', '/jobs/stats', '/performance/jobs/stats',
+ '/apps', '/jobs/stats', '/performance/jobs/stats',
'/plugins/panel', '/agent-plugins/installs/agent',
]);
});
diff --git a/frontend/src/services/api/system.js b/frontend/src/services/api/system.js
index 9901d6cb..4f86cb68 100644
--- a/frontend/src/services/api/system.js
+++ b/frontend/src/services/api/system.js
@@ -148,14 +148,6 @@ export async function startPanelUpdate() {
});
}
-export async function getSystemProcesses() {
- return this.request('/system/processes');
-}
-
-export async function getServices() {
- return this.request('/system/services');
-}
-
export async function healthCheck() {
return this.request('/system/health');
}