Created
July 10, 2018 20:34
-
-
Save pbrandiezs/98188c132e806f7f4c434b291d386ab7 to your computer and use it in GitHub Desktop.
Ruby example using %Q to parse iowait
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
def getIOWait | |
command_to_run = %Q[iostat 15 2 | awk 'BEGIN{RS=ORS="\\n\\n";FS=OFS="\\n"}/avg-cpu:/' | tail -2 | head -1 | awk {'print $4'}] | |
result = `#{command_to_run}` | |
# result = '20.0' | |
result.to_f | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment