dot

packages and services management
Log | Files | Refs | README

commit e9ade571136243e80414170ab8b09659a39a5c11
parent eb594865c496336c4ab0246d2f96ff6181079143
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Thu, 27 Jul 2017 12:13:25 +0200

bin/monitor: set constant height and 15 mn load avg

Diffstat:
Mbin/monitor | 31++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/bin/monitor b/bin/monitor @@ -20,16 +20,16 @@ case "$(uname)" in (Solaris) mem=free cpu=id bi='' bo='' b="$disks" ;; esac -[ $# = 0 ] && -vmstat 1 2 | awk -v mem="$mem" -v cpu="$cpu" -v bi="$bi" -v bo="$bo" ' +[ $# = 0 ] && while : +do vmstat $((1)) 2 | +awk -v mem="$mem" -v cpu="$cpu" -v bi="$bi" -v bo="$bo" ' BEGIN { "date +%s" | getline date "hostname" | getline host "uptime" | getline load - sub(/.*[Ll]oad[^0-9]*/, "", load) - sub(/[^0-9.].*/, "", load) + sub(/.* /, "", load) while ("df" | getline) if ($1 ~ "^/dev/" || $1 == "zroot") stor += $4 @@ -56,6 +56,7 @@ NR >= 4 { print host " " date " " mem " " cpu " " load " " diskio " " stor }' >> "$VAR/stat/now" +done # --- results ------------------------------------------------------------------ @@ -73,19 +74,19 @@ done <<EOF $(tail -n 120 "$VAR/stat/now") EOF -p() { printf '\n\n[ %s ]\n\n' "$*"; } +o() { printf '\n\n[ %s ]\n\n' "$*"; } -p 'memory' -printf %s "$memv" | plot -y $((1 << 17)) +o memory + printf %s "$memv" | plot -h 30 -p 'cpu' -printf %s "$cpuv" | plot -y 5 +o cpu + printf %s "$cpuv" | plot -h 30 -p 'load' -printf %s "$loadv" | plot -y 0.1 +o load + printf %s "$loadv" | plot -h 30 -p 'diskio' -printf %s "$diskiov" | plot -y 256 +o diskio + printf %s "$diskiov" | plot -h 30 -p 'stor' -printf %s "$storv" | plot -y 30000 +o stor + printf %s "$storv" | plot -h 30