Friday, August 14, 2015

Bash Script to Benchmark A Linux Server

Linux Penguin Logo

Whether you're using Linux on a VPS, dedicated server, laptop or desktop pc, this script will benchmark the hardware. It is written in BASH and will benchmark the CPU, memory, hard disk speed and internet connection speed.
1- CPU: The CPU Model, frequency, number of cores and cache size will be tested
2- Memory: The total amount of memory (RAM) and swap will be displayed
3- System: The server uptime will be displayed
4- Hard Disk speed: The Input/Output speed of the harddisk will be tested, and the total available disk space will be displayed.
5- The server's internet connection will be tested by downloading files across the globe, starting from USA to Europe to Asia. 
Note: A total of 1GB of data will be downloaded during execution

The script can be found on Github:
https://github.com/etiennerached/Server-Benchmark-Script

To run the script, simply execute the following 2 commands:
wget https://raw.githubusercontent.com/etiennerached/Server-Benchmark-Script/master/serverbenchmark.sh
bash serverbenchmark.sh 


An output example is as follows:
========== CPU Info ==========
CPU model :  Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
Number of cores :  1
CPU cache size :  15360 KB
CPU frequency :  2399.998 MHz
======= END of CPU Info =======

========== Memory Info ==========
Total RAM : 490 MB
Total swap : 511 MB
======= END of Memory Info =======

========== System Info ==========
System uptime :   31 days, 3:42,
======= END of System Info =======

========== Hard Disk Info ==========
Now Testing I/O Speed. This might take a while...
I/O speed : 40.8MB/s
Hard Disk Space:
/dev/vda1       43%
none    0%
udev    1%
tmpfs   1%
none    0%
none    0%
none    0%
======= END of Hard Disk Info =======

========== Download Speed Info ==========
Download speed from CDN CacheFly: 80.2MB/s
Download speed from Linode, East, USA: 83.3MB/s
Download speed from Linode, Central, USA: 3.10MB/s
Download speed from Linode, West, USA: 83.3MB/s
Download speed from Hetzner, Germany: 11.1MB/s
Download speed from OVH, France: 8.99MB/s
Download speed from Linode, UK, London: 11.5MB/s
Download speed from Leaseweb, Haarlem, NL: 42.0MB/s
Download speed from Linode, Tokyo, JP: 7.45MB/s
Download speed from Softlayer, Singapore: 7.15MB/s
======= END of Download Speed Info =======



Questions or comments? Post them below!