Files
novacpx/db/migrations/007_stats_settings.sql
myron c0c9865653 feat: server monitoring charts, package limits, WHMCS bridge, server options (#19-22)
#19 Server monitoring charts:
- server_stats table (migration 007) + collect-stats.php cron script
- serverStatus() page rebuilt with Chart.js line charts (CPU/RAM/disk)
- Chart.js lazy-loaded from CDN; history shown for last 24h

#20 Cron job manager: already complete in prior session

#21 Package limits enforcement:
- email.php: checks max_email before creating email account
- databases.php: checks max_databases before creating database
- ftp.php: checks max_ftp before creating FTP account
- stats.php: fixed column names (max_email/max_ftp/max_databases vs old aliases)

#22b WHMCS billing bridge:
- whmcs.php endpoint: create/suspend/unsuspend/terminate/changepackage/info
- Auth via X-WHMCS-Key header; enabled/key stored in settings table

#22a/c/d/e Server options admin page:
- Web/mail/FTP/DNS server selection with settings persistence
- Server switch triggers /opt/novacpx/bin/switch-*.sh scripts (if present)
- NS health checker: live dig lookup of all zones vs configured NS1/NS2
- system.php: server-options + save-option actions
- dns.php: ns-health action

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 03:00:09 +00:00

23 lines
863 B
SQL

-- Migration 007: server_stats table + server type settings + WHMCS key
CREATE TABLE IF NOT EXISTS server_stats (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
cpu_usage DECIMAL(5,2) DEFAULT 0,
ram_usage DECIMAL(5,2) DEFAULT 0,
disk_usage DECIMAL(5,2) DEFAULT 0,
load_avg DECIMAL(8,2) DEFAULT 0,
net_in_kb BIGINT DEFAULT 0,
net_out_kb BIGINT DEFAULT 0,
recorded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX (recorded_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT IGNORE INTO settings (`key`, `value`) VALUES
('web_server', 'apache'),
('mail_server', 'postfix-dovecot'),
('ftp_server', 'proftpd'),
('dns_server', 'bind9'),
('whmcs_api_key', ''),
('whmcs_enabled', '0'),
('ns1_hostname', ''),
('ns2_hostname', '');