Improve Server Operations with Server Performer Analyzer

Harendra BarotHarendra Barot
2 min read

Goal of this project is to write a script to analyze server performance stats.

Overview


server-stats.sh is a shell script designed to analyze basic server performance statistics. It provides detailed insights into system resource usage, top processes, and additional system information to help with debugging and performance monitoring.

Features


1. CPU Usage

  • Displays the total CPU usage percentage.

2. Memory Usage

  • Reports used and free memory, along with percentages.

3. Disk Usage- Shows used and free disk space, including percentages.

4. Top Processes

  • Lists the top 5 processes by:

    • CPU usage.

    • Memory usage.

5. Additional Stats (Stretch Goals)

  • OS version.

  • Uptime.

  • Load average.

  • Number of logged-in users.

  • Failed login attempts.

Usage Prerequisites


  • A Linux environment with the following utilities installed:

    • mpstat (from sysstat package).

    • awk.

    • ps.

    • df.

    • lsb_release (optional for OS version).

Running the Script

  1. Clone or download the script.

  2. Make the script executable: Command: chmod 700 server-stats.sh

  3. Execute the script: Command :./server-stats.sh

    Output:

    How it Helps in Debugging


    • Quickly identify resource bottlenecks (CPU, Memory, Disk).

    • Pinpoint processes consuming excessive system resources.

    • Gain a comprehensive view of system performance with minimal effort.


Limitations


  • Requires access to /var/log/auth.log for failed login attempts.

  • Dependencies like sysstat (for mpstat) must be installed.

    Summary:


In today's fast-paced IT environment, keeping an eye on server performance is essential for maintaining system reliability and efficiency.

  • server-stats.sh is designed to simplify server performance analysis and debugging.
0
Subscribe to my newsletter

Read articles from Harendra Barot directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Harendra Barot
Harendra Barot

I'm an IT professional and business analyst, sharing my day-to-day troubleshooting challenges to help others gain practical experience while exploring the latest technology trends and DevOps practices. My goal is to create a space for exchanging ideas, discussing solutions, and staying updated with evolving tech practices.