Created
October 28, 2019 21:36
-
-
Save rchakode/f2b61d21224511c6f0b8ef5c27637eae to your computer and use it in GitHub Desktop.
Script that periodically monitor system disks counters using sar utility, samples are outputted to stdin
This file contains 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 | |
SAMPLING_INTERVAL=5 | |
GRAPHITE_SERVER="127.0.0.1" | |
GRAPHITE_CARBON_PAINTEXT_PORT=2003 | |
LC_ALL=C \ | |
sar -d $SAMPLING_INTERVAL | \ | |
gawk -vhostname="$(hostname)" '{ | |
if (NF == 10 && $2 != "DEV") { | |
timestamp = systime(); | |
printf("%s.%s.rd_sec %s %d\n", hostname, $2, $4, timestamp); | |
printf("%s.%s.wr_sec %s %d\n", hostname, $2, $5, timestamp); | |
printf("%s.%s.await %s %d\n", hostname, $2, $8, timestamp); | |
printf("%s.%s.util %s %d\n", hostname, $2, $10, timestamp); | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment