dot

packages and services management
Log | Files | Refs | README

commit e4c4c5603d971a5ed063d27aa9208e6492dacdb3
parent 8b6a072ca66b8e75813eea65ea3e17c791f76f7c
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed,  7 Feb 2018 12:07:04 +0100

monit: time series monaged by ploot

Diffstat:
Mbin/monit | 45+++------------------------------------------
1 file changed, 3 insertions(+), 42 deletions(-)

diff --git a/bin/monit b/bin/monit @@ -41,48 +41,10 @@ NR >= 4 { diskio = table[bi] + table[bo]; for (disk in disks) diskio += table[disks[disk]]; - print(host " " time " " mem " " cpu " " load " " diskio " " stor); + print(time " " mem " " cpu " " load " " diskio " " stor); fflush(); }' -awk_plot=' -#STEP offset between each entry - -BEGIN { - fields[2] = "time" - fields[3] = "mem" - fields[4] = "cpu" - fields[5] = "load" - fields[6] = "diskio" - fields[7] = "storage" -} - -{ - nfields = split($0, line, " ") - for (i = 1; i <= nfields; i++) - data[i"-"NR] = line[i] -} - -END { - # find the alignment of the data timestamps (phase) - for (i = 1; i <= NR; i++) - start += data[2"-"i] % STEP - start = int(start / NR + STEP / 2) - start += data[2"-"1] - data[2"-"1] % STEP - for (i = 3; i <= nfields; i++) { - offset = start - for (j = 1; j <= NR; j++) { - while (data[2"-"j] > offset) { - printf " ?" - offset += STEP - } - offset += STEP - printf " %s", data[i"-"j] - } - print "" - } -}' - case "$(uname)" in (Linux) mem='free' bi='bi' bo='bo' ;; (*BSD) mem='fre' bi='' bo='' ;; @@ -104,9 +66,8 @@ case "${1}" in ;; (plot) [ "${#}" -ne 2 ] && [ "${#}" -ne 3 ] && exec "${0}" - tail -n 80 "${MONIT}" | - awk -v STEP="${2:?argument missing} step}" "${awk_plot}" | - ploot -h "${3:-10}" + cut -d ' ' -f 2,7 "${MONIT}" | sed 's/ /,/' | + ploot -o "${2:?step required}" ;; (*) echo 'usage: monit step | record | plot delay'