feat: diagnostic tool; load percentage
This commit is contained in:
parent
959721388e
commit
759852140a
1 changed files with 18 additions and 0 deletions
18
tools/diagnostics/load-percentage.sh
Executable file
18
tools/diagnostics/load-percentage.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
argi=1
|
||||
|
||||
while getopts '5qh' opt; do
|
||||
case $opt in
|
||||
5) argi=2 ;;
|
||||
q) argi=3 ;;
|
||||
h) echo "-5 = 5 minutes, -q = a quarter (15 min)"; exit ;;
|
||||
\?) exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
LOADVAL=$(awk "{ print \$$argi; }" < /proc/loadavg)
|
||||
NUMCPUS=$(getconf _NPROCESSORS_ONLN)
|
||||
echo "$LOADVAL * 100 / $NUMCPUS" | bc
|
||||
|
Loading…
Reference in a new issue