Spaces:
Paused
Paused
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,6 +11,7 @@ license: mit
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# ProMonitor 🌖
|
|
|
|
| 14 |
A Gradio-based web interface for monitoring and managing system resources on an HP Z440 workstation, designed for cybersecurity and system performance monitoring. ProMonitor interacts with a FastAPI backend (running at http://localhost:8000 by default) to provide real-time metrics, historical data, resource limit management, process control, and emergency stop functionality.
|
| 15 |
• Title: ProMonitor
|
| 16 |
• Emoji: 🌖
|
|
@@ -18,7 +19,7 @@ A Gradio-based web interface for monitoring and managing system resources on an
|
|
| 18 |
• SDK: Gradio (version 5.35.0)
|
| 19 |
• App File: app.py
|
| 20 |
• License: MIT
|
| 21 |
-
Features
|
| 22 |
ProMonitor offers a comprehensive interface for system monitoring and management, with a focus on security and usability:
|
| 23 |
• Dashboard: Displays real-time system metrics (CPU, memory, GPU, disk usage) and health status (Healthy, Degraded, Unhealthy) with a refreshable view.
|
| 24 |
• History: Visualizes historical CPU, memory, and GPU usage over a user-specified time range (1–1440 minutes) using tables and line charts.
|
|
@@ -27,11 +28,11 @@ ProMonitor offers a comprehensive interface for system monitoring and management
|
|
| 27 |
• Processes: Lists top CPU- and memory-intensive processes, with options to kill, suspend, or resume processes (secured with API key).
|
| 28 |
• System Info: Provides static system information (platform, CPU, memory, disk, GPU) in a structured format.
|
| 29 |
• Emergency Stop: Enables termination of high-memory processes with confirmation and API key authentication.
|
| 30 |
-
Prerequisites
|
| 31 |
• Python: 3.10+ (as specified in .hf_space.yml)
|
| 32 |
• FastAPI Backend: The backend (app/main.py) must be running and accessible (default: http://localhost:8000).
|
| 33 |
• Dependencies: Listed in requirements.txt (see Installation).
|
| 34 |
-
Installation
|
| 35 |
1 Clone the Repository:
git clone https://huggingface.co/spaces//ProMonitor
|
| 36 |
2 cd ProMonitor
|
| 37 |
3
|
|
@@ -51,7 +52,7 @@ Installation
|
|
| 51 |
10
If the backend is hosted elsewhere, update API_BASE_URL in .env.
|
| 52 |
11 Run the UI: Launch the Gradio app:
python app.py
|
| 53 |
12
The UI will be available at http://localhost:7860.
|
| 54 |
-
Usage
|
| 55 |
1 Access the UI: Open http://localhost:7860 in a web browser to access the ProMonitor interface.
|
| 56 |
2 Navigate Tabs:
|
| 57 |
◦ Dashboard: View real-time metrics and health status. Click “Refresh Metrics” to update.
|
|
@@ -64,8 +65,8 @@ Usage
|
|
| 64 |
3 Secure Actions:
|
| 65 |
◦ For process actions and emergency stop, provide the API key in the respective input fields.
|
| 66 |
◦ Ensure the backend validates the API key to prevent unauthorized access.
|
| 67 |
-
Deployment on Hugging Face Spaces
|
| 68 |
-
ProMonitor is configured for deployment on Hugging Face Spaces with the following setup:
|
| 69 |
1 Push to Hugging Face Spaces:
|
| 70 |
◦ Create a new Space on Hugging Face: https://huggingface.co/new
|
| 71 |
◦ Select “Gradio” as the SDK and configure it as a public or private Space.
|
|
@@ -83,7 +84,7 @@ ProMonitor is configured for deployment on Hugging Face Spaces with the followin
|
|
| 83 |
◦ The FastAPI backend must be hosted separately (e.g., on another Hugging Face Space, AWS, or a local server with tunneling via ngrok).
|
| 84 |
◦ Update API_BASE_URL in Spaces secrets to point to the backend.
|
| 85 |
◦ Ensure the backend implements API key authentication for endpoints like /processes/action and /emergency/stop.
|
| 86 |
-
Security Considerations
|
| 87 |
• API Key Authentication:
|
| 88 |
◦ The backend (app/main.py) must validate the Authorization header (e.g., Bearer ).
|
| 89 |
◦ Update the backend to include middleware for API key verification:
from fastapi import Depends, HTTPException, Security
|
|
@@ -104,7 +105,7 @@ Security Considerations
|
|
| 104 |
• Rate Limiting:
|
| 105 |
◦ Implement rate limiting in the Gradio UI (e.g., using the ratelimit library) to prevent overwhelming the backend.
|
| 106 |
◦ Consider adding rate limiting to the FastAPI backend using slowapi.
|
| 107 |
-
Testing
|
| 108 |
To ensure the UI works correctly, test it locally before deploying:
|
| 109 |
1 Install Testing Dependencies:
pip install pytest pytest-httpx pytest-asyncio
|
| 110 |
2
|
|
@@ -138,7 +139,7 @@ To ensure the UI works correctly, test it locally before deploying:
|
|
| 138 |
◦ Start the FastAPI backend: uvicorn app.main:app --host 0.0.0.0 --port 8000
|
| 139 |
◦ Run the Gradio UI: python app.py
|
| 140 |
◦ Verify all tabs and functionality in the browser.
|
| 141 |
-
Troubleshooting
|
| 142 |
• Backend Unreachable:
|
| 143 |
◦ Ensure the FastAPI backend is running and accessible at API_BASE_URL.
|
| 144 |
◦ Check network connectivity and firewall settings.
|
|
@@ -150,17 +151,17 @@ Troubleshooting
|
|
| 150 |
◦ Review ui.log for error messages.
|
| 151 |
◦ Ensure gradio==5.35.0 is installed correctly.
|
| 152 |
◦ Check Hugging Face Spaces logs for deployment issues.
|
| 153 |
-
Contributing
|
| 154 |
-
Contributions are welcome! To contribute:
|
| 155 |
1 Fork the repository.
|
| 156 |
2 Create a feature branch: git checkout -b feature/your-feature.
|
| 157 |
3 Commit changes: git commit -m "Add your feature".
|
| 158 |
4 Push to the branch: git push origin feature/your-feature.
|
| 159 |
5 Open a pull request on the Hugging Face Space repository.
|
| 160 |
Please include tests and follow PEP 8 guidelines.
|
| 161 |
-
License
|
| 162 |
This project is licensed under the MIT License. See the LICENSE file for details.
|
| 163 |
-
Acknowledgments
|
| 164 |
• Built with Gradio for the UI and FastAPI for the backend.
|
| 165 |
• Designed for cybersecurity and system performance monitoring on HP Z440 workstations.
|
| 166 |
• Hosted on Hugging Face Spaces.
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# ProMonitor 🌖
|
| 14 |
+
|
| 15 |
A Gradio-based web interface for monitoring and managing system resources on an HP Z440 workstation, designed for cybersecurity and system performance monitoring. ProMonitor interacts with a FastAPI backend (running at http://localhost:8000 by default) to provide real-time metrics, historical data, resource limit management, process control, and emergency stop functionality.
|
| 16 |
• Title: ProMonitor
|
| 17 |
• Emoji: 🌖
|
|
|
|
| 19 |
• SDK: Gradio (version 5.35.0)
|
| 20 |
• App File: app.py
|
| 21 |
• License: MIT
|
| 22 |
+
## Features
|
| 23 |
ProMonitor offers a comprehensive interface for system monitoring and management, with a focus on security and usability:
|
| 24 |
• Dashboard: Displays real-time system metrics (CPU, memory, GPU, disk usage) and health status (Healthy, Degraded, Unhealthy) with a refreshable view.
|
| 25 |
• History: Visualizes historical CPU, memory, and GPU usage over a user-specified time range (1–1440 minutes) using tables and line charts.
|
|
|
|
| 28 |
• Processes: Lists top CPU- and memory-intensive processes, with options to kill, suspend, or resume processes (secured with API key).
|
| 29 |
• System Info: Provides static system information (platform, CPU, memory, disk, GPU) in a structured format.
|
| 30 |
• Emergency Stop: Enables termination of high-memory processes with confirmation and API key authentication.
|
| 31 |
+
## Prerequisites
|
| 32 |
• Python: 3.10+ (as specified in .hf_space.yml)
|
| 33 |
• FastAPI Backend: The backend (app/main.py) must be running and accessible (default: http://localhost:8000).
|
| 34 |
• Dependencies: Listed in requirements.txt (see Installation).
|
| 35 |
+
## Installation
|
| 36 |
1 Clone the Repository:
git clone https://huggingface.co/spaces//ProMonitor
|
| 37 |
2 cd ProMonitor
|
| 38 |
3
|
|
|
|
| 52 |
10
If the backend is hosted elsewhere, update API_BASE_URL in .env.
|
| 53 |
11 Run the UI: Launch the Gradio app:
python app.py
|
| 54 |
12
The UI will be available at http://localhost:7860.
|
| 55 |
+
# Usage
|
| 56 |
1 Access the UI: Open http://localhost:7860 in a web browser to access the ProMonitor interface.
|
| 57 |
2 Navigate Tabs:
|
| 58 |
◦ Dashboard: View real-time metrics and health status. Click “Refresh Metrics” to update.
|
|
|
|
| 65 |
3 Secure Actions:
|
| 66 |
◦ For process actions and emergency stop, provide the API key in the respective input fields.
|
| 67 |
◦ Ensure the backend validates the API key to prevent unauthorized access.
|
| 68 |
+
## Deployment on Hugging Face Spaces
|
| 69 |
+
### ProMonitor is configured for deployment on Hugging Face Spaces with the following setup:
|
| 70 |
1 Push to Hugging Face Spaces:
|
| 71 |
◦ Create a new Space on Hugging Face: https://huggingface.co/new
|
| 72 |
◦ Select “Gradio” as the SDK and configure it as a public or private Space.
|
|
|
|
| 84 |
◦ The FastAPI backend must be hosted separately (e.g., on another Hugging Face Space, AWS, or a local server with tunneling via ngrok).
|
| 85 |
◦ Update API_BASE_URL in Spaces secrets to point to the backend.
|
| 86 |
◦ Ensure the backend implements API key authentication for endpoints like /processes/action and /emergency/stop.
|
| 87 |
+
## Security Considerations
|
| 88 |
• API Key Authentication:
|
| 89 |
◦ The backend (app/main.py) must validate the Authorization header (e.g., Bearer ).
|
| 90 |
◦ Update the backend to include middleware for API key verification:
from fastapi import Depends, HTTPException, Security
|
|
|
|
| 105 |
• Rate Limiting:
|
| 106 |
◦ Implement rate limiting in the Gradio UI (e.g., using the ratelimit library) to prevent overwhelming the backend.
|
| 107 |
◦ Consider adding rate limiting to the FastAPI backend using slowapi.
|
| 108 |
+
## Testing
|
| 109 |
To ensure the UI works correctly, test it locally before deploying:
|
| 110 |
1 Install Testing Dependencies:
pip install pytest pytest-httpx pytest-asyncio
|
| 111 |
2
|
|
|
|
| 139 |
◦ Start the FastAPI backend: uvicorn app.main:app --host 0.0.0.0 --port 8000
|
| 140 |
◦ Run the Gradio UI: python app.py
|
| 141 |
◦ Verify all tabs and functionality in the browser.
|
| 142 |
+
## Troubleshooting
|
| 143 |
• Backend Unreachable:
|
| 144 |
◦ Ensure the FastAPI backend is running and accessible at API_BASE_URL.
|
| 145 |
◦ Check network connectivity and firewall settings.
|
|
|
|
| 151 |
◦ Review ui.log for error messages.
|
| 152 |
◦ Ensure gradio==5.35.0 is installed correctly.
|
| 153 |
◦ Check Hugging Face Spaces logs for deployment issues.
|
| 154 |
+
## Contributing
|
| 155 |
+
### Contributions are welcome! To contribute:
|
| 156 |
1 Fork the repository.
|
| 157 |
2 Create a feature branch: git checkout -b feature/your-feature.
|
| 158 |
3 Commit changes: git commit -m "Add your feature".
|
| 159 |
4 Push to the branch: git push origin feature/your-feature.
|
| 160 |
5 Open a pull request on the Hugging Face Space repository.
|
| 161 |
Please include tests and follow PEP 8 guidelines.
|
| 162 |
+
## License
|
| 163 |
This project is licensed under the MIT License. See the LICENSE file for details.
|
| 164 |
+
## Acknowledgments
|
| 165 |
• Built with Gradio for the UI and FastAPI for the backend.
|
| 166 |
• Designed for cybersecurity and system performance monitoring on HP Z440 workstations.
|
| 167 |
• Hosted on Hugging Face Spaces.
|