mirror of
https://github.com/andrey271192/vps_monitoring.git
synced 2026-09-21 12:01:58 +00:00
feat: add Synology NAS, Home Assistant monitoring, multi-channel notifications
New tabs: - Synology NAS: CPU, RAM, temp, volumes, VMs, Docker containers - Home Assistant: sensors, automations, persons, climate, battery, doors New features: - Personalized PC agent download with custom name - Notification settings: per-category Telegram/Email/WhatsApp toggles - Email via SMTP, WhatsApp via CallMeBot API - Test notification buttons for each channel - Unified notifier replaces direct Telegram calls in alerter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<button class="btn-icon" id="themeToggleBtn" onclick="toggleTheme()" title="Theme">🌙</button>
|
||||
<button class="btn-icon" onclick="refreshAll()" title="Refresh">🔄</button>
|
||||
<button class="btn-icon" onclick="showInstructions()" title="Instructions">📖</button>
|
||||
<button class="btn-icon" onclick="showNotificationSettings()" title="Notifications">🔔</button>
|
||||
<button class="btn-icon" onclick="showSettings()" title="Settings">⚙️</button>
|
||||
<button class="btn-icon" onclick="logout()" title="Logout">🚪</button>
|
||||
</div>
|
||||
@@ -42,8 +43,10 @@
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="tabs">
|
||||
<button class="tab active" id="tab-servers" onclick="switchTab('servers')">🖥 Серверы</button>
|
||||
<button class="tab" id="tab-pc" onclick="switchTab('pc')">💻 ПК</button>
|
||||
<button class="tab active" id="tab-servers" onclick="switchTab('servers')">🖥 <span data-i18n="tabServers">Серверы</span></button>
|
||||
<button class="tab" id="tab-pc" onclick="switchTab('pc')">💻 <span data-i18n="tabPC">ПК</span></button>
|
||||
<button class="tab" id="tab-synology" onclick="switchTab('synology')">📦 Synology</button>
|
||||
<button class="tab" id="tab-ha" onclick="switchTab('ha')">🏠 Home Assistant</button>
|
||||
</div>
|
||||
|
||||
<!-- Servers Tab -->
|
||||
@@ -57,11 +60,30 @@
|
||||
<!-- PC Tab -->
|
||||
<div id="panel-pc" style="display:none">
|
||||
<div class="toolbar">
|
||||
<button class="btn-secondary" onclick="showPCSetup()">📋 Инструкция установки</button>
|
||||
<button class="btn-primary" onclick="showPCDownload()">📥 Скачать агент</button>
|
||||
<button class="btn-secondary" onclick="showPCSetup()">📋 Инструкция</button>
|
||||
<button class="btn-secondary" onclick="loadPCs()">🔄 Обновить</button>
|
||||
</div>
|
||||
<div class="servers-grid" id="pc-grid"></div>
|
||||
</div>
|
||||
|
||||
<!-- Synology Tab -->
|
||||
<div id="panel-synology" style="display:none">
|
||||
<div class="toolbar">
|
||||
<button class="btn-primary" onclick="showAddSynology()">+ Добавить NAS</button>
|
||||
<button class="btn-secondary" onclick="refreshAllSynology()">🔄 Обновить все</button>
|
||||
</div>
|
||||
<div class="servers-grid" id="synology-grid"></div>
|
||||
</div>
|
||||
|
||||
<!-- Home Assistant Tab -->
|
||||
<div id="panel-ha" style="display:none">
|
||||
<div class="toolbar">
|
||||
<button class="btn-primary" onclick="showAddHA()">+ Добавить HA</button>
|
||||
<button class="btn-secondary" onclick="refreshAllHA()">🔄 Обновить все</button>
|
||||
</div>
|
||||
<div class="servers-grid" id="ha-grid"></div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Add Server Modal -->
|
||||
@@ -101,6 +123,195 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add Synology Modal -->
|
||||
<div class="modal" id="addSynologyModal" style="display:none">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>📦 Добавить Synology NAS</h2>
|
||||
<button class="btn-close" onclick="closeModal('addSynologyModal')">×</button>
|
||||
</div>
|
||||
<form id="addSynologyForm">
|
||||
<div class="form-group">
|
||||
<label>Название</label>
|
||||
<input type="text" name="name" required placeholder="My NAS">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>IP / Host</label>
|
||||
<input type="text" name="host" required placeholder="192.168.1.50">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Порт DSM</label>
|
||||
<input type="number" name="port" value="5000">
|
||||
</div>
|
||||
<div class="form-group" style="display:flex;align-items:center;gap:8px">
|
||||
<input type="checkbox" name="https" id="syn-https" style="width:auto">
|
||||
<label for="syn-https" style="margin:0">HTTPS</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Логин DSM</label>
|
||||
<input type="text" name="username" required placeholder="admin">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Пароль DSM</label>
|
||||
<input type="password" name="password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary">Добавить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add HA Modal -->
|
||||
<div class="modal" id="addHAModal" style="display:none">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>🏠 Добавить Home Assistant</h2>
|
||||
<button class="btn-close" onclick="closeModal('addHAModal')">×</button>
|
||||
</div>
|
||||
<form id="addHAForm">
|
||||
<div class="form-group">
|
||||
<label>Название</label>
|
||||
<input type="text" name="name" required placeholder="Home">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>URL</label>
|
||||
<input type="text" name="url" required placeholder="http://192.168.1.100:8123">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Long-Lived Access Token</label>
|
||||
<textarea name="token" required rows="3" placeholder="Профиль → Безопасность → Долгоживущие токены доступа" style="resize:vertical"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary">Добавить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PC Download Modal -->
|
||||
<div class="modal" id="pcDownloadModal" style="display:none">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>📥 Скачать агент для ПК</h2>
|
||||
<button class="btn-close" onclick="closeModal('pcDownloadModal')">×</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Имя компьютера (агента)</label>
|
||||
<input type="text" id="pc-agent-name" placeholder="MyPC" value="">
|
||||
</div>
|
||||
<button class="btn-primary" onclick="generatePCCommand()" style="margin-bottom:16px">🔧 Сгенерировать команду</button>
|
||||
<div id="pc-generated-cmd" style="display:none">
|
||||
<div class="instr-card">
|
||||
<h4>📋 Команда установки (PowerShell от Администратора)</h4>
|
||||
<code id="pc-gen-code" style="cursor:pointer" onclick="copyToClipboard(this.textContent)" title="Нажмите чтобы скопировать"></code>
|
||||
<p style="margin-top:8px;font-size:11px;color:var(--text-secondary)">Нажмите на команду чтобы скопировать</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notification Settings Modal -->
|
||||
<div class="modal" id="notifyModal" style="display:none">
|
||||
<div class="modal-content modal-wide">
|
||||
<div class="modal-header">
|
||||
<h2>🔔 Настройки уведомлений</h2>
|
||||
<button class="btn-close" onclick="closeModal('notifyModal')">×</button>
|
||||
</div>
|
||||
|
||||
<!-- Channel configs -->
|
||||
<h3>📨 Каналы доставки</h3>
|
||||
<div class="notify-channels">
|
||||
<div class="instr-card">
|
||||
<h4>📱 Telegram</h4>
|
||||
<p style="font-size:12px;color:var(--text-secondary)">Настраивается в Настройках (⚙️) — Bot Token и Chat ID</p>
|
||||
<div id="tg-status" style="margin-top:8px"></div>
|
||||
<button class="btn-sm" onclick="testNotification('telegram')" style="margin-top:8px">🧪 Тест</button>
|
||||
</div>
|
||||
<div class="instr-card">
|
||||
<h4>📧 Email (SMTP)</h4>
|
||||
<div class="form-group" style="margin-top:8px">
|
||||
<label>SMTP сервер</label>
|
||||
<input type="text" id="n-smtp-host" placeholder="smtp.gmail.com">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Порт</label>
|
||||
<input type="number" id="n-smtp-port" value="587">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Email (логин)</label>
|
||||
<input type="text" id="n-smtp-user" placeholder="user@gmail.com">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Пароль приложения</label>
|
||||
<input type="password" id="n-smtp-pass" placeholder="App Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Получатель</label>
|
||||
<input type="text" id="n-email-to" placeholder="alerts@example.com">
|
||||
</div>
|
||||
<button class="btn-sm" onclick="testNotification('email')" style="margin-top:4px">🧪 Тест</button>
|
||||
</div>
|
||||
<div class="instr-card">
|
||||
<h4>💬 WhatsApp (CallMeBot)</h4>
|
||||
<p style="font-size:12px;color:var(--text-secondary);margin-bottom:8px">
|
||||
1. Отправьте "I allow callmebot to send me messages" на <b>+34 644 71 85 23</b> в WhatsApp<br>
|
||||
2. Получите apikey в ответном сообщении<br>
|
||||
3. Введите данные ниже
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label>Телефон (с кодом страны)</label>
|
||||
<input type="text" id="n-wa-phone" placeholder="+79001234567">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>API Key</label>
|
||||
<input type="text" id="n-wa-apikey" placeholder="От CallMeBot">
|
||||
</div>
|
||||
<button class="btn-sm" onclick="testNotification('whatsapp')" style="margin-top:4px">🧪 Тест</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Per-category toggles -->
|
||||
<h3>📊 Какие уведомления отправлять</h3>
|
||||
<div class="notify-matrix">
|
||||
<table class="notify-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Категория</th>
|
||||
<th>📱 Telegram</th>
|
||||
<th>📧 Email</th>
|
||||
<th>💬 WhatsApp</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>🖥 Серверы</td>
|
||||
<td><input type="checkbox" id="n-servers-tg" checked></td>
|
||||
<td><input type="checkbox" id="n-servers-email"></td>
|
||||
<td><input type="checkbox" id="n-servers-wa"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>💻 ПК</td>
|
||||
<td><input type="checkbox" id="n-pc-tg" checked></td>
|
||||
<td><input type="checkbox" id="n-pc-email"></td>
|
||||
<td><input type="checkbox" id="n-pc-wa"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>📦 Synology</td>
|
||||
<td><input type="checkbox" id="n-synology-tg" checked></td>
|
||||
<td><input type="checkbox" id="n-synology-email"></td>
|
||||
<td><input type="checkbox" id="n-synology-wa"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>🏠 Home Assistant</td>
|
||||
<td><input type="checkbox" id="n-ha-tg" checked></td>
|
||||
<td><input type="checkbox" id="n-ha-email"></td>
|
||||
<td><input type="checkbox" id="n-ha-wa"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<button class="btn-primary" onclick="saveNotificationSettings()" style="margin-top:20px">💾 Сохранить</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Settings Modal -->
|
||||
<div class="modal" id="settingsModal" style="display:none">
|
||||
<div class="modal-content">
|
||||
@@ -182,6 +393,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Synology Detail Modal -->
|
||||
<div class="modal" id="synDetailModal" style="display:none">
|
||||
<div class="modal-content modal-wide">
|
||||
<div class="modal-header">
|
||||
<h2 id="syn-detail-title">Synology</h2>
|
||||
<button class="btn-close" onclick="closeModal('synDetailModal')">×</button>
|
||||
</div>
|
||||
<div id="syn-detail-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- HA Detail Modal -->
|
||||
<div class="modal" id="haDetailModal" style="display:none">
|
||||
<div class="modal-content modal-wide">
|
||||
<div class="modal-header">
|
||||
<h2 id="ha-detail-title">Home Assistant</h2>
|
||||
<button class="btn-close" onclick="closeModal('haDetailModal')">×</button>
|
||||
</div>
|
||||
<div id="ha-detail-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PC Setup Modal -->
|
||||
<div class="modal" id="pcSetupModal" style="display:none">
|
||||
<div class="modal-content modal-wide">
|
||||
@@ -213,11 +446,6 @@
|
||||
<li>Unregister-ScheduledTask 'VPS-Monitor-Agent'</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="instr-card">
|
||||
<h4>📁 Файлы</h4>
|
||||
<p>Агент: <code style="display:inline">C:\VPS-Monitor\vps_monitor_agent.ps1</code><br>
|
||||
Конфиг: <code style="display:inline">C:\VPS-Monitor\agent_config.json</code></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user