mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-04-19 08:55:15 +00:00
clean up network info lookup and output, allow opt-out
This commit is contained in:
parent
f075baf59c
commit
84f47e80b6
@ -41,6 +41,7 @@ curl -sL yabs.sh | bash -s -- -flags
|
|||||||
* `-f`/`-d` this option disables the fio (disk performance) test
|
* `-f`/`-d` this option disables the fio (disk performance) test
|
||||||
* `-i` this option disables the iperf (network performance) test
|
* `-i` this option disables the iperf (network performance) test
|
||||||
* `-g` this option disables the Geekbench (system performance) test
|
* `-g` this option disables the Geekbench (system performance) test
|
||||||
|
* `-n` this option skips the network information lookup and print out
|
||||||
* `-h` this option prints the help message with usage, flags detected, and local package (fio/iperf) status
|
* `-h` this option prints the help message with usage, flags detected, and local package (fio/iperf) status
|
||||||
* `-r` this option reduces the number of iperf locations (Online.net/Clouvider LON+NYC) to lessen bandwidth usage
|
* `-r` this option reduces the number of iperf locations (Online.net/Clouvider LON+NYC) to lessen bandwidth usage
|
||||||
* `-4` this option overrides the Geekbench 5 performance test and runs a Geekbench 4 test instead
|
* `-4` this option overrides the Geekbench 5 performance test and runs a Geekbench 4 test instead
|
||||||
|
33
yabs.sh
33
yabs.sh
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Yet Another Bench Script by Mason Rowe
|
# Yet Another Bench Script by Mason Rowe
|
||||||
# Initial Oct 2019; Last update Jan 2023
|
# Initial Oct 2019; Last update Feb 2023
|
||||||
|
|
||||||
# Disclaimer: This project is a work in progress. Any errors or suggestions should be
|
# Disclaimer: This project is a work in progress. Any errors or suggestions should be
|
||||||
# relayed to me via the GitHub project page linked below.
|
# relayed to me via the GitHub project page linked below.
|
||||||
@ -12,7 +12,7 @@
|
|||||||
# performance via fio. The script is designed to not require any dependencies
|
# performance via fio. The script is designed to not require any dependencies
|
||||||
# - either compiled or installed - nor admin privileges to run.
|
# - either compiled or installed - nor admin privileges to run.
|
||||||
#
|
#
|
||||||
YABS_VERSION="v2023-02-03"
|
YABS_VERSION="v2023-02-26"
|
||||||
|
|
||||||
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
|
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
|
||||||
echo -e '# Yet-Another-Bench-Script #'
|
echo -e '# Yet-Another-Bench-Script #'
|
||||||
@ -59,17 +59,18 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# flags to skip certain performance tests
|
# flags to skip certain performance tests
|
||||||
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE
|
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH SKIP_NET PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE
|
||||||
GEEKBENCH_5="True" # gb5 test enabled by default
|
GEEKBENCH_5="True" # gb5 test enabled by default
|
||||||
|
|
||||||
# get any arguments that were passed to the script and set the associated skip flags (if applicable)
|
# get any arguments that were passed to the script and set the associated skip flags (if applicable)
|
||||||
while getopts 'bfdighr49jw:s:' flag; do
|
while getopts 'bfdignhr49jw:s:' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
b) PREFER_BIN="True" ;;
|
b) PREFER_BIN="True" ;;
|
||||||
f) SKIP_FIO="True" ;;
|
f) SKIP_FIO="True" ;;
|
||||||
d) SKIP_FIO="True" ;;
|
d) SKIP_FIO="True" ;;
|
||||||
i) SKIP_IPERF="True" ;;
|
i) SKIP_IPERF="True" ;;
|
||||||
g) SKIP_GEEKBENCH="True" ;;
|
g) SKIP_GEEKBENCH="True" ;;
|
||||||
|
n) SKIP_NET="True" ;;
|
||||||
h) PRINT_HELP="True" ;;
|
h) PRINT_HELP="True" ;;
|
||||||
r) REDUCE_NET="True" ;;
|
r) REDUCE_NET="True" ;;
|
||||||
4) GEEKBENCH_4="True" && unset GEEKBENCH_5 ;;
|
4) GEEKBENCH_4="True" && unset GEEKBENCH_5 ;;
|
||||||
@ -114,6 +115,7 @@ if [ ! -z "$PRINT_HELP" ]; then
|
|||||||
echo -e " -f/d : skips the fio disk benchmark test"
|
echo -e " -f/d : skips the fio disk benchmark test"
|
||||||
echo -e " -i : skips the iperf network test"
|
echo -e " -i : skips the iperf network test"
|
||||||
echo -e " -g : skips the geekbench performance test"
|
echo -e " -g : skips the geekbench performance test"
|
||||||
|
echo -e " -n : skips the network information lookup and print out"
|
||||||
echo -e " -h : prints this lovely message, shows any flags you passed,"
|
echo -e " -h : prints this lovely message, shows any flags you passed,"
|
||||||
echo -e " shows if fio/iperf3 local packages have been detected,"
|
echo -e " shows if fio/iperf3 local packages have been detected,"
|
||||||
echo -e " then exits"
|
echo -e " then exits"
|
||||||
@ -132,6 +134,7 @@ if [ ! -z "$PRINT_HELP" ]; then
|
|||||||
[[ ! -z $SKIP_FIO ]] && echo -e " -f/d, skipping fio disk benchmark test"
|
[[ ! -z $SKIP_FIO ]] && echo -e " -f/d, skipping fio disk benchmark test"
|
||||||
[[ ! -z $SKIP_IPERF ]] && echo -e " -i, skipping iperf network test"
|
[[ ! -z $SKIP_IPERF ]] && echo -e " -i, skipping iperf network test"
|
||||||
[[ ! -z $SKIP_GEEKBENCH ]] && echo -e " -g, skipping geekbench test"
|
[[ ! -z $SKIP_GEEKBENCH ]] && echo -e " -g, skipping geekbench test"
|
||||||
|
[[ ! -z $SKIP_NET ]] && echo -e " -n, skipping network info lookup and print out"
|
||||||
[[ ! -z $REDUCE_NET ]] && echo -e " -r, using reduced (3) iperf3 locations"
|
[[ ! -z $REDUCE_NET ]] && echo -e " -r, using reduced (3) iperf3 locations"
|
||||||
[[ ! -z $GEEKBENCH_4 ]] && echo -e " running geekbench 4"
|
[[ ! -z $GEEKBENCH_4 ]] && echo -e " running geekbench 4"
|
||||||
[[ ! -z $GEEKBENCH_5 ]] && echo -e " running geekbench 5"
|
[[ ! -z $GEEKBENCH_5 ]] && echo -e " running geekbench 5"
|
||||||
@ -248,10 +251,14 @@ echo -e "VM Type : $VIRT"
|
|||||||
|
|
||||||
# Function to get information from IP Address using ip-api.com free API
|
# Function to get information from IP Address using ip-api.com free API
|
||||||
function ip_info() {
|
function ip_info() {
|
||||||
local net_type="$(wget -qO- http://ip6.me/api/ | cut -d, -f1)"
|
# check for curl vs wget
|
||||||
local net_ip="$(wget -qO- http://ip6.me/api/ | cut -d, -f2)"
|
[[ ! -z $LOCAL_CURL ]] && DL_CMD="curl -s" || DL_CMD="wget -qO-"
|
||||||
|
|
||||||
local response=$(wget -qO- http://ip-api.com/json/$net_ip)
|
local ip6me_resp="$($DL_CMD http://ip6.me/api/)"
|
||||||
|
local net_type="$(echo $ip6me_resp | cut -d, -f1)"
|
||||||
|
local net_ip="$(echo $ip6me_resp | cut -d, -f2)"
|
||||||
|
|
||||||
|
local response=$($DL_CMD http://ip-api.com/json/$net_ip)
|
||||||
|
|
||||||
local country=$(echo "$response" | grep -Po '"country": *\K"[^"]*"')
|
local country=$(echo "$response" | grep -Po '"country": *\K"[^"]*"')
|
||||||
local country=${country//\"}
|
local country=${country//\"}
|
||||||
@ -274,7 +281,6 @@ function ip_info() {
|
|||||||
local as=$(echo "$response" | grep -Po '"as": *\K"[^"]*"')
|
local as=$(echo "$response" | grep -Po '"as": *\K"[^"]*"')
|
||||||
local as=${as//\"}
|
local as=${as//\"}
|
||||||
|
|
||||||
|
|
||||||
if [[ -n "$net_type" ]]; then
|
if [[ -n "$net_type" ]]; then
|
||||||
echo "Protocol : $net_type"
|
echo "Protocol : $net_type"
|
||||||
fi
|
fi
|
||||||
@ -296,11 +302,12 @@ function ip_info() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -e
|
if [ -z $SKIP_NET ]; then
|
||||||
echo -e "Basic Network Information:"
|
echo -e
|
||||||
echo -e "---------------------------------"
|
echo -e "Basic Network Information:"
|
||||||
ip_info
|
echo -e "---------------------------------"
|
||||||
|
ip_info
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -z $JSON ]; then
|
if [ ! -z $JSON ]; then
|
||||||
UPTIME_S=$(awk '{print $1}' /proc/uptime)
|
UPTIME_S=$(awk '{print $1}' /proc/uptime)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user