the script cpu.sh contains an error which cuases the shown CPU load to be more than 100%
false: Linux) vmstat -n 1 2 | tail -1 | awk '{print $(NF-3)+$(NF-2)}';;
right: Linux) vmstat -n 1 2 | tail -1 | awk '{print $(NF-1)+$(NF-2)}';;
HTH, Rainer
CPU Usage on RH8 false
[root@TUX root]# vmstat -V
procps version 2.0.7
[root@TUX root]# vmstat -n
procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id
0 0 0 0 34300 84804 282404 0 0 4 55 35 162 3 1 96
[root@TUX root]# vmstat -n 1 2 | tail -1 | awk '{print $(NF-3)+$(NF-2)}'
831
[root@TUX root]# vmstat -n 1 2 | tail -1 | awk '{print $(NF-1)+$(NF-2)}'
1
In prectice the one I sent you produces reliable and true results.
HTH, Rainer
procps version 2.0.7
[root@TUX root]# vmstat -n
procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id
0 0 0 0 34300 84804 282404 0 0 4 55 35 162 3 1 96
[root@TUX root]# vmstat -n 1 2 | tail -1 | awk '{print $(NF-3)+$(NF-2)}'
831
[root@TUX root]# vmstat -n 1 2 | tail -1 | awk '{print $(NF-1)+$(NF-2)}'
1
In prectice the one I sent you produces reliable and true results.
HTH, Rainer