Linux Dash is a lightweight, web-based monitoring dashboard for Linux systems. It provides real-time information about system resources including CPU, memory, disk, network, and processes through a simple, responsive interface.
| File/Directory | Path | Purpose |
|---|---|---|
| Web files | /var/www/html/linux-dash/ |
Main application files |
| Config | /var/www/html/linux-dash/config.php |
Configuration file |
| Modules | /var/www/html/linux-dash/server/modules/ |
Backend modules |
| Plugins | /var/www/html/linux-dash/plugins/ |
Plugin directory |
| Cache | /var/cache/linux-dash/ |
Cached data |
| Logs | /var/log/linux-dash/ |
Log files |
| Web config | /etc/nginx/sites-available/linux-dash |
Nginx configuration |
<?php
/**
* /var/www/html/linux-dash/config.php
* Linux Dash Configuration
*/
// Prevent direct access
defined('LINUX_DASH') or die('Direct access not permitted');
/*
* ============================================================================
* GENERAL SETTINGS
* ============================================================================
*/
// Application title
$config['app_name'] = 'Linux Dash';
// Application version
$config['app_version'] = '2.0.0';
// Default language
$config['language'] = 'en';
// Supported languages
$config['supported_languages'] = ['en', 'es', 'fr', 'de', 'it', 'pt', 'ru', 'zh'];
// 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, htpasswd, ldap)
$config['auth_method'] = 'basic';
// Basic auth credentials
$config['auth_credentials'] = [
'admin' => password_hash('AdminPassword123!', PASSWORD_DEFAULT)
];
// Session settings
$config['session_lifetime'] = 3600; // 1 hour
$config['session_secure'] = false;
$config['session_httponly'] = true;
// IP whitelist (bypass authentication)
$config['ip_whitelist'] = [
'127.0.0.1',
'::1',
'192.168.1.0/24'
];
// IP blacklist
$config['ip_blacklist'] = [];
// Rate limiting
$config['rate_limit_enabled'] = true;
$config['rate_limit_requests'] = 100;
$config['rate_limit_window'] = 60; // seconds
// API key authentication
$config['api_key_enabled'] = false;
$config['api_keys'] = [
'monitoring-system' => [
'key' => 'your-api-key-here',
'permissions' => ['read']
]
];
/*
* ============================================================================
* SERVER SETTINGS
* ============================================================================
*/
// Server refresh interval (milliseconds)
$config['refresh_interval'] = 3000;
// Enable real-time updates
$config['realtime_enabled'] = true;
// Real-time update interval (milliseconds)
$config['realtime_interval'] = 2000;
// Server hostname override
$config['hostname_override'] = '';
// Server description
$config['server_description'] = '';
/*
* ============================================================================
* MODULE SETTINGS
* ============================================================================
*/
// Enable/disable modules
$config['modules'] = [
// System modules
'general-info' => true,
'os' => true,
'uptime' => true,
'hostname' => true,
'ip-addresses' => true,
// Resource modules
'cpu' => true,
'memory' => true,
'disk' => true,
'network' => true,
'load-average' => true,
// Process modules
'processes' => true,
'users' => true,
// Optional modules
'battery' => false,
'raid' => false,
'docker' => false,
'services' => false,
'temperature' => false,
'gpu' => false
];
// Module-specific settings
$config['module_settings'] = [
// CPU module
'cpu' => [
'show_cores' => true,
'show_frequency' => true,
'show_temperature' => false,
'show_load_average' => true,
'decimal_places' => 1
],
// Memory module
'memory' => [
'show_swap' => true,
'show_cache' => true,
'show_buffers' => true,
'decimal_places' => 1,
'unit' => 'auto' // auto, bytes, binary
],
// Disk module
'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 module
'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 module
'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
],
// Docker module
'docker' => [
'enabled' => false,
'show_containers' => true,
'show_images' => false,
'show_volumes' => false,
'show_networks' => false,
'docker_socket' => '/var/run/docker.sock'
],
// Services module
'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']
]
],
// Temperature module
'temperature' => [
'enabled' => false,
'sensors' => [
['name' => 'CPU', 'path' => '/sys/class/thermal/thermal_zone0/temp'],
['name' => 'GPU', 'path' => '/sys/class/thermal/thermal_zone1/temp']
]
],
// GPU module
'gpu' => [
'enabled' => false,
'nvidia_smi_path' => '/usr/bin/nvidia-smi'
]
];
/*
* ============================================================================
* 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' => 'linuxdash@example.com',
'smtp_password' => 'EmailPassword123!',
'smtp_secure' => 'tls',
'from_address' => 'linuxdash@example.com',
'from_name' => 'Linux Dash',
'recipients' => ['admin@example.com']
],
'slack' => [
'enabled' => false,
'webhook_url' => 'https://hooks.slack.com/services/XXX/YYY/ZZZ',
'channel' => '#alerts',
'username' => 'Linux Dash'
],
'webhook' => [
'enabled' => false,
'url' => 'https://api.example.com/alerts',
'method' => 'POST',
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer YOUR_TOKEN'
]
]
];
/*
* ============================================================================
* PERFORMANCE SETTINGS
* ============================================================================
*/
// Enable caching
$config['cache_enabled'] = true;
// Cache type (file, redis, memcached)
$config['cache_type'] = 'file';
// Cache directory
$config['cache_dir'] = '/var/cache/linux-dash';
// Cache TTL (seconds)
$config['cache_ttl'] = 5;
// 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/linux-dash/linux-dash.log';
// Log format (text, json)
$config['log_format'] = 'text';
// Log rotation
$config['log_rotation'] = [
'max_size' => 10485760, // 10MB
'max_files' => 5,
'compress' => true
];
/*
* ============================================================================
* UI SETTINGS
* ============================================================================
*/
// Theme
$config['theme'] = 'default'; // default, dark, light
// Dashboard layout
$config['dashboard_layout'] = [
'columns' => 2,
'max_width' => 1200,
'spacing' => 20
];
// Widgets configuration
$config['widgets'] = [
[
'name' => 'CPU Usage',
'module' => 'cpu',
'position' => 'top-left',
'size' => 'medium',
'enabled' => true
],
[
'name' => 'Memory Usage',
'module' => 'memory',
'position' => 'top-right',
'size' => 'medium',
'enabled' => true
],
[
'name' => 'Disk Usage',
'module' => 'disk',
'position' => 'middle-left',
'size' => 'large',
'enabled' => true
],
[
'name' => 'Network Traffic',
'module' => 'network',
'position' => 'middle-right',
'size' => 'large',
'enabled' => true
],
[
'name' => 'Processes',
'module' => 'processes',
'position' => 'bottom',
'size' => 'full',
'enabled' => true
]
];
// Colors
$config['colors'] = [
'cpu' => [
'low' => '#4ade80',
'medium' => '#fbbf24',
'high' => '#f87171'
],
'memory' => [
'low' => '#60a5fa',
'medium' => '#fbbf24',
'high' => '#f87171'
],
'disk' => [
'low' => '#34d399',
'medium' => '#fbbf24',
'high' => '#f87171'
],
'network' => [
'receive' => '#60a5fa',
'transmit' => '#34d399'
]
];
// Custom CSS
$config['custom_css'] = '';
// Custom JavaScript
$config['custom_js'] = '';
// Custom logo
$config['logo'] = [
'enabled' => false,
'url' => '/assets/logo.png',
'height' => 40
];
// Footer text
$config['footer_text'] = 'Linux Dash';
// Show hostname
$config['show_hostname'] = true;
// Show IP address
$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' => 'linuxdash',
'auth_type' => 'key',
'key_file' => '/etc/linux-dash/ssh/linuxdash_key',
'enabled' => true
],
[
'name' => 'DB Server 01',
'host' => '192.168.1.20',
'port' => 22,
'user' => 'linuxdash',
'auth_type' => 'key',
'key_file' => '/etc/linux-dash/ssh/linuxdash_key',
'enabled' => true
]
];
// SSH settings
$config['ssh'] = [
'timeout' => 30,
'keepalive' => true,
'keepalive_interval' => 60
];
/*
* ============================================================================
* 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 rate limiting
$config['api_rate_limit'] = [
'enabled' => true,
'requests_per_minute' => 60,
'burst' => 10
];
# /etc/nginx/sites-available/linux-dash
server {
listen 80;
server_name linux-dash.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name linux-dash.example.com;
# SSL configuration
ssl_certificate /etc/letsencrypt/live/linux-dash.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/linux-dash.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
ssl_prefer_server_ciphers off;
# Security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# Root directory
root /var/www/html/linux-dash;
index index.html index.php;
# Logging
access_log /var/log/nginx/linux-dash.access.log;
error_log /var/log/nginx/linux-dash.error.log;
# PHP processing
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
# Timeouts
fastcgi_connect_timeout 60s;
fastcgi_send_timeout 60s;
fastcgi_read_timeout 60s;
# Buffering
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
}
# Static files
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}
# Deny access to sensitive files
location ~ /\. {
deny all;
}
location ~* /(config\.php|\.git|\.env) {
deny all;
}
}
<?php
// Email notification configuration
$config['email_notification'] = [
'enabled' => true,
'smtp_host' => 'smtp.example.com',
'smtp_port' => 587,
'smtp_user' => 'linuxdash@example.com',
'smtp_password' => 'EmailPassword123!',
'smtp_secure' => 'tls',
'from_address' => 'linuxdash@example.com',
'from_name' => 'Linux Dash',
'recipients' => ['admin@example.com', 'ops@example.com'],
'subject_template' => '[{{severity}}] Linux Dash Alert: {{metric}} on {{hostname}}',
'body_template' => '
Linux Dash Alert
Server: {{hostname}}
Metric: {{metric}}
Current Value: {{value}}
Threshold: {{threshold}}
Severity: {{severity}}
Time: {{timestamp}}
Please investigate.
--
Linux Dash Monitoring
{{dashboard_url}}
'
];
<?php
// Slack notification configuration
$config['slack_notification'] = [
'enabled' => true,
'webhook_url' => 'https://hooks.slack.com/services/XXX/YYY/ZZZ',
'channel' => '#alerts',
'username' => 'Linux Dash',
'icon_emoji' => ':chart_with_upwards_trend:',
'template' => [
'attachments' => [
[
'color' => '{{severity_color}}',
'title' => 'Linux Dash 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' => 'Linux Dash',
'ts' => '{{timestamp_unix}}'
]
]
]
];
# Check PHP syntax
php -l /var/www/html/linux-dash/config.php
# Test configuration
php /var/www/html/linux-dash/cli.php config:validate
# Check module availability
php /var/www/html/linux-dash/cli.php modules:list
# Test metrics collection
php /var/www/html/linux-dash/cli.php metrics:test
# Restart PHP-FPM
sudo systemctl restart php-fpm
# or
sudo systemctl restart php7.4-fpm
# Restart Nginx
sudo systemctl restart nginx
# Check service status
sudo systemctl status nginx
sudo systemctl status php-fpm
# View logs
sudo tail -f /var/log/nginx/linux-dash.error.log
sudo tail -f /var/log/linux-dash/linux-dash.log
# Clear cache
rm -rf /var/cache/linux-dash/*
# Set cache permissions
chown -R www-data:www-data /var/cache/linux-dash
chmod -R 755 /var/cache/linux-dash
# Access web interface
curl http://localhost/linux-dash/
# Check API health
curl http://localhost/linux-dash/api/health
# Get system info
curl http://localhost/linux-dash/api/system
# Get CPU stats
curl http://localhost/linux-dash/api/cpu
# Get memory stats
curl http://localhost/linux-dash/api/memory
# List available modules
php /var/www/html/linux-dash/cli.php modules:list
# Test specific module
php /var/www/html/linux-dash/cli.php modules:test --module=cpu
# Check module output
php /var/www/html/linux-dash/server/modules/cpu.php
# Test alert notification
php /var/www/html/linux-dash/cli.php alerts:test
# View alert history
cat /var/log/linux-dash/alerts.log
Every deployment is unique. We provide consulting for:
Get personalized assistance: office@linux-server-admin.com | Contact Page