Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -4,7 +4,11 @@ A comprehensive system monitoring service with a modern web dashboard for real-t
|
||||
|
||||
## 🌟 New: Web Dashboard
|
||||
|
||||
Access the interactive web dashboard at `http://localhost:5000` featuring:
|
||||
Access the interactive web dashboard:
|
||||
- **Development**: `http://localhost:5000`
|
||||
- **Release/Production**: `http://localhost:24142`
|
||||
|
||||
Features:
|
||||
|
||||
- **Real-time Monitoring**: Live updates every 15 seconds via SignalR
|
||||
- **Responsive Design**: Mobile-friendly interface built with Tailwind CSS
|
||||
@@ -90,14 +94,22 @@ For security reasons, the system control feature is hidden by default. To access
|
||||
|
||||
## 📡 API Endpoints
|
||||
|
||||
The service runs a web server on `http://localhost:5000` providing:
|
||||
The service runs a web server providing:
|
||||
- **Development**: `http://localhost:5000`
|
||||
- **Release/Production**: `http://localhost:24142`
|
||||
|
||||
Both environments provide:
|
||||
|
||||
### Web Interface
|
||||
- `GET /` - **Main Dashboard** - Interactive web interface for monitoring
|
||||
- `GET /swagger` - **API Documentation** - Interactive API explorer and documentation
|
||||
|
||||
### REST API
|
||||
All API endpoints are available at `http://localhost:5000/api/[endpoint]`:
|
||||
All API endpoints are available at:
|
||||
- **Development**: `http://localhost:5000/api/[endpoint]`
|
||||
- **Release/Production**: `http://localhost:24142/api/[endpoint]`
|
||||
|
||||
Endpoints:
|
||||
|
||||
### System Information
|
||||
- `GET /api/resource/usage` - **Complete resource overview** - All monitoring data in one call
|
||||
@@ -149,7 +161,11 @@ All API endpoints are available at `http://localhost:5000/api/[endpoint]`:
|
||||
cd C:\Work\DEV\ResourceUsageAPI
|
||||
dotnet run --configuration Release
|
||||
```
|
||||
Then open your browser to `http://localhost:5000` for the interactive dashboard.
|
||||
Then open your browser to:
|
||||
- Development: `http://localhost:5000`
|
||||
- Release/Production: `http://localhost:24142`
|
||||
|
||||
for the interactive dashboard.
|
||||
|
||||
### Option 2: Windows Service (Production)
|
||||
```powershell
|
||||
@@ -221,8 +237,10 @@ For development and testing:
|
||||
# Run in development mode with hot reload
|
||||
dotnet run --environment Development
|
||||
|
||||
# Access the dashboard at http://localhost:5000
|
||||
# Access Swagger API documentation at http://localhost:5000/swagger
|
||||
# Access the dashboard at:
|
||||
# - Development: http://localhost:5000
|
||||
# - Release/Production: http://localhost:24142
|
||||
# Access Swagger API documentation at the same URL + /swagger
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
@@ -230,7 +248,7 @@ dotnet run --environment Development
|
||||
- **Service won't start**: Check the logs in the `logs/` directory
|
||||
- **No GPU data**: Make sure you have an NVIDIA GPU and drivers installed
|
||||
- **High CPU usage**: Adjust monitoring intervals in `appsettings.json`
|
||||
- **Web dashboard not accessible**: Verify firewall settings and ensure port 5000 is available
|
||||
- **Web dashboard not accessible**: Verify firewall settings and ensure the appropriate port is available (5000 for development, 24142 for release/production)
|
||||
- **Game detection issues**: Check if games are running from standard installation directories
|
||||
- **API errors**: Verify endpoints using Swagger documentation at `/swagger`
|
||||
- **Performance issues**: Consider increasing `UpdateIntervalMs` in configuration
|
||||
@@ -468,23 +486,27 @@ The service supports real-time alert notifications via Telegram bot. To set up T
|
||||
## 🔧 PowerShell Usage Examples
|
||||
|
||||
```powershell
|
||||
# Access the web dashboard
|
||||
# Access the web dashboard (adjust port based on environment)
|
||||
# Development:
|
||||
Start-Process "http://localhost:5000"
|
||||
# Release/Production:
|
||||
Start-Process "http://localhost:24142"
|
||||
|
||||
# Get complete resource overview
|
||||
$resources = Invoke-RestMethod -Uri "http://localhost:5000/api/resource/usage"
|
||||
# Get complete resource overview (adjust URL as needed)
|
||||
$baseUrl = "http://localhost:24142" # Use 5000 for development
|
||||
$resources = Invoke-RestMethod -Uri "$baseUrl/api/resource/usage"
|
||||
Write-Host "CPU: $($resources.cpu.usage.ToString('F1'))%"
|
||||
Write-Host "Memory: $($resources.memory.usagePercentage.ToString('F1'))%"
|
||||
Write-Host "GPU: $($resources.gpu.usage)%"
|
||||
|
||||
# Get system information
|
||||
$systemInfo = Invoke-RestMethod -Uri "http://localhost:5000/api/resource/system-info"
|
||||
$systemInfo = Invoke-RestMethod -Uri "$baseUrl/api/resource/system-info"
|
||||
Write-Host "Machine: $($systemInfo.machineName)"
|
||||
Write-Host "OS: $($systemInfo.osVersion)"
|
||||
Write-Host "CPU: $($systemInfo.cpuName)"
|
||||
|
||||
# Get disk usage
|
||||
$disks = Invoke-RestMethod -Uri "http://localhost:5000/api/resource/disks"
|
||||
$disks = Invoke-RestMethod -Uri "$baseUrl/api/resource/disks"
|
||||
foreach ($disk in $disks) {
|
||||
$freeGB = [math]::Round($disk.freeSpace / 1GB, 1)
|
||||
$totalGB = [math]::Round($disk.totalSize / 1GB, 1)
|
||||
|
||||
Reference in New Issue
Block a user