Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

📊 Server Performance Stats

A lightweight Bash script for quickly reviewing key Linux server performance metrics from the command line.

The script provides a concise system health snapshot including CPU, memory, disk usage, top resource-consuming processes, uptime, load average, logged-in users, and recent failed SSH login attempts when available.


✨ Features

  • 🖥️ Operating system information
  • 🧩 Kernel version
  • ⏱️ System uptime
  • 📈 Load average
  • 👥 Logged-in user count
  • ⚙️ CPU utilization
  • 🧠 Memory utilization
  • 💾 Disk utilization
  • 🔥 Top 5 processes by CPU usage
  • 🧮 Top 5 processes by memory usage
  • 🔐 Recent failed login attempts
  • 🕒 Report generation timestamp

🛠️ Technologies

  • Bash
  • Linux
  • awk
  • grep
  • ps
  • df
  • free
  • uptime
  • who
  • mpstat

📋 Requirements

  • Linux system
  • Bash shell
  • sysstat package for the mpstat command

Debian / Ubuntu

sudo apt update
sudo apt install sysstat

CentOS / RHEL

sudo yum install sysstat

🚀 Usage

Clone the repository:

git clone git@github.com:btambe-dev/server-performance-stats.git
cd server-performance-stats

Make the script executable:

chmod +x server-performance-stats.sh

Run it:

./server-performance-stats.sh

📊 Example Output

===========================================
 SERVER PERFORMANCE STATISTICS
===========================================
OS Version: Ubuntu 24.04 LTS
Kernel Version: 6.x.x
Uptime: up 3 days
Load Average: 0.12, 0.18, 0.14
Logged in users: 1
-------------------------------------------
[CPU Usage]
User: 4.12% System: 1.25% Idle: 94.63%
-------------------------------------------
[Memory Usage]
Total: 16Gi | Used: 5.8Gi | Free: 3.1Gi | Usage: 36.25%
-------------------------------------------
[Disk Usage]
Total: 120G | Used: 46G | Free: 68G | Usage: 41%
-------------------------------------------
[Top 5 Processes by CPU Usage]
...
-------------------------------------------
[Top 5 Processes by Memory Usage]
...
-------------------------------------------
Report generated on: Sat Aug 8 22:00:00 EDT 2026
===========================================

Output varies by system and workload.


🔍 What the Script Checks

System Information

The script retrieves:

  • Linux distribution name
  • Kernel version
  • Uptime
  • Load average
  • Number of logged-in users

CPU Usage

CPU statistics are collected using mpstat.

The report displays:

  • User CPU usage
  • System CPU usage
  • Idle CPU percentage

Memory Usage

Memory statistics are collected with free -h and processed with awk.

The report displays:

  • Total memory
  • Used memory
  • Free memory
  • Usage percentage

Disk Usage

The script uses df -h --total to summarize disk capacity.

Process Monitoring

The script lists the five processes consuming the most:

  • CPU
  • Memory

Failed Login Attempts

If /var/log/auth.log exists, the script displays the five most recent failed password attempts.

This section may require appropriate permissions depending on the Linux distribution and system configuration.


🎯 What This Project Demonstrates

This project demonstrates hands-on experience with:

  • Linux systems administration
  • Bash scripting
  • Server monitoring
  • Command-line troubleshooting
  • Process inspection
  • Resource utilization analysis
  • Log inspection
  • Basic security monitoring
  • Automation of routine administration tasks

🔮 Future Improvements

Potential enhancements include:

  • Command-line flags for selecting specific metrics
  • Threshold-based warnings
  • JSON or CSV output
  • Logging reports to a file
  • Email or webhook alerts
  • Support for additional Linux distributions
  • Network utilization metrics
  • Docker container statistics
  • Scheduled execution with cron
  • Automated testing with ShellCheck

👤 Author

Bedolf Tambe

Cloud • DevOps • Networking • Systems Administration • Software Engineering

About

Bash-based Linux server monitoring tool for CPU, memory, disk, processes, uptime, load, and system health.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages