eZ Server Monitor is a lightweight, web-based server monitoring tool that provides real-time system information including CPU, memory, disk, network, and process monitoring. It’s designed to be simple to install and use.
| File/Directory | Path | Purpose |
|---|---|---|
| Main config | /etc/ez-server-monitor/config.php |
Main configuration file |
| Web files | /var/www/html/ez-server-monitor/ |
Web application files |
| Cache | /var/cache/ez-server-monitor/ |
Cached data |
| Logs | /var/log/ez-server-monitor/ |
Log files |
| Plugins | /var/www/html/ez-server-monitor/plugins/ |
Plugin directory |
| Themes | /var/www/html/ez-server-monitor/themes/ |
Theme files |
| Language | /var/www/html/ez-server-monitor/lang/ |
Language files |
<?php
/**
* /etc/ez-server-monitor/config.php
* eZ Server Monitor Configuration
*/
// Prevent direct access
defined('EZ_MONITOR') or die('Direct access not permitted');
/*
* ============================================================================
* GENERAL SETTINGS
* ============================================================================
*/
// Application title
$config['app_title'] = 'eZ Server Monitor';
// Application version (auto-detected)
$config['app_version'] = '1.0.0';
// Default language
$config['default_language'] = 'en';
// Supported languages
$config['supported_languages'] = ['en', 'fr', 'de', 'es', 'it', 'pt', 'ru', 'zh'];
// Default theme
$config['default_theme'] = 'default';
// Timezone
$config['timezone'] = 'UTC';
// Date format
$config['date_format'] = 'Y-m-d H:i:s';
/*
* ============================================================================
* SECURITY SETTINGS
* ============================================================================
*/
// Enable authentication
$config['auth_enabled'] = false;
// Authentication method (basic, ldap, oauth)
$config['auth_method'] = 'basic';
// Session settings
$config['session_lifetime'] = 3600; // 1 hour
$config['session_secure'] = false;
$config['session_httponly'] = true;
// Basic auth users
$config['auth_users'] = [
'admin' => [
'password' => password_hash('AdminPassword123!', PASSWORD_DEFAULT),
'role' => 'admin'
],
'viewer' => [
'password' => password_hash('ViewerPassword123!', PASSWORD_DEFAULT),
'role' => 'viewer'
]
];
// User roles
$config['roles'] = [
'admin' => [
'permissions' => ['read', 'write', 'delete', 'config']
],
'viewer' => [
'permissions' => ['read']
]
];
// IP whitelist (bypass authentication)
$config['ip_whitelist'] = [
'127.0.0.1',
'::1'
];
// IP blacklist
$config['ip_blacklist'] = [];
// Rate limiting
$config['rate_limit_enabled'] = true;
$config['rate_limit_requests'] = 100;
$config['rate_limit_window'] = 60; // seconds
/*
* ============================================================================
* MONITORING SETTINGS
* ============================================================================
*/
// Refresh interval (seconds)
$config['refresh_interval'] = 5;
// Enable real-time updates
$config['realtime_enabled'] = true;
// Real-time update interval (milliseconds)
$config['realtime_interval'] = 2000;
// Metrics to collect
$config['metrics'] = [
'cpu' => true,
'memory' => true,
'disk' => true,
'network' => true,
'load' => true,
'processes' => true,
'users' => true,
'uptime' => true,
'temperature' => false,
'gpu' => false,
'services' => false,
'docker' => false
];
// CPU settings
$config['cpu'] = [
'show_cores' => true,
'show_frequency' => true,
'show_temperature' => false,
'show_load_average' => true,
'decimal_places' => 1
];
// Memory settings
$config['memory'] = [
'show_swap' => true,
'show_cache' => true,
'show_buffers' => true,
'decimal_places' => 1,
'unit' => 'auto' // auto, bytes, binary
];
// Disk settings
$config['disk'] = [
'show_all_partitions' => false,
'show_mount_points' => ['/', '/home', '/var', '/data'],
'show_inode_usage' => true,
'show_io_stats' => false,
'decimal_places' => 1,
'exclude_filesystems' => ['tmpfs', 'devtmpfs', 'overlay', 'squashfs']
];
// Network settings
$config['network'] = [
'show_interfaces' => [], // empty = all interfaces
'exclude_interfaces' => ['lo', 'docker*', 'veth*'],
'show_traffic' => true,
'show_errors' => false,
'show_speed' => true,
'unit' => 'auto' // auto, bits, bytes
];
// Process settings
$config['processes'] = [
'enabled' => true,
'max_processes' => 20,
'sort_by' => 'cpu', // cpu, memory, name, pid
'show_user' => true,
'show_pid' => true,
'show_command' => true,
'show_cpu' => true,
'show_memory' => true
];
// Service monitoring
$config['services'] = [
'enabled' => false,
'services_to_monitor' => [
['name' => 'nginx', 'command' => 'systemctl is-active nginx'],
['name' => 'mysql', 'command' => 'systemctl is-active mysql'],
['name' => 'php-fpm', 'command' => 'systemctl is-active php-fpm'],
['name' => 'redis', 'command' => 'systemctl is-active redis'],
['name' => 'docker', 'command' => 'systemctl is-active docker']
]
];
// Docker monitoring
$config['docker'] = [
'enabled' => false,
'show_containers' => true,
'show_images' => false,
'show_volumes' => false,
'show_networks' => false
];
/*
* ============================================================================
* ALERT SETTINGS
* ============================================================================
*/
// Enable alerts
$config['alerts_enabled'] = false;
// Alert check interval (seconds)
$config['alert_check_interval'] = 60;
// Alert thresholds
$config['alert_thresholds'] = [
'cpu_warning' => 70,
'cpu_critical' => 90,
'memory_warning' => 75,
'memory_critical' => 90,
'disk_warning' => 80,
'disk_critical' => 90,
'load_warning' => 2.0,
'load_critical' => 5.0
];
// Alert duration (seconds before triggering)
$config['alert_duration'] = [
'cpu' => 300,
'memory' => 300,
'disk' => 600,
'load' => 300
];
// Notification methods
$config['notifications'] = [
'email' => [
'enabled' => false,
'smtp_host' => 'smtp.example.com',
'smtp_port' => 587,
'smtp_user' => 'ezmon@example.com',
'smtp_password' => 'EmailPassword123!',
'smtp_secure' => 'tls',
'from_address' => 'ezmon@example.com',
'from_name' => 'eZ Server Monitor',
'recipients' => ['admin@example.com']
],
'slack' => [
'enabled' => false,
'webhook_url' => 'https://hooks.slack.com/services/XXX/YYY/ZZZ',
'channel' => '#alerts',
'username' => 'eZ Monitor'
],
'webhook' => [
'enabled' => false,
'url' => 'https://api.example.com/alerts',
'method' => 'POST',
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer YOUR_TOKEN'
]
]
];
/*
* ============================================================================
* DATABASE SETTINGS
* ============================================================================
*/
// Database type (sqlite, mysql, postgresql)
$config['database_type'] = 'sqlite';
// SQLite configuration
$config['database'] = [
'sqlite' => [
'path' => '/var/lib/ez-server-monitor/ezmon.db'
],
'mysql' => [
'host' => 'localhost',
'port' => 3306,
'database' => 'ezmon',
'username' => 'ezmon',
'password' => 'DbPassword123!',
'charset' => 'utf8mb4'
],
'postgresql' => [
'host' => 'localhost',
'port' => 5432,
'database' => 'ezmon',
'username' => 'ezmon',
'password' => 'DbPassword123!',
'charset' => 'utf8'
]
];
// Data retention (days)
$config['data_retention'] = [
'raw_data' => 7,
'hourly_data' => 30,
'daily_data' => 365
];
/*
* ============================================================================
* PERFORMANCE SETTINGS
* ============================================================================
*/
// Enable caching
$config['cache_enabled'] = true;
// Cache type (file, redis, memcached)
$config['cache_type'] = 'file';
// Cache directory
$config['cache_dir'] = '/var/cache/ez-server-monitor';
// Cache TTL (seconds)
$config['cache_ttl'] = 10;
// Redis configuration (if cache_type is redis)
$config['redis'] = [
'host' => 'localhost',
'port' => 6379,
'password' => '',
'database' => 0
];
// Memcached configuration (if cache_type is memcached)
$config['memcached'] = [
'host' => 'localhost',
'port' => 11211
];
/*
* ============================================================================
* LOGGING SETTINGS
* ============================================================================
*/
// Enable logging
$config['logging_enabled'] = true;
// Log level (debug, info, warning, error)
$config['log_level'] = 'info';
// Log file
$config['log_file'] = '/var/log/ez-server-monitor/ezmon.log';
// Log format (text, json)
$config['log_format'] = 'text';
// Log rotation
$config['log_rotation'] = [
'max_size' => 10485760, // 10MB
'max_files' => 5,
'compress' => true
];
/*
* ============================================================================
* API SETTINGS
* ============================================================================
*/
// Enable API
$config['api_enabled'] = true;
// API version
$config['api_version'] = 'v1';
// API endpoint prefix
$config['api_prefix'] = '/api';
// API authentication
$config['api_auth_enabled'] = true;
// API keys
$config['api_keys'] = [
'monitoring-system' => [
'key' => 'your-api-key-here',
'permissions' => ['read:metrics', 'read:status'],
'rate_limit' => 100
]
];
// API rate limiting
$config['api_rate_limit'] = [
'enabled' => true,
'requests_per_minute' => 60,
'burst' => 10
];
/*
* ============================================================================
* CUSTOMIZATION
* ============================================================================
*/
// Custom CSS
$config['custom_css'] = '';
// Custom JavaScript
$config['custom_js'] = '';
// Custom logo
$config['logo'] = [
'enabled' => false,
'url' => '/assets/logo.png',
'height' => 40
];
// Custom favicon
$config['favicon'] = '/favicon.ico';
// Footer text
$config['footer_text'] = 'eZ Server Monitor';
// Show server hostname
$config['show_hostname'] = true;
// Show server IP
$config['show_ip'] = false;
/*
* ============================================================================
* MULTI-SERVER SETTINGS
* ============================================================================
*/
// Enable multi-server mode
$config['multi_server_enabled'] = false;
// Remote servers
$config['remote_servers'] = [
[
'name' => 'Web Server 01',
'host' => '192.168.1.10',
'port' => 22,
'user' => 'ezmon',
'auth_type' => 'key',
'key_file' => '/etc/ez-server-monitor/ssh/ezmon_key',
'enabled' => true
],
[
'name' => 'DB Server 01',
'host' => '192.168.1.20',
'port' => 22,
'user' => 'ezmon',
'auth_type' => 'key',
'key_file' => '/etc/ez-server-monitor/ssh/ezmon_key',
'enabled' => true
]
];
// SSH settings
$config['ssh'] = [
'timeout' => 30,
'keepalive' => true,
'keepalive_interval' => 60
];
/*
* ============================================================================
* PLUGIN SETTINGS
* ============================================================================
*/
// Enable plugins
$config['plugins_enabled'] = true;
// Enabled plugins
$config['enabled_plugins'] = [
'system',
'network',
'processes'
];
// Plugin configuration
$config['plugins'] = [
'system' => [
'enabled' => true,
'priority' => 1
],
'network' => [
'enabled' => true,
'priority' => 2
],
'processes' => [
'enabled' => true,
'priority' => 3
]
];
<?php
// /etc/ez-server-monitor/config.custom.php
// Custom metrics configuration
$config['custom_metrics'] = [
[
'name' => 'Docker Containers',
'type' => 'gauge',
'command' => 'docker ps -q | wc -l',
'unit' => 'containers',
'interval' => 30,
'enabled' => true
],
[
'name' => 'Nginx Connections',
'type' => 'gauge',
'command' => 'curl -s http://localhost/nginx_status | grep "Active connections" | awk \'{print $3}\'',
'unit' => 'connections',
'interval' => 10,
'enabled' => true
],
[
'name' => 'MySQL Connections',
'type' => 'gauge',
'command' => 'mysql -e "SHOW STATUS LIKE \'Threads_connected\'" 2>/dev/null | awk \'NR==2 {print $2}\'',
'unit' => 'connections',
'interval' => 30,
'enabled' => true
],
[
'name' => 'SSL Certificate Days',
'type' => 'gauge',
'command' => 'echo | openssl s_client -connect localhost:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null | cut -d= -f2',
'unit' => 'days',
'interval' => 3600,
'enabled' => true
]
];
<?php
// Dashboard layout configuration
$config['dashboard'] = [
'layout' => [
'columns' => 2,
'max_width' => 1200,
'spacing' => 20
],
'widgets' => [
[
'name' => 'CPU Usage',
'type' => 'gauge',
'position' => 'top-left',
'size' => 'medium',
'enabled' => true
],
[
'name' => 'Memory Usage',
'type' => 'gauge',
'position' => 'top-right',
'size' => 'medium',
'enabled' => true
],
[
'name' => 'Disk Usage',
'type' => 'bar',
'position' => 'middle-left',
'size' => 'large',
'enabled' => true
],
[
'name' => 'Network Traffic',
'type' => 'line',
'position' => 'middle-right',
'size' => 'large',
'enabled' => true
],
[
'name' => 'Processes',
'type' => 'table',
'position' => 'bottom',
'size' => 'full',
'enabled' => true
]
],
'colors' => [
'cpu' => [
'low' => '#4ade80',
'medium' => '#fbbf24',
'high' => '#f87171'
],
'memory' => [
'low' => '#60a5fa',
'medium' => '#fbbf24',
'high' => '#f87171'
],
'disk' => [
'low' => '#34d399',
'medium' => '#fbbf24',
'high' => '#f87171'
]
]
];
<?php
// Email notification configuration
$config['email_notification'] = [
'enabled' => true,
'smtp_host' => 'smtp.example.com',
'smtp_port' => 587,
'smtp_user' => 'ezmon@example.com',
'smtp_password' => 'EmailPassword123!',
'smtp_secure' => 'tls',
'from_address' => 'ezmon@example.com',
'from_name' => 'eZ Server Monitor',
'recipients' => ['admin@example.com', 'ops@example.com'],
'subject_template' => '[{{severity}}] eZ Monitor Alert: {{metric}} on {{hostname}}',
'body_template' => '
eZ Server Monitor Alert
Server: {{hostname}}
Metric: {{metric}}
Current Value: {{value}}
Threshold: {{threshold}}
Severity: {{severity}}
Time: {{timestamp}}
Please investigate.
--
eZ Server Monitor
{{dashboard_url}}
'
];
<?php
// Slack notification configuration
$config['slack_notification'] = [
'enabled' => true,
'webhook_url' => 'https://hooks.slack.com/services/XXX/YYY/ZZZ',
'channel' => '#alerts',
'username' => 'eZ Monitor',
'icon_emoji' => ':chart_with_upwards_trend:',
'template' => [
'attachments' => [
[
'color' => '{{severity_color}}',
'title' => 'eZ Monitor Alert: {{severity}}',
'fields' => [
['title' => 'Server', 'value' => '{{hostname}}', 'short' => true],
['title' => 'Metric', 'value' => '{{metric}}', 'short' => true],
['title' => 'Value', 'value' => '{{value}}', 'short' => true],
['title' => 'Threshold', 'value' => '{{threshold}}', 'short' => true]
],
'footer' => 'eZ Server Monitor',
'ts' => '{{timestamp_unix}}'
]
]
]
];
# Validate configuration syntax
php /var/www/html/ez-server-monitor/cli.php config:validate
# Check configuration
php /var/www/html/ez-server-monitor/cli.php config:show
# Test metrics collection
php /var/www/html/ez-server-monitor/cli.php metrics:test
# Test notifications
php /var/www/html/ez-server-monitor/cli.php notifications:test
# Restart web server
sudo systemctl restart apache2
# or
sudo systemctl restart nginx
sudo systemctl restart php-fpm
# Check service status
sudo systemctl status apache2
# View logs
sudo tail -f /var/log/ez-server-monitor/ezmon.log
sudo tail -f /var/log/apache2/error.log
# Initialize database
php /var/www/html/ez-server-monitor/cli.php db:init
# Backup database
php /var/www/html/ez-server-monitor/cli.php db:backup /var/backups/ezmon/
# Restore database
php /var/www/html/ez-server-monitor/cli.php db:restore /var/backups/ezmon/ezmon-backup.sql
# Clean old data
php /var/www/html/ez-server-monitor/cli.php db:cleanup --older-than=30d
# Access web interface
curl http://localhost/ez-server-monitor/
# Check API health
curl http://localhost/ez-server-monitor/api/health
# Get metrics
curl http://localhost/ez-server-monitor/api/metrics
# Get system info
curl http://localhost/ez-server-monitor/api/system
# Test metrics collection
php /var/www/html/ez-server-monitor/cli.php metrics:collect
# View collected metrics
php /var/www/html/ez-server-monitor/cli.php metrics:list
# Check metric history
php /var/www/html/ez-server-monitor/cli.php metrics:history --metric=cpu
# List alert rules
php /var/www/html/ez-server-monitor/cli.php alerts:list
# Test alert notification
php /var/www/html/ez-server-monitor/cli.php alerts:test --rule="High CPU"
# View alert history
php /var/www/html/ez-server-monitor/cli.php alerts:history
Every deployment is unique. We provide consulting for:
Get personalized assistance: office@linux-server-admin.com | Contact Page