diff --git a/Configuration/MonitoringSettings.cs b/Configuration/MonitoringSettings.cs index 3fd27e9..cbdb1b8 100644 --- a/Configuration/MonitoringSettings.cs +++ b/Configuration/MonitoringSettings.cs @@ -38,6 +38,8 @@ namespace ResourceMonitorService.Configuration new() { Component = "CPUTemp", WarningThreshold = 75, CriticalThreshold = 85, DurationSeconds = 60 }, new() { Component = "GPUTemp", WarningThreshold = 80, CriticalThreshold = 90, DurationSeconds = 60 } }; + + public TelegramSettings Telegram { get; set; } = new(); } public class AlertThresholdConfig @@ -73,4 +75,16 @@ namespace ResourceMonitorService.Configuration public bool EnableConsoleLogging { get; set; } = true; public bool EnablePerformanceLogging { get; set; } = false; } + + public class TelegramSettings + { + public bool IsEnabled { get; set; } = false; + public string BotToken { get; set; } = string.Empty; + public List ChatIds { get; set; } = new(); + public bool SendWarningAlerts { get; set; } = true; + public bool SendCriticalAlerts { get; set; } = true; + public bool SendResolutionNotifications { get; set; } = true; + public string MessageTemplate { get; set; } = "🚨 *{Level} Alert*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° {Timestamp:yyyy-MM-dd HH:mm:ss}"; + public string ResolutionTemplate { get; set; } = "āœ… *Alert Resolved*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° Resolved at {ResolvedAt:yyyy-MM-dd HH:mm:ss}"; + } } diff --git a/Program.cs b/Program.cs index cbcea26..a9d2c98 100644 --- a/Program.cs +++ b/Program.cs @@ -51,6 +51,7 @@ namespace ResourceMonitorService services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); // Register the main worker service diff --git a/README.md b/README.md index 5c313cd..7f26acf 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ A comprehensive system monitoring service specifically designed for Windows VMs - **Game Detection**: Multi-platform game detection with fullscreen monitoring and configurable root folders - **Process Management**: View top processes with CPU/memory percentages, terminate processes via API - **Smart Alerting**: Duration-based alerting to prevent false positives +- **Telegram Bot Integration**: Real-time alerts via Telegram bot with customizable notifications - **System Control**: Remote shutdown/restart capabilities - **Health Monitoring**: Comprehensive health checks and uptime tracking - **Real-time Metrics**: CPU usage calculation and memory percentage tracking for processes @@ -57,6 +58,10 @@ The service runs on `http://localhost:5000` by default and provides the followin - `POST /api/alerts/{alertId}/resolve` - Manually resolve an alert - `GET /api/alerts/enabled` - Check if alerting is enabled +### Telegram Bot Integration +- `GET /api/telegram/status` - Check Telegram bot status and connection +- `POST /api/telegram/test` - Send a test alert to verify bot configuration + ### System Control - `POST /api/process/kill` - Terminate a process (requires process ID and optional force flag) - `POST /api/system/shutdown` - Shutdown, restart, or cancel system operations @@ -180,6 +185,40 @@ D:\Games\The Witcher 3\witcher3.exe - Use absolute paths (e.g., `C:\Games`, not `Games`) - Root folders are checked in order, so prioritize most common locations first +### Telegram Bot Alerts + +The service supports real-time alert notifications via Telegram bot. To set up Telegram alerts: + +1. **Create a Telegram Bot** - Contact `@BotFather` on Telegram and create a new bot +2. **Get Chat ID** - Send a message to your bot, then visit `https://api.telegram.org/bot/getUpdates` +3. **Configure Settings** - Add Telegram configuration to your `appsettings.json`: + +```json +{ + "MonitoringSettings": { + "Telegram": { + "IsEnabled": true, + "BotToken": "123456789:ABCdefGHIjklMNOpqrSTUvwxyz", + "ChatIds": [123456789, -987654321], + "SendWarningAlerts": true, + "SendCriticalAlerts": true, + "SendResolutionNotifications": true, + "MessageTemplate": "🚨 *{Level} Alert*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° {Timestamp}", + "ResolutionTemplate": "āœ… *Alert Resolved*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° Resolved at {ResolvedAt}" + } + } +} +``` + +**Features:** +- **Multiple Chats**: Send alerts to multiple users/groups by adding chat IDs +- **Customizable Templates**: Modify message format with placeholders for alert data +- **Alert Filtering**: Choose which alert levels to send (Warning/Critical) +- **Silent Notifications**: Warning alerts are sent silently, critical alerts with sound +- **Resolution Notifications**: Optional notifications when alerts are resolved + +šŸ“‹ For detailed setup instructions, see [TELEGRAM_SETUP.md](TELEGRAM_SETUP.md) + ## šŸ“Š Example API Responses ### Health Check diff --git a/ResourceMonitorService.csproj b/ResourceMonitorService.csproj index 43cc2ed..8eb14ba 100644 --- a/ResourceMonitorService.csproj +++ b/ResourceMonitorService.csproj @@ -17,5 +17,6 @@ + diff --git a/Services/AlertService.cs b/Services/AlertService.cs index 6b6adc7..5a32520 100644 --- a/Services/AlertService.cs +++ b/Services/AlertService.cs @@ -21,6 +21,7 @@ namespace ResourceMonitorService.Services { private readonly ILogger _logger; private readonly MonitoringSettings _settings; + private readonly ITelegramNotificationService _telegramService; private readonly ConcurrentDictionary _activeAlerts; private readonly ConcurrentQueue _alertHistory; private readonly Dictionary _lastAlertTime; @@ -29,10 +30,11 @@ namespace ResourceMonitorService.Services public event EventHandler? AlertTriggered; public event EventHandler? AlertResolved; - public AlertService(ILogger logger, IOptions settings) + public AlertService(ILogger logger, IOptions settings, ITelegramNotificationService telegramService) { _logger = logger; _settings = settings.Value; + _telegramService = telegramService; _activeAlerts = new ConcurrentDictionary(); _alertHistory = new ConcurrentQueue(); _lastAlertTime = new Dictionary(); @@ -183,6 +185,19 @@ namespace ResourceMonitorService.Services _logger.LogWarning("Alert triggered: {Message}", alert.Message); AlertTriggered?.Invoke(this, alert); + + // Send Telegram notification + _ = Task.Run(async () => + { + try + { + await _telegramService.SendAlertAsync(alert); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to send Telegram alert notification"); + } + }); } else { @@ -264,6 +279,19 @@ namespace ResourceMonitorService.Services _logger.LogInformation("Alert resolved: {Message}", resolvedAlert.Message); AlertResolved?.Invoke(this, resolvedAlert); + + // Send Telegram resolution notification + _ = Task.Run(async () => + { + try + { + await _telegramService.SendAlertResolvedAsync(resolvedAlert); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to send Telegram resolution notification"); + } + }); } } } diff --git a/Services/GameDetectionService.cs b/Services/GameDetectionService.cs index 2e60e9e..080a38e 100644 --- a/Services/GameDetectionService.cs +++ b/Services/GameDetectionService.cs @@ -154,8 +154,11 @@ namespace ResourceMonitorService.Services return false; // Get screen dimensions - var screenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; - var screenHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; + var primaryScreen = System.Windows.Forms.Screen.PrimaryScreen; + if (primaryScreen == null) + return false; + var screenWidth = primaryScreen.Bounds.Width; + var screenHeight = primaryScreen.Bounds.Height; // Check if window covers the entire screen var windowWidth = rect.Right - rect.Left; diff --git a/Services/TelegramNotificationService.cs b/Services/TelegramNotificationService.cs new file mode 100644 index 0000000..15729e2 --- /dev/null +++ b/Services/TelegramNotificationService.cs @@ -0,0 +1,206 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using ResourceMonitorService.Configuration; +using ResourceMonitorService.Models; +using Telegram.Bot; +using Telegram.Bot.Exceptions; +using Telegram.Bot.Types.Enums; + +namespace ResourceMonitorService.Services +{ + public interface ITelegramNotificationService + { + Task SendAlertAsync(Alert alert); + Task SendAlertResolvedAsync(Alert alert); + Task IsEnabledAsync(); + Task TestConnectionAsync(); + } + + public class TelegramNotificationService : ITelegramNotificationService + { + private readonly ILogger _logger; + private readonly TelegramSettings _telegramSettings; + private readonly ITelegramBotClient? _botClient; + + public TelegramNotificationService( + ILogger logger, + IOptions settings) + { + _logger = logger; + _telegramSettings = settings.Value.Telegram; + + if (_telegramSettings.IsEnabled && !string.IsNullOrEmpty(_telegramSettings.BotToken)) + { + try + { + _botClient = new TelegramBotClient(_telegramSettings.BotToken); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to initialize Telegram bot client"); + } + } + } + + public async Task IsEnabledAsync() + { + return await Task.FromResult(_telegramSettings.IsEnabled && _botClient != null); + } + + public async Task TestConnectionAsync() + { + if (_botClient == null || !_telegramSettings.IsEnabled) + return false; + + try + { + var me = await _botClient.GetMe(); + _logger.LogInformation("Telegram bot connected successfully: @{Username}", me.Username); + return true; + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to connect to Telegram bot"); + return false; + } + } + + public async Task SendAlertAsync(Alert alert) + { + if (_botClient == null || !_telegramSettings.IsEnabled) + return; + + // Check if we should send this type of alert + if ((alert.Level == "Warning" && !_telegramSettings.SendWarningAlerts) || + (alert.Level == "Critical" && !_telegramSettings.SendCriticalAlerts)) + { + return; + } + + var message = FormatAlertMessage(alert, _telegramSettings.MessageTemplate); + + foreach (var chatId in _telegramSettings.ChatIds) + { + try + { + await _botClient.SendMessage( + chatId: chatId, + text: message, + parseMode: ParseMode.Markdown, + disableNotification: alert.Level == "Warning" // Don't ping for warnings + ); + + _logger.LogInformation("Telegram alert sent to chat {ChatId}: {AlertLevel} - {Component}", + chatId, alert.Level, alert.Component); + } + catch (ApiRequestException ex) + { + _logger.LogError(ex, "Failed to send Telegram alert to chat {ChatId}: {ErrorCode} - {Description}", + chatId, ex.ErrorCode, ex.Message); + } + catch (Exception ex) + { + _logger.LogError(ex, "Unexpected error sending Telegram alert to chat {ChatId}", chatId); + } + } + } + + public async Task SendAlertResolvedAsync(Alert alert) + { + if (_botClient == null || !_telegramSettings.IsEnabled || !_telegramSettings.SendResolutionNotifications) + return; + + var message = FormatAlertMessage(alert, _telegramSettings.ResolutionTemplate); + + foreach (var chatId in _telegramSettings.ChatIds) + { + try + { + await _botClient.SendMessage( + chatId: chatId, + text: message, + parseMode: ParseMode.Markdown, + disableNotification: true // Don't ping for resolutions + ); + + _logger.LogInformation("Telegram resolution notification sent to chat {ChatId}: {Component}", + chatId, alert.Component); + } + catch (ApiRequestException ex) + { + _logger.LogError(ex, "Failed to send Telegram resolution to chat {ChatId}: {ErrorCode} - {Description}", + chatId, ex.ErrorCode, ex.Message); + } + catch (Exception ex) + { + _logger.LogError(ex, "Unexpected error sending Telegram resolution to chat {ChatId}", chatId); + } + } + } + + private string FormatAlertMessage(Alert alert, string template) + { + var levelIcon = alert.Level switch + { + "Critical" => "šŸ”“", + "Warning" => "āš ļø", + _ => "ā„¹ļø" + }; + + var componentIcon = alert.Component switch + { + "CPU" => "šŸ–„ļø", + "CPUTemp" => "šŸŒ”ļø", + "Memory" => "šŸ’¾", + "GPU" => "šŸŽ®", + "GPUTemp" => "šŸŒ”ļø", + var disk when disk.StartsWith("Disk") => "šŸ’½", + var process when process.StartsWith("ProcessMemory") => "āš™ļø", + _ => "šŸ“Š" + }; + + // Replace template placeholders + var message = template + .Replace("{Level}", alert.Level) + .Replace("{Component}", alert.Component) + .Replace("{Message}", EscapeMarkdown(alert.Message)) + .Replace("{Timestamp}", alert.Timestamp.ToString("yyyy-MM-dd HH:mm:ss")) + .Replace("{CurrentValue}", alert.CurrentValue.ToString("F1")) + .Replace("{ThresholdValue}", alert.ThresholdValue.ToString("F1")); + + if (alert.ResolvedAt.HasValue) + { + message = message.Replace("{ResolvedAt}", alert.ResolvedAt.Value.ToString("yyyy-MM-dd HH:mm:ss")); + } + + // Add icons + message = $"{levelIcon} {componentIcon} {message}"; + + return message; + } + + private static string EscapeMarkdown(string text) + { + // Escape special Markdown characters + return text + .Replace("_", "\\_") + .Replace("*", "\\*") + .Replace("[", "\\[") + .Replace("]", "\\]") + .Replace("(", "\\(") + .Replace(")", "\\)") + .Replace("~", "\\~") + .Replace("`", "\\`") + .Replace(">", "\\>") + .Replace("#", "\\#") + .Replace("+", "\\+") + .Replace("-", "\\-") + .Replace("=", "\\=") + .Replace("|", "\\|") + .Replace("{", "\\{") + .Replace("}", "\\}") + .Replace(".", "\\.") + .Replace("!", "\\!"); + } + } +} diff --git a/TELEGRAM_SETUP.md b/TELEGRAM_SETUP.md new file mode 100644 index 0000000..359a221 --- /dev/null +++ b/TELEGRAM_SETUP.md @@ -0,0 +1,196 @@ +# Telegram Bot Alert Setup Guide + +The Resource Monitor Service supports sending alerts via Telegram bot. This allows you to receive real-time notifications about system resource warnings and critical alerts directly to your Telegram chat. + +## Prerequisites + +1. **Create a Telegram Bot**: + - Open Telegram and search for `@BotFather` + - Send `/newbot` command + - Follow the instructions to create a new bot + - Save the Bot Token (format: `123456789:ABCdefGHIjklMNOpqrSTUvwxyz`) + +2. **Get Your Chat ID**: + - Send a message to your bot + - Visit: `https://api.telegram.org/bot/getUpdates` + - Find your chat ID in the response (it's a number, can be negative for groups) + +## Configuration + +### 1. Edit appsettings.json + +Add or update the Telegram configuration in your `appsettings.json`: + +```json +{ + "MonitoringSettings": { + // ... other settings ... + "Telegram": { + "IsEnabled": true, + "BotToken": "123456789:ABCdefGHIjklMNOpqrSTUvwxyz", + "ChatIds": [12345678, -987654321], + "SendWarningAlerts": true, + "SendCriticalAlerts": true, + "SendResolutionNotifications": true, + "MessageTemplate": "🚨 *{Level} Alert*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° {Timestamp}", + "ResolutionTemplate": "āœ… *Alert Resolved*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° Resolved at {ResolvedAt}" + } + } +} +``` + +### 2. Configuration Options + +| Setting | Description | Default | +|---------|-------------|---------| +| `IsEnabled` | Enable/disable Telegram notifications | `false` | +| `BotToken` | Your Telegram bot token from BotFather | `""` | +| `ChatIds` | Array of chat IDs to send alerts to | `[]` | +| `SendWarningAlerts` | Send warning level alerts | `true` | +| `SendCriticalAlerts` | Send critical level alerts | `true` | +| `SendResolutionNotifications` | Send alert resolution notifications | `true` | +| `MessageTemplate` | Template for alert messages | See above | +| `ResolutionTemplate` | Template for resolution messages | See above | + +### 3. Message Templates + +Templates support the following placeholders: + +- `{Level}` - Alert level (Warning, Critical) +- `{Component}` - Component name (CPU, Memory, GPU, etc.) +- `{Message}` - Full alert message +- `{Timestamp}` - Alert timestamp +- `{CurrentValue}` - Current resource value +- `{ThresholdValue}` - Threshold that was exceeded +- `{ResolvedAt}` - Resolution timestamp (resolution template only) + +## API Endpoints + +### Check Telegram Status +``` +GET /api/telegram/status +``` + +Returns the current status of Telegram integration: +```json +{ + "enabled": true, + "connected": true +} +``` + +### Send Test Alert +``` +POST /api/telegram/test +``` + +Sends a test alert to verify the Telegram bot is working correctly. + +## Features + +### Alert Types + +The bot sends different types of alerts: + +1. **Warning Alerts** āš ļø + - Sent when thresholds are exceeded but not critical + - Notifications are silent (no sound/vibration) + +2. **Critical Alerts** šŸ”“ + - Sent when critical thresholds are exceeded + - Normal notifications (with sound/vibration) + +3. **Resolution Notifications** āœ… + - Sent when alerts are resolved + - Always silent notifications + +### Icons and Formatting + +The bot automatically adds relevant icons: + +- šŸ–„ļø CPU usage +- šŸŒ”ļø Temperature alerts +- šŸ’¾ Memory usage +- šŸŽ® GPU usage +- šŸ’½ Disk usage +- āš™ļø Process alerts + +Messages are formatted using Telegram's Markdown formatting for better readability. + +### Multiple Chat Support + +You can send alerts to multiple chats: +- Personal chats +- Group chats +- Channels (if bot is admin) + +Just add multiple chat IDs to the `ChatIds` array. + +## Troubleshooting + +### Common Issues + +1. **Bot not responding**: + - Verify bot token is correct + - Ensure bot is not blocked + - Check `/api/telegram/status` endpoint + +2. **Messages not received**: + - Verify chat ID is correct + - Ensure you've sent at least one message to the bot + - Check bot has permission to send messages + +3. **Connection errors**: + - Check internet connectivity + - Verify Telegram API is accessible + - Check firewall settings + +### Testing + +1. Set `IsEnabled: true` in configuration +2. Restart the service +3. Call `POST /api/telegram/test` to send a test message +4. Check if the message is received in Telegram + +### Logs + +Monitor the service logs for Telegram-related errors: +``` +grep -i telegram logs/resourcemonitor-*.txt +``` + +## Security Considerations + +1. **Keep bot token secure** - Never commit it to version control +2. **Use environment variables** for sensitive configuration in production +3. **Limit chat IDs** to trusted users/groups only +4. **Regular token rotation** if compromised + +## Example Alert Messages + +### Warning Alert +``` +āš ļø šŸ–„ļø 🚨 Warning Alert + +šŸ“Š CPU +šŸ’¬ CPU Usage is warning: 85.2% (threshold: 80.0%) +ā° 2025-08-07 14:30:15 +``` + +### Critical Alert +``` +šŸ”“ šŸ’¾ 🚨 Critical Alert + +šŸ“Š Memory +šŸ’¬ Memory Usage is critical: 96.8% (threshold: 95.0%) +ā° 2025-08-07 14:35:22 +``` + +### Resolution +``` +āœ… šŸ–„ļø Alert Resolved + +šŸ“Š CPU +šŸ’¬ CPU Usage is warning: 85.2% (threshold: 80.0%) +ā° Resolved at 2025-08-07 14:32:45 +``` diff --git a/Worker.cs b/Worker.cs index 3a73bbb..9d5d715 100644 --- a/Worker.cs +++ b/Worker.cs @@ -20,6 +20,7 @@ namespace ResourceMonitorService private readonly IResourceMonitorService _resourceMonitorService; private readonly IGameDetectionService _gameDetectionService; private readonly IAlertService _alertService; + private readonly ITelegramNotificationService _telegramService; private readonly ApiSettings _apiSettings; private readonly MonitoringSettings _monitoringSettings; @@ -30,6 +31,7 @@ namespace ResourceMonitorService IResourceMonitorService resourceMonitorService, IGameDetectionService gameDetectionService, IAlertService alertService, + ITelegramNotificationService telegramService, IOptions apiSettings, IOptions monitoringSettings) { @@ -39,6 +41,7 @@ namespace ResourceMonitorService _resourceMonitorService = resourceMonitorService; _gameDetectionService = gameDetectionService; _alertService = alertService; + _telegramService = telegramService; _apiSettings = apiSettings.Value; _monitoringSettings = monitoringSettings.Value; } @@ -148,6 +151,37 @@ namespace ResourceMonitorService app.MapGet($"{basePath}/alerts/enabled", async () => Results.Ok(new { Enabled = await _alertService.IsAlertingEnabledAsync() })); + // Telegram endpoints + app.MapGet($"{basePath}/telegram/status", async () => + Results.Ok(new { + Enabled = await _telegramService.IsEnabledAsync(), + Connected = await _telegramService.TestConnectionAsync() + })); + + app.MapPost($"{basePath}/telegram/test", async () => + { + try + { + var testAlert = new Alert + { + Timestamp = DateTime.Now, + Component = "Test", + Level = "Warning", + Message = "This is a test alert from Resource Monitor Service", + CurrentValue = 100, + ThresholdValue = 90, + IsResolved = false + }; + + await _telegramService.SendAlertAsync(testAlert); + return Results.Ok(new { Message = "Test alert sent successfully" }); + } + catch (Exception ex) + { + return Results.Problem($"Failed to send test alert: {ex.Message}"); + } + }); + // Process management endpoints (enhanced) app.MapPost($"{basePath}/process/kill", async (HttpContext context) => { diff --git a/appsettings.json b/appsettings.json index e70c932..ee97cee 100644 --- a/appsettings.json +++ b/appsettings.json @@ -88,7 +88,17 @@ "DurationSeconds": 60, "IsEnabled": true } - ] + ], + "Telegram": { + "IsEnabled": true, + "BotToken": "7705627522:AAHDTVMF1uPJW7qm-Di0g_BmefAVWdOrS2U", + "ChatIds": [398126624], + "SendWarningAlerts": true, + "SendCriticalAlerts": true, + "SendResolutionNotifications": true, + "MessageTemplate": "🚨 *{Level} Alert*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° {Timestamp}", + "ResolutionTemplate": "āœ… *Alert Resolved*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° Resolved at {ResolvedAt}" + } }, "LoggingSettings": { "LogLevel": "Information", diff --git a/appsettings.telegram.example.json b/appsettings.telegram.example.json new file mode 100644 index 0000000..92d3638 --- /dev/null +++ b/appsettings.telegram.example.json @@ -0,0 +1,74 @@ +{ + "MonitoringSettings": { + "UpdateIntervalMs": 5000, + "DataRetentionDays": 7, + "EnableGpuMonitoring": true, + "EnableDiskMonitoring": true, + "EnableNetworkMonitoring": true, + "EnableTemperatureMonitoring": true, + "EnableProcessMonitoring": true, + "EnableGameDetection": true, + "EnableAlerts": true, + "MaxProcessesToTrack": 10, + "MaxHistoryPoints": 1000, + "GamePlatformPaths": [ + "\\steamapps\\common\\", + "\\Epic Games\\", + "\\GOG Galaxy\\Games\\", + "\\Origin Games\\", + "\\Ubisoft Game Launcher\\games\\" + ], + "GameRootFolders": [ + "C:\\Games", + "D:\\Games", + "E:\\Games" + ], + "AlertThresholds": [ + { + "Component": "CPU", + "WarningThreshold": 80, + "CriticalThreshold": 95, + "DurationSeconds": 30, + "IsEnabled": true + }, + { + "Component": "Memory", + "WarningThreshold": 85, + "CriticalThreshold": 95, + "DurationSeconds": 30, + "IsEnabled": true + }, + { + "Component": "GPU", + "WarningThreshold": 85, + "CriticalThreshold": 95, + "DurationSeconds": 30, + "IsEnabled": true + }, + { + "Component": "CPUTemp", + "WarningThreshold": 75, + "CriticalThreshold": 85, + "DurationSeconds": 60, + "IsEnabled": true + }, + { + "Component": "GPUTemp", + "WarningThreshold": 80, + "CriticalThreshold": 90, + "DurationSeconds": 60, + "IsEnabled": true + } + ], + "Telegram": { + "IsEnabled": true, + "BotToken": "123456789:ABCdefGHIjklMNOpqrSTUvwxyz", + "ChatIds": [123456789], + "SendWarningAlerts": true, + "SendCriticalAlerts": true, + "SendResolutionNotifications": true, + "MessageTemplate": "🚨 *{Level} Alert*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° {Timestamp}", + "ResolutionTemplate": "āœ… *Alert Resolved*\n\nšŸ“Š *{Component}*\nšŸ’¬ {Message}\nā° Resolved at {ResolvedAt}" + } + } +}