1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/linuxdash_ynh.git synced 2024-09-03 19:36:07 +02:00
linuxdash_ynh/sources/server/modules/shell_files/load_avg.sh

10 lines
No EOL
345 B
Bash
Executable file

#!/bin/bash
numberOfCores=$(/bin/grep -c 'model name' /proc/cpuinfo)
if [ $numberOfCores -eq 0 ]; then
numberOfCores=1
fi
result=$(/bin/cat /proc/loadavg | /usr/bin/awk '{print "{ \"1_min_avg\": " ($1*100)/'$numberOfCores' ", \"5_min_avg\": " ($2*100)/'$numberOfCores' ", \"15_min_avg\": " ($3*100)/'$numberOfCores' "}," }')
echo ${result%?}