Last active
January 23, 2020 10:04
-
-
Save abhirup-dev/d0cda05a6566cf473d85581b177b2b3f to your computer and use it in GitHub Desktop.
Gnuplot files/scripts to capture and plot linux system metrics in real-time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| gnuplot -e "fname='$1'" liveplot.gnu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/gnuplot | |
| set multiplot layout 3,1 | |
| unset xtics | |
| plot fname using 2:xticlabels(1) with lines t "Memory%" | |
| plot fname using 3:xticlabels(1) with lines t "Disk%" | |
| plot fname using 4:xticlabels(1) with lines t "CPU%" | |
| pause 0.5 | |
| reread | |
| set autoscale |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| TSTAMP=$(date +"%T-%M-%H") | |
| end=$((SECONDS+60)) | |
| while [ $SECONDS -lt $end ]; do | |
| MEMORY=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }') | |
| DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}') | |
| CPU=$(top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)}') | |
| # FREE=$(free| awk '/Mem/{print $3" "$4}') | |
| echo $TSTAMP" "$MEMORY" "$DISK" "$CPU | |
| sleep 1 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to execute:-
./logger.sh > out.dator./logger.sh | tee -a out.datto record metrics inout.dat(tee -aappends; onlyteeoverwrites)./getplot.sh out.datliveplot.gnuto support custom plotsUseful links:-