How to test VDS, VPS or dedicated server

5 Dec 2017

Share the linux bash script to test a virtual private server (VPS), virtual dedicated server (VDS) or dedicated server.

cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo )
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
freq=$( awk -F: ' /cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo )
tram=$( free -m | awk 'NR==2 {print $2}' )
swap=$( free -m | awk 'NR==4 {print $2}' )
up=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }')
echo "CPU model : $cname"
echo "Number of cores : $cores"
echo "CPU frequency : $freq MHz"
echo "Total amount of ram : $tram MB"
echo "Total amount of swap : $swap MB"
echo "System uptime : $up"

io=$( ( dd if=/dev/zero of=test_$ bs=64k count=16k conv=fdatasync && rm -f test_$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' )
echo "I/O speed : $io"

i3d=$( wget -O /dev/null 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )
echo "Download speed from, Rotterdam, NL: $i3d"

As can you see, latest test is download speed test. You can add your specific test locations. Just google "looking glass". For example - Digital Ocean Looking Glass

So, save this script with .sh extension, for example - and then run:



CPU model :  QEMU Virtual CPU version (cpu64-rhel6)
Number of cores : 1
CPU frequency :  3392.292 MHz
Total amount of ram : 497 MB
Total amount of swap : 509 MB
System uptime :   57 days, 11:53,
I/O speed :  182 MB/s
Download speed from VPS.UA (UA-IX), Kharkiv, UA: 10.8MB/s
Download speed from ITL DC (UA-IX), Kharkiv, UA: 48.8MB/s
Download speed from TheHost (UA-IX), Kyiv Oblast, Boyarka, UA: 23.6MB/s
Download speed from Hosting Ukraine (UA-IX), UA: 19.3MB/s
Download speed from Globatel, Moscow, RU: 10.6MB/s
Download speed from CloudHosting, Riga, LV: 798KB/s
Download speed from SaulHost, Bucharest, RO: 2.25MB/s
Download speed from, Falkenstein, GE: 3.36MB/s
Download speed from, Rotterdam, NL: 3.85MB/s