Commit Graph

106 Commits (d652e24ad0bea9312892cfd26c462f6ec1d0835a)

Author SHA1 Message Date
mirivlad d652e24ad0 fix: Icon picker duplicate variable declaration
- Add guard to prevent double initialization
- Remove duplicate currentTargetInput declaration
2026-04-17 19:43:37 +08:00
mirivlad e9d2fcf1c0 fix: Delete via GET instead of AJAX
- Use GET /{id}/delete instead of DELETE
- Simple link with confirm() instead of fetch
- Removed CSRF for delete routes
2026-04-17 19:05:47 +08:00
mirivlad d5318f7e16 fix: Delete groups/servers using fetch with CSRF header
- Create CsrfHeaderMiddleware to read X-CSRF-TOKEN header
- Replace form submit with JavaScript fetch for DELETE operations
- Send CSRF token in X-CSRF-TOKEN header
- Fix groups/index.twig and servers/index.twig delete buttons
2026-04-17 18:59:12 +08:00
mirivlad 1ab4bcd697 feat: Visual icon picker for groups
- Add icon-picker-modal partial with 200+ Font Awesome icons
- Search filter with typeahead functionality
- Grid layout (6 icons per row)
- Click icon to select and close modal
- Icon preview updates in real-time
- Integrated into group create/edit forms
2026-04-17 18:50:09 +08:00
mirivlad e8e922b845 fix: Add missing 'fas' prefix to group icon class 2026-04-17 17:38:11 +08:00
mirivlad 4766d4511e fix: Accordion toggle with proper cookie handling 2026-04-17 17:36:05 +08:00
mirivlad 32894447f3 fix: Manual accordion toggle without Bootstrap events
- Removed data-bs-toggle="collapse" to prevent Bootstrap interference
- Handle click manually: toggle class "show" and update icon
- Cookie stores 'expanded'/'collapsed' state per group
- Chevron icon updates correctly on click
2026-04-17 17:32:51 +08:00
mirivlad 68cb135322 fix: Add Bootstrap JS for collapse to work
- Added bootstrap.bundle.min.js to layout.twig
- Added debug logging to accordion JS
- Fixed icon update logic
2026-04-17 17:30:49 +08:00
mirivlad 98f6244eb3 fix: Accordion icon toggle using Bootstrap events
- Use hidden.bs.collapse and shown.bs.collapse events instead of click
- Icons now toggle correctly between up/down chevrons
- Cookie state properly saved on toggle
2026-04-17 17:26:34 +08:00
mirivlad 4a8a2d66fb feat: Store accordion state in cookies
- Accordion state (collapsed/expanded) saved to cookies per group
- Chevron icon toggles correctly (up/down)
- State persists across page reloads for 30 days
- First accordion group opens by default
2026-04-17 17:23:25 +08:00
mirivlad 3872d1df30 feat: Enhanced dashboard with group colors, metric icons and AJAX update
- Accordion header color matches group color from settings
- CPU/RAM/DISK now use Font Awesome icons (microchip, memory, hdd)
- Icon colors change based on threshold status (red/yellow/green)
- AJAX refresh updates values every 30 seconds without page reload
- Added IDs to metric elements for targeted updates
2026-04-17 16:52:13 +08:00
mirivlad 7c15ed82a0 fix: Dashboard route now passes groups to template
The / route was using anonymous function that passed $servers
but template expected $groups. Now both use the same logic.
2026-04-17 16:43:25 +08:00
mirivlad d5338b1fc2 fix: Dashboard twig empty check 2026-04-17 16:26:36 +08:00
mirivlad 5f42375195 feat: Redesign dashboard with compact cards and groups
- Add uptime metric collection in agent.py
- Group servers by groups with accordion
- Compact cards layout (4-6 per row)
- Status dot indicator (green/yellow/red)
- CPU/RAM/Disk mini progress bars
- Uptime display (days/hours/minutes)
- Color-coded left border by status
2026-04-17 16:19:17 +08:00
mirivlad b7528a6ef8 fix: Revert auto-thresholds, apply defaults only when set
- Remove auto-creation of thresholds for new metrics
- Only apply defaults when threshold record exists but value is NULL
- Delete erroneous alerts for GB/Network metrics
2026-04-17 15:52:13 +08:00
mirivlad 1b28012a4c feat: Apply default_settings thresholds when not set per-server
- Fallback to default_settings when metric_thresholds not configured
- Auto-create default thresholds when new metric type is added
2026-04-17 15:38:02 +08:00
mirivlad 9ed90ca6dd fix: Fix FETCH_KEY_PAIR error in defaultSettings 2026-04-17 15:35:49 +08:00
mirivlad d03aff714f feat: Add offline monitoring and default settings
- Add offline_timeout and notify_on_offline fields to servers table
- Create default_settings table for configurable defaults
- Create offline_alerts table for tracking offline events
- Add sendOfflineNotification/sendOnlineNotification methods
- Create check_offline.php CRON script for periodic checks
- Add admin page for default settings management
- Add offline settings to server edit form
- Apply default values when creating new servers

Usage: Add to CRON - * * * * * php /var/www/mon/public/check_offline.php
2026-04-17 15:22:17 +08:00
mirivlad 6d3542232a docs: Update documentation to reflect current state
README.md:
- Fix badge line breaks
- Add migration 008_auto_cleanup_metrics.sql
- Improve architecture diagram
- Add troubleshooting section
- Add changelog
- Fix formatting

ARCHITECTURE.md:
- Update agent metrics list (net_in_*, temp_*, etc.)
- Change interval from 10s to 60s
- Fix architecture diagram

INSTALL.md:
- PHP 8.1 -> 8.3
- php8.1-fpm.sock -> php8.3-fpm.sock
- Update API example with current metrics

AGENTS.md:
- PHP 8.1 -> 8.3
- Update API endpoints with new /get-agent, /agent/install.sh

docker/README.md:
- Fix password from 'admin' to 'mirvmon2026'

TECHNICAL_SPECIFICATION.md:
- Change agent interval from 10s to 60s
- Add lm-sensors, smartmontools to agent requirements
2026-04-17 11:52:48 +08:00
mirivlad fe1463442a fix: Agent network metrics initialization
- Initialize _prev_net_io on first call for all interfaces
- Calculate metrics from second call onwards
- This ensures metrics are captured starting from cycle 2
2026-04-17 10:19:32 +08:00
mirivlad f1fc514a33 fix: Agent network and disk metrics for VPS
Network:
- Remove speed > 0 check in _is_real_interface()
- Use 1000 Mbps default for interfaces with speed=0
- This allows virtual interfaces (ens3) to be detected
- Remove network_rx/network_tx (no longer needed)

Disk:
- Rewrite get_disk_metrics() to detect unique devices
- If only one device (/) - create only disk_used_root
- If multiple devices - create for each
- This fixes VPS with single disk showing same % for all mounts
2026-04-17 10:11:16 +08:00
mirivlad c8d0bc4a40 security: Require explicit token for agent downloads
- Remove server_id auto-resolution from validateAndGetToken()
- Links in edit.twig now use token instead of server_id
- Add agent_token retrieval in ServerController::edit()
2026-04-17 09:55:45 +08:00
mirivlad 6ec03325be security: Require token for all agent download URLs
- Add validateAndGetToken() method for token validation
- All install scripts (sh, ps1, bat) now require valid token
- Also update Windows scripts to use /get-agent endpoint with token
2026-04-17 09:51:17 +08:00
mirivlad 5b3f5a9483 fix: Agent download endpoint and install script URL
- Move /get-agent route before auth groups to ensure it's public
- Fix path resolution in downloadAgent() - dirname(__DIR__, 2) from controller = /var/www/mon/
- Fix withStatus() return value issue in downloadAgent()
- Use /get-agent endpoint instead of /agent/agent.py (nginx issue with .py files)
- Update install.sh to use /get-agent URL
2026-04-17 09:47:18 +08:00
mirivlad 3afd6f8366 fix: Install script variable interpolation in heredoc
Problem: PHP was interpolating bash variables like $INSTALL_DIR
as empty PHP variables. Fixed by using PHP variables in single
quotes: '{$installDir}' instead of "$INSTALL_DIR"
2026-04-17 09:35:04 +08:00
mirivlad bce4c2e2d0 fix: Update agent install, disk metrics, fallback blocks, and dynamic thresholds
BREAKING: install.sh now downloads agent from server instead of embedding it

Changes:
- AgentController: downloadAgent() method for serving agent.py with token auth
- AgentController: rewrite generateInstallScript() to curl agent from server
- agent.py: copy production version from server (with temp, disk, network metrics)
- agent.py: fix get_disk_metrics() to use priority mountpoints (/, /home, etc)
- agent.py: fix disk_total_gb collection to use priority mountpoints
- detail.twig: add fallback blocks for temperatures (alert-info)
- detail.twig: add fallback blocks for disk doughnuts (alert-warning)
- detail.twig: add fallback blocks for network graphs (alert-warning)
- detail.twig: add null check for ramTotalGB in tooltip
- detail.twig: improve thresholds form with human-readable labels and units
- ServerDetailController: query only metrics that exist on server and display on graphs

For server 3 (mirv.top):
- After deploy, download new install.sh and reinstall agent
- This will add disk_used_root, ram_total_gb, temperatures support
2026-04-17 09:25:43 +08:00
mirivlad 3255bfae29 feat: auto-cleanup metrics older than 60 days
- MariaDB event scheduler: daily cleanup at 03:00
- Production: event created, event_scheduler=ON, config in /etc/mysql/mariadb.conf.d/
- Docker: --event-scheduler=ON in db service command
- Migration 008: creates event on fresh installs
- 20 servers x 1 month ≈ 1GB (vs unlimited growth)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 19:21:40 +08:00
mirivlad e4588f7044 fix: correct PHP-native bcrypt hash for admin password mirvmon2026
- Migration 007: PHP-native $2y$ hash (not Python $2b$)
- docker/.env excluded from git
- APP_PORT set to 8082 (avoid conflicts with existing nginx)
- Verified: login with admin/mirvmon2026 works correctly

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 16:34:40 +08:00
mirivlad 3ba8629146 unify config: single .env.example, default password mirvmon2026, docker in README
- .env.example moved to project root (used by both Docker and manual install)
- Migration 007: admin password = mirvmon2026 (bcrypt hash)
- docker-compose.yml reads ../.env from root
- deploy.sh generates DB passwords, shows default admin password
- README.md updated with Docker install section (Variant A) and manual (Variant B)
- Consistent default credentials everywhere: admin/mirvmon2026

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 16:20:01 +08:00
mirivlad 8938b61c78 deploy: add deploy.sh script, secure .env
- deploy.sh: auto-install docker, generate random passwords, start
- .env removed from git, added to .gitignore and .dockerignore
- Secrets are now local-only

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 15:54:16 +08:00
mirivlad 6d8bd99277 Docker: production-ready setup with immutable images, versioned migrations, env vars
- Dockerfile: PHP 8.3 FPM + composer install (no dev)
- docker-compose.yml: app + nginx + MariaDB 10.11
- Versioned migrations (001-007) with schema_migrations tracking
- DatabaseConfig.php: env vars with fallbacks
- init.sh: wait-for-db + auto-migrate
- nginx.conf: reverse proxy + gzip + security rules
- .env.example: config template
- .dockerignore: build optimization

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 15:51:14 +08:00
mirivlad 99761ca5d8 feat: добавить установку Windows-агента через .bat (обход ExecutionPolicy, двойной клик)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 04:54:25 +08:00
mirivlad 066a18788d fix: исправить генерацию PS1 скрипта (getBody вместо Nyholm)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 04:37:55 +08:00
mirivlad c2c9934ff8 feat: добавить установку агента для Windows Server 2012+ (PowerShell скрипт, Scheduled Task, авт. установка Python)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 04:31:20 +08:00
mirivlad 808b7c7d1e feat: добавить фавикон (монитор с графиком)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 04:07:49 +08:00
mirivlad e528a91d8f fix: использовать дефолтные значения порогов (80/90/0) вместо NULL
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 03:54:03 +08:00
mirivlad ade719f3e0 fix: сохранять пороги частично (warning/critical отдельно), flash сообщение с подробностями
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 03:37:13 +08:00
mirivlad ce577c5d51 feat: объединить все температурные метрики (temp_*) в один график с разными цветами, вернуть сетевые графики
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 03:13:03 +08:00
mirivlad dbd71e3485 fix: removed network rx/tx charts, ensured single temp chart
- Excluded network_rx and network_tx metrics from main metrics loop
- Removed separate network interface charts
- Verified single combined Temperatures chart (chart-temperatures) exists and is initialized
2026-04-14 01:52:03 +08:00
mirivlad de34962360 feat: добавлен мониторинг температур (CPU, GPU, HDD/SSD)
- Обновлен скрипт установки агента (добавлены lm-sensors, smartmontools)
- Агент теперь собирает температуры: CPU (через psutil), Диски (smartctl), GPU (nvidia-smi)
- Бэкенд автоматически определяет единицу измерения °C для метрик temp_*
- Добавлен общий график Температуры на страницу сервера
2026-04-14 01:21:59 +08:00
mirivlad 91cfbca893 docs: update README with install.sh script instructions
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 01:05:43 +08:00
mirivlad 9a4106a201 fix: исправлен синтаксис index.php и добавлен API маршрут дашборда
- Восстановлен корректный index.php из чистого коммита
- Добавлен маршрут /api/dashboard/stats для бесшовного обновления
- Исправлена ошибка парсинга PHP
2026-04-14 00:52:53 +08:00
mirivlad 8d4a789e00 feat(dashboard): бесшовное обновление данных без перезагрузки страницы
- Добавлен API endpoint /api/dashboard/stats
- Реализована замена location.reload() на fetch() каждые 30 секунд
- Добавлены ID к элементам метрик для точечного обновления
- Убрано мерцание страницы при обновлении
2026-04-14 00:38:43 +08:00
mirivlad e985bb2c34 fix(dashboard): скрытие блока диска если метрики отсутствуют
- Исправлена проверка diskMetric: теперь проверяется реальное наличие значения, а не только defined
- Блок диска больше не показывается для серверов без метрик (например Work_PC)
2026-04-14 00:19:18 +08:00
mirivlad 84a10f7909 fix: исправлено дублирование пользователей в списке
- Добавлен UNIQUE constraint на user_id в user_notification_settings
- Удалены существующие дубликаты из таблицы
- Добавлен DISTINCT в SQL запрос списка пользователей
- INSERT ON DUPLICATE KEY UPDATE теперь корректно предотвращает создание дублей
2026-04-13 23:53:48 +08:00
mirivlad 7c597457ce fix: очистка поля пароля при редактировании пользователя 2026-04-13 23:49:09 +08:00
mirivlad 90e220902d fix: исправлена ошибка SQL при перегенерации токена агента
- Исправлен синтаксис ON DUPLICATE KEY UPDATE (VALUES вместо привязки параметров)
- Устранена ошибка SQLSTATE[HY093]: Invalid parameter number

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-13 23:39:31 +08:00
mirivlad 5ceeca1531 docs: добавлен README.md с полной документацией проекта
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-13 23:23:20 +08:00
mirivlad 741fd56879 fix(dashboard): исправлен синтаксис Twig для отображения корневого раздела
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-13 23:19:02 +08:00
mirivlad 8498e7df34 fix(dashboard): показывать использование корневого раздела (/) на карточке сервера
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-13 23:09:49 +08:00