Skip to content

Ajay-Data/server-performance-stats

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

56 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Server Performance Stats

server-stats.sh is a Bash script that provides a quick snapshot of your Linux server’s performance. It monitors CPU usage, memory stats, disk usage, and the top resource-consuming processes.


πŸ”§ Features

  • βœ… CPU Usage: Real-time CPU utilization.
  • βœ… Memory Stats: Total, used, and available memory, with usage percentages.
  • βœ… Disk Usage: Disk space usage of the root (/) partition, with also percentage.
  • βœ… Top Processes:
    • Top 5 processes by CPU usage
    • Top 5 processes by Memory usage

πŸ“ Script Overview

  • πŸ’» CPU Usage - Uses top, grep, sed, and awk to extract CPU idle percentage and calculate actual usage.

  • 🧠 Memory Usage - Parses /proc/meminfo to get: MemTotal, MemAvailable.

  • πŸ’Ύ Disk Usage - Uses df -h / and df / to get: Human-readable disk size and Used and available disk space in KB.

  • πŸ“Œ Top Processes - Fetches the top 5 processes sorted by: CPU and Memory, through ps aux.


πŸš€ Usage

Make the script executable:

chmod +x server-stats.sh

Run the script:

./server-stats.sh

πŸ“¦ Dependencies

This script uses standard Linux tools:

  • top
  • awk
  • sed
  • grep
  • bc
  • ps
  • df

No external packages required.


πŸ§ͺ Pro Tip

To monitor performance at intervals, set up a cron job like:

*/5* ** * /path/to/server-stats.sh >> /path/to/log.txt

Feel free to customize or extend the script as needed!

Let me know if you want to include a table of contents, or sample screenshots!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%