From 270467d6866cd78f40316c259aaf44f0152f0ecf Mon Sep 17 00:00:00 2001 From: Sandra Date: Tue, 8 Feb 2022 17:06:00 +0100 Subject: [PATCH] Include uptime and cpu sockets/cores/threads in the report meta --- frontend/public/otimings.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/public/otimings.sh b/frontend/public/otimings.sh index 0d6824c..4e66499 100644 --- a/frontend/public/otimings.sh +++ b/frontend/public/otimings.sh @@ -17,12 +17,21 @@ print_metadata() { provider=$(echo "$noproxyout" | grep -oP '"provider":(\s+)?"([^"\\]|\\.)*",?' | awk -F '"' '{print $4}') country=$(echo "$noproxyout" | grep -oP '"country":(\s+)?"([^"\\]|\\.)*",?' | awk -F '"' '{print $4}') + cpuarch=$(lscpu | grep '^Architecture: ' | cut -d\ -f3- | awk '{$1=$1; print}') + cpumodel=$(lscpu | grep '^Model name: ' | cut -d\ -f3- | awk '{$1=$1; print}') + cputhreadspercore=$(lscpu | grep '^Thread(s) per core: ' | cut -d\ -f4- | awk '{$1=$1; print}') + cpucorespersocket=$(lscpu | grep '^Core(s) per socket: ' | cut -d\ -f4- | awk '{$1=$1; print}') + cpusockets=$(lscpu | grep '^Socket(s): ' | cut -d\ -f4- | awk '{$1=$1; print}') + echo "#" echo "# Okaeri Timings 1.0" echo "#" echo "# User: $(with_fallback "" $(whoami))" echo "# Hostname: $(with_fallback "" $(hostname))" echo "#" + echo "# Startup: $(with_fallback "" $(uptime -s))" + echo "# Uptime: $(with_fallback "" $(uptime -p))" + echo "#" echo "# IP: $(with_fallback "" $ip)" echo "# ASN: $(with_fallback "" $asn)" echo "# Provider: $(with_fallback "" $provider)" @@ -31,8 +40,8 @@ print_metadata() { echo "# Kernel: $(with_fallback "" $(uname -r))" echo "# OS: $(with_fallback "" $(cat /etc/os-release | grep PRETTY_NAME | awk -F '"' '{print $2}'))" echo "#" - echo "# Arch: $(with_fallback "" $(lscpu | grep '^Architecture: ' | cut -d\ -f3- | awk '{$1=$1; print}'))" - echo "# CPU: $(with_fallback "" $(lscpu | grep '^Model name: ' | cut -d\ -f3- | awk '{$1=$1; print}'))" + echo "# Arch: $(with_fallback "" $cpuarch)" + echo "# CPU: $(with_fallback "" $cpumodel) [$(with_fallback "?" $cpusockets) x $(with_fallback "?" $cpucorespersocket) x $(with_fallback "?" $cputhreadspercore)]" echo "#" echo "# Hypervisor: $(with_fallback "N/A" $(lscpu | grep '^Hypervisor vendor: ' | cut -d\ -f3- | awk '{$1=$1; print}'))" echo "# Virtualization: $(with_fallback "N/A" $(lscpu | grep '^Virtualization type: ' | cut -d\ -f3- | awk '{$1=$1; print}'))" @@ -119,4 +128,3 @@ else echo "[$(date '+%Y/%m/%d %H:%M:%S')] Done!" fi -