Spaces:
Paused
Paused
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,26 +1,21 @@
|
|
| 1 |
|
| 2 |
# ProMonitor 🌖
|
| 3 |
|
| 4 |
-
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.
|
| 5 |
-
• Title: ProMonitor
|
| 6 |
-
• Emoji: 🌖
|
| 7 |
-
• Color Scheme: Red to Blue
|
| 8 |
-
• SDK: Gradio (version 5.35.0)
|
| 9 |
-
• App File: app.py
|
| 10 |
-
• License: MIT
|
| 11 |
## Features
|
| 12 |
ProMonitor offers a comprehensive interface for system monitoring and management, with a focus on security and usability:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 20 |
## Prerequisites
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
## Installation
|
| 25 |
1 Clone the Repository:
git clone https://huggingface.co/spaces//ProMonitor
|
| 26 |
2 cd ProMonitor
|
|
@@ -41,6 +36,7 @@ ProMonitor offers a comprehensive interface for system monitoring and management
|
|
| 41 |
10
If the backend is hosted elsewhere, update API_BASE_URL in .env.
|
| 42 |
11 Run the UI: Launch the Gradio app:
python app.py
|
| 43 |
12
The UI will be available at http://localhost:7860.
|
|
|
|
| 44 |
# Usage
|
| 45 |
1 Access the UI: Open http://localhost:7860 in a web browser to access the ProMonitor interface.
|
| 46 |
2 Navigate Tabs:
|
|
@@ -54,6 +50,7 @@ ProMonitor offers a comprehensive interface for system monitoring and management
|
|
| 54 |
3 Secure Actions:
|
| 55 |
◦ For process actions and emergency stop, provide the API key in the respective input fields.
|
| 56 |
◦ Ensure the backend validates the API key to prevent unauthorized access.
|
|
|
|
| 57 |
## Deployment on Hugging Face Spaces
|
| 58 |
### ProMonitor is configured for deployment on Hugging Face Spaces with the following setup:
|
| 59 |
1 Push to Hugging Face Spaces:
|
|
@@ -73,6 +70,7 @@ ProMonitor offers a comprehensive interface for system monitoring and management
|
|
| 73 |
◦ The FastAPI backend must be hosted separately (e.g., on another Hugging Face Space, AWS, or a local server with tunneling via ngrok).
|
| 74 |
◦ Update API_BASE_URL in Spaces secrets to point to the backend.
|
| 75 |
◦ Ensure the backend implements API key authentication for endpoints like /processes/action and /emergency/stop.
|
|
|
|
| 76 |
## Security Considerations
|
| 77 |
• API Key Authentication:
|
| 78 |
◦ The backend (app/main.py) must validate the Authorization header (e.g., Bearer ).
|
|
@@ -94,6 +92,7 @@ ProMonitor offers a comprehensive interface for system monitoring and management
|
|
| 94 |
• Rate Limiting:
|
| 95 |
◦ Implement rate limiting in the Gradio UI (e.g., using the ratelimit library) to prevent overwhelming the backend.
|
| 96 |
◦ Consider adding rate limiting to the FastAPI backend using slowapi.
|
|
|
|
| 97 |
## Testing
|
| 98 |
To ensure the UI works correctly, test it locally before deploying:
|
| 99 |
1 Install Testing Dependencies:
pip install pytest pytest-httpx pytest-asyncio
|
|
@@ -128,18 +127,20 @@ To ensure the UI works correctly, test it locally before deploying:
|
|
| 128 |
◦ Start the FastAPI backend: uvicorn app.main:app --host 0.0.0.0 --port 8000
|
| 129 |
◦ Run the Gradio UI: python app.py
|
| 130 |
◦ Verify all tabs and functionality in the browser.
|
|
|
|
| 131 |
## Troubleshooting
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
|
|
|
| 143 |
## Contributing
|
| 144 |
### Contributions are welcome! To contribute:
|
| 145 |
1 Fork the repository.
|
|
@@ -148,10 +149,12 @@ To ensure the UI works correctly, test it locally before deploying:
|
|
| 148 |
4 Push to the branch: git push origin feature/your-feature.
|
| 149 |
5 Open a pull request on the Hugging Face Space repository.
|
| 150 |
Please include tests and follow PEP 8 guidelines.
|
|
|
|
| 151 |
## License
|
| 152 |
This project is licensed under the MIT License. See the LICENSE file for details.
|
|
|
|
| 153 |
## Acknowledgments
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
|
|
|
|
| 1 |
|
| 2 |
# ProMonitor 🌖
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
## Features
|
| 5 |
ProMonitor offers a comprehensive interface for system monitoring and management, with a focus on security and usability:
|
| 6 |
+
- Dashboard: Displays real-time system metrics (CPU, memory, GPU, disk usage) and health status (Healthy, Degraded, Unhealthy) with a refreshable view.
|
| 7 |
+
- History: Visualizes historical CPU, memory, and GPU usage over a user-specified time range (1–1440 minutes) using tables and line charts.
|
| 8 |
+
- Resource Limits: Allows setting and viewing CPU, memory, and GPU power limits, with validation and feedback.
|
| 9 |
+
- Alerts: Shows active system alerts with severity levels (critical, warning) in a clear, color-coded table.
|
| 10 |
+
- Processes: Lists top CPU- and memory-intensive processes, with options to kill, suspend, or resume processes (secured with API key).
|
| 11 |
+
- System Info: Provides static system information (platform, CPU, memory, disk, GPU) in a structured format.
|
| 12 |
+
- Emergency Stop: Enables termination of high-memory processes with confirmation and API key authentication.
|
| 13 |
+
|
| 14 |
## Prerequisites
|
| 15 |
+
- Python: 3.10+ (as specified in .hf_space.yml)
|
| 16 |
+
- FastAPI Backend: The backend (app/main.py) must be running and accessible (default: http://localhost:8000).
|
| 17 |
+
- Dependencies: Listed in requirements.txt (see Installation).
|
| 18 |
+
|
| 19 |
## Installation
|
| 20 |
1 Clone the Repository:
git clone https://huggingface.co/spaces//ProMonitor
|
| 21 |
2 cd ProMonitor
|
|
|
|
| 36 |
10
If the backend is hosted elsewhere, update API_BASE_URL in .env.
|
| 37 |
11 Run the UI: Launch the Gradio app:
python app.py
|
| 38 |
12
The UI will be available at http://localhost:7860.
|
| 39 |
+
|
| 40 |
# Usage
|
| 41 |
1 Access the UI: Open http://localhost:7860 in a web browser to access the ProMonitor interface.
|
| 42 |
2 Navigate Tabs:
|
|
|
|
| 50 |
3 Secure Actions:
|
| 51 |
◦ For process actions and emergency stop, provide the API key in the respective input fields.
|
| 52 |
◦ Ensure the backend validates the API key to prevent unauthorized access.
|
| 53 |
+
|
| 54 |
## Deployment on Hugging Face Spaces
|
| 55 |
### ProMonitor is configured for deployment on Hugging Face Spaces with the following setup:
|
| 56 |
1 Push to Hugging Face Spaces:
|
|
|
|
| 70 |
◦ The FastAPI backend must be hosted separately (e.g., on another Hugging Face Space, AWS, or a local server with tunneling via ngrok).
|
| 71 |
◦ Update API_BASE_URL in Spaces secrets to point to the backend.
|
| 72 |
◦ Ensure the backend implements API key authentication for endpoints like /processes/action and /emergency/stop.
|
| 73 |
+
|
| 74 |
## Security Considerations
|
| 75 |
• API Key Authentication:
|
| 76 |
◦ The backend (app/main.py) must validate the Authorization header (e.g., Bearer ).
|
|
|
|
| 92 |
• Rate Limiting:
|
| 93 |
◦ Implement rate limiting in the Gradio UI (e.g., using the ratelimit library) to prevent overwhelming the backend.
|
| 94 |
◦ Consider adding rate limiting to the FastAPI backend using slowapi.
|
| 95 |
+
|
| 96 |
## Testing
|
| 97 |
To ensure the UI works correctly, test it locally before deploying:
|
| 98 |
1 Install Testing Dependencies:
pip install pytest pytest-httpx pytest-asyncio
|
|
|
|
| 127 |
◦ Start the FastAPI backend: uvicorn app.main:app --host 0.0.0.0 --port 8000
|
| 128 |
◦ Run the Gradio UI: python app.py
|
| 129 |
◦ Verify all tabs and functionality in the browser.
|
| 130 |
+
|
| 131 |
## Troubleshooting
|
| 132 |
+
- Backend Unreachable:
|
| 133 |
+
- Ensure the FastAPI backend is running and accessible at API_BASE_URL.
|
| 134 |
+
- Check network connectivity and firewall settings.
|
| 135 |
+
- Use a tunneling service like ngrok for local testing: ngrok http 8000.
|
| 136 |
+
- API Key Errors:
|
| 137 |
+
- Verify the API_KEY matches the backend’s expected value.
|
| 138 |
+
- Check backend logs for authentication errors.
|
| 139 |
+
- Gradio UI Issues:
|
| 140 |
+
- Review ui.log for error messages.
|
| 141 |
+
- Ensure gradio==5.35.0 is installed correctly.
|
| 142 |
+
- Check Hugging Face Spaces logs for deployment issues.
|
| 143 |
+
|
| 144 |
## Contributing
|
| 145 |
### Contributions are welcome! To contribute:
|
| 146 |
1 Fork the repository.
|
|
|
|
| 149 |
4 Push to the branch: git push origin feature/your-feature.
|
| 150 |
5 Open a pull request on the Hugging Face Space repository.
|
| 151 |
Please include tests and follow PEP 8 guidelines.
|
| 152 |
+
|
| 153 |
## License
|
| 154 |
This project is licensed under the MIT License. See the LICENSE file for details.
|
| 155 |
+
|
| 156 |
## Acknowledgments
|
| 157 |
+
- Built with Gradio for the UI and FastAPI for the backend.
|
| 158 |
+
- Designed for cybersecurity and system performance monitoring on HP Z440 workstations.
|
| 159 |
+
- Hosted on Hugging Face Spaces.
|
| 160 |
|