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
Clone or download the script.
Make the script executable: Command: chmod 700 server-stats.sh
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
(formpstat
) 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.