Nmon spreadsheet output, hourly rotation

Jbn1233
1 min readMay 2, 2020

--

I need the infinite while loop for make sure Nmon is running.

I had found that sometime Nmon stopped itself with no reason and I have lost all stat for that hour.

#!/bin/bash

# hourly rotatation
# nmon help
# -f spreadsheet output format [note: default -s300 -c288]
# -s <seconds> between refreshing the screen [default 2]
# -c <number> of refreshes [default millions]
# -t spreadsheet includes top processes


cd $(dirname 0)
nmon -ft -s 1 -c 3600 -m $PWD
sleep 1
while true
do
if pgrep -u $(whoami) -f "nmon -ft -s 1 -c 3600 -m $PWD" &>/dev/null
then
echo "Nmon is running"
else
echo "Nmon is NOT running, restart Nmonx"
#nmon -ft -s 1 -c 3600 -m $PWD
fi
sleep 1done

That is all.

--

--

Jbn1233
Jbn1233

Written by Jbn1233

Very short and simple notes for CKA/SRE and may not works on your environment | jbn1233@gmail.com | Bangkok, Thailand |

No responses yet