Skip to content
Snippets Groups Projects
Commit 934a246a authored by Théo - Le Filament's avatar Théo - Le Filament
Browse files

fix missing zero for cpu usage lower than 1%

parent ef3347ea
Branches
No related tags found
No related merge requests found
...@@ -77,7 +77,7 @@ for container_stats in ${running_containers_stats}; do ...@@ -77,7 +77,7 @@ for container_stats in ${running_containers_stats}; do
all_cpu=$(/usr/bin/awk -F ':' '{print +$2}' <(echo $container_stats)) all_cpu=$(/usr/bin/awk -F ':' '{print +$2}' <(echo $container_stats))
mem=$(/usr/bin/awk -F ':' '{print +$3}' <(echo $container_stats)) mem=$(/usr/bin/awk -F ':' '{print +$3}' <(echo $container_stats))
proc_number=$(nproc --all) proc_number=$(nproc --all)
cpu=$(echo "scale=2; ${all_cpu} / ${proc_number}" | bc) cpu=$(echo "${all_cpu} ${proc_number}" | /usr/bin/awk '{printf "%.2f", $1 / $2}')
status='OK' status='OK'
[[ ${cpu%.*} -ge $cpu_threshold_warning ]] && status='WARNING' [[ ${cpu%.*} -ge $cpu_threshold_warning ]] && status='WARNING'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment