server-stats

Server Stats Analyzer

A comprehensive bash script for analyzing and monitoring Linux server performance statistics in real-time.

Project Page: https://mirzasaikatahmmed.github.io/server-stats/

Overview

server-stats.sh is a lightweight, zero-dependency tool that provides detailed insights into your server’s performance. It displays system information, resource usage, and top processes in a beautifully formatted, color-coded output.

Features

Core Statistics

System Information

Visual Features

Requirements

No additional dependencies or installations required.

Installation

  1. Clone or download the script:
    git clone <repository-url>
    cd server-stats
    
  2. Make the script executable:
    chmod +x server-stats.sh
    

Usage

Run the script directly:

./server-stats.sh

Or from any location:

/path/to/server-stats.sh

Running with Sudo

Some features (like failed login attempts) may require elevated privileges:

sudo ./server-stats.sh

Creating an Alias

For convenience, add an alias to your .bashrc or .zshrc:

echo "alias serverstats='/path/to/server-stats.sh'" >> ~/.bashrc
source ~/.bashrc

Now you can run it with:

serverstats

Output Sections

1. System Information

2. CPU Usage

3. Memory Usage

4. Disk Usage

5. Process Monitoring

Color Coding

Permissions

The script works without root privileges, but some features provide more information when run as root:

Compatibility

Tested on:

Should work on any Linux distribution with standard GNU utilities.

Troubleshooting

Script doesn’t run

Ensure the script has execute permissions:

chmod +x server-stats.sh

Missing utilities

Install required packages (example for Debian/Ubuntu):

sudo apt-get install procps coreutils util-linux

No color output

Some terminals may not support ANSI color codes. Try running in a different terminal emulator.

Failed login attempts not showing

Run the script with sudo to access system log files:

sudo ./server-stats.sh

Use Cases

Example Output

╔════════════════════════════════════════════════════════════════╗
║           SERVER PERFORMANCE STATISTICS ANALYZER              ║
╔════════════════════════════════════════════════════════════════╗

==================== SYSTEM INFORMATION ====================
OS: Ubuntu 24.04.3 LTS
Kernel: 6.14.0-37-generic
Hostname: production-server
Uptime: up 7 hours, 22 minutes
Load Average: 0.45, 0.60, 0.36

==================== CPU USAGE ====================
Total CPU Usage: 7.0%
CPU Cores: 12

==================== MEMORY USAGE ====================
Total Memory: 7.4Gi
Used Memory: 4.1Gi (54.93%)
[████████████████████████████░░░░░░░░░░░░] 54.93%

... and more

Contributing

Contributions are welcome. Please ensure:

License

MIT License - feel free to use and modify as needed.

Author

Created as a learning project for understanding Linux server performance monitoring.

Version History