Server Monitoring & Stats

Monitor server performance, resource usage, and web traffic with built-in and third-party monitoring tools.

Overview

Effective server monitoring is essential for maintaining a reliable LEMP stack. Monitoring helps you identify performance bottlenecks, detect anomalies before they become outages, plan capacity upgrades, and ensure your web applications are running optimally.

Centmin Mod provides several built-in monitoring tools and status endpoints out of the box. You can also integrate popular third-party monitoring solutions for more comprehensive dashboards, alerting, and historical data retention.

This page covers monitoring endpoints and tools available in the Centmin Mod LEMP stack. For component-specific configuration, see the Nginx, PHP-FPM, and MariaDB MySQL documentation pages.

Nginx Stub Status

Centmin Mod enables the Nginx stub_status module by default. This provides real-time connection statistics at the /nginx_status endpoint, restricted to localhost access only.

Accessing Nginx Status

curl http://127.0.0.1/nginx_status

Example Output

Active connections: 12
server accepts handled requests
 54321 54321 98765
Reading: 0 Writing: 3 Waiting: 9
Metric Description
Active connections Current number of active client connections including waiting
accepts Total accepted client connections since server start
handled Total handled connections (should equal accepts unless resource limits hit)
requests Total client requests served
Reading Connections where Nginx is reading the request header
Writing Connections where Nginx is writing the response back to the client
Waiting Keep-alive connections waiting for a new request

For more details on Nginx configuration and modules, see the Nginx Web Server documentation.

PHP-FPM Status

Centmin Mod configures PHP-FPM status and ping endpoints by default, allowing you to monitor PHP-FPM pool health, active processes, and request throughput.

Status Endpoint

Access the PHP-FPM status page for detailed pool statistics:

# Basic status
curl http://127.0.0.1/phpfpmstatus

# Full status with per-process details
curl http://127.0.0.1/phpfpmstatus?full

Key Status Metrics

Metric Description
pool Name of the PHP-FPM pool (e.g., www)
active processes Number of active PHP-FPM worker processes
idle processes Number of idle (waiting) worker processes
total processes Total number of current PHP-FPM processes
max active processes Maximum number of active processes since FPM started
accepted conn Total number of accepted connections
listen queue Number of requests waiting in the queue (should be 0)

Ping Endpoint

Use the ping endpoint for simple health checks:

curl http://127.0.0.1/phpfpmping
# Returns: pong

For full PHP-FPM configuration details, see the PHP-FPM documentation.

MySQL/MariaDB Monitoring

MariaDB provides several built-in commands for monitoring database performance, connection counts, and query activity.

Quick Status Check

# Basic status overview
mysqladmin status

# Extended status with all variables
mysqladmin extended-status

# Show active processes/queries
mysqladmin processlist

# Continuous monitoring (refresh every 2 seconds)
mysqladmin -i2 status

MySQL Shell Queries

# Show all active processes
mysql -e "SHOW PROCESSLIST;"

# Show global status variables
mysql -e "SHOW GLOBAL STATUS;"

# Check InnoDB engine status
mysql -e "SHOW ENGINE INNODB STATUS\G"

# Monitor connections and threads
mysql -e "SHOW GLOBAL STATUS LIKE 'Threads%';"
mysql -e "SHOW GLOBAL STATUS LIKE 'Connections';"

Avoid running SHOW ENGINE INNODB STATUS too frequently on production servers as it can impact performance. Use it for targeted troubleshooting rather than continuous monitoring.

For MariaDB configuration and management, see the MariaDB MySQL documentation.

System Resources

Linux provides powerful command-line tools for monitoring CPU, memory, disk I/O, and network activity in real time.

CPU & Process Monitoring

# Interactive process viewer (built-in)
top

# Enhanced process viewer (if installed)
htop

# Sort top by CPU usage
top -o %CPU

# Show top 10 CPU-consuming processes
ps aux --sort=-%cpu | head -11

Memory Usage

# Memory summary in human-readable format
free -m

# Detailed memory info
cat /proc/meminfo

# Virtual memory statistics (updated every 2 seconds)
vmstat 2

# Show top 10 memory-consuming processes
ps aux --sort=-%mem | head -11

Disk I/O

# I/O statistics (updated every 2 seconds)
iostat -x 2

# Disk usage summary
df -h

# I/O activity per process
iotop

System Activity Reports (SAR)

# Install sysstat if not present
yum install sysstat -y

# CPU usage every 2 seconds (5 iterations)
sar -u 2 5

# Memory usage
sar -r 2 5

# Network interface statistics
sar -n DEV 2 5

# Historical data for today
sar -u -f /var/log/sa/sa$(date +%d)

Centmin Mod Built-in Tools

Centmin Mod includes several built-in tools for system information gathering and performance benchmarking.

cminfo Command

The cminfo command shortcut provides a comprehensive overview of your server's LEMP stack configuration and status:

cminfo

This displays OS info, Centmin Mod version, Nginx version and compiled modules, PHP version and loaded extensions, MariaDB version, memory and disk usage, and more.

System Benchmarks

Centmin Mod provides benchmarking tools accessible via the centmin.sh menu or directly:

# Run centminmodbench.sh benchmark suite
# Tests CPU, memory, disk I/O, and network performance
centminmodbench

Linfo Server Stats Addon

Centmin Mod includes a Linfo addon that provides a web-based server information page showing CPU, memory, disk, network interfaces, and hardware details through a visual dashboard accessible via your browser.

Third-Party Monitoring

For comprehensive monitoring with dashboards, alerting, and historical data, you can integrate third-party monitoring tools with your Centmin Mod LEMP stack.

Netdata

Real-time performance monitoring with a beautiful web dashboard. Netdata auto-detects Nginx, PHP-FPM, and MariaDB and creates charts automatically.

  • Per-second granularity with zero-configuration auto-discovery
  • Built-in Nginx, PHP-FPM, and MySQL/MariaDB monitoring plugins
  • Low resource footprint and easy installation

Munin

A networked resource monitoring tool that creates graphs of server metrics over time. Uses a master/node architecture for multi-server setups.

  • Historical trend analysis with RRDtool-based graphing
  • Nginx and MySQL plugins included for LEMP stack monitoring
  • Alert thresholds with email notification support

Zabbix

Enterprise-grade monitoring platform with agent-based data collection, flexible alerting, and advanced visualization.

  • Templates for Nginx, PHP-FPM, and MariaDB out of the box
  • Customizable alerting via email, SMS, Slack, PagerDuty, and more
  • Scalable to thousands of servers with distributed monitoring

Uptime & External Monitoring

External monitoring services check your server from outside your network, alerting you to downtime, DNS issues, and SSL certificate expiry.

  • Services like UptimeRobot, Pingdom, or StatusCake provide HTTP/HTTPS endpoint checks
  • Public status pages for communicating uptime to users
  • Agent-based services also collect CPU, memory, and disk metrics from your server

Tip: When configuring notification thresholds for CPU and memory alerts on low-core VPS instances (1-2 CPU cores), set thresholds to 99% to avoid excessive alert noise from normal load spikes.

Need help with monitoring?

Join the community forums for monitoring setup guidance, best practices, and troubleshooting tips.