Skip to content

Instantly share code, notes, and snippets.

@alq666
Created August 7, 2012 23:12
Show Gist options
  • Save alq666/3290405 to your computer and use it in GitHub Desktop.
Save alq666/3290405 to your computer and use it in GitHub Desktop.
iostat.py
from statsd import statsd
import sys
device = sys.argv[1]
while True:
a = sys.stdin.readline().strip()
data = a.split()
if len(data) == 3:
try:
values = [float(d) for d in data]
statsd.gauge("system.io.tx_size", float(values[0]) * 1024, tags=[device])
statsd.gauge("system.io.tx_per_s", float(values[1]), tags=[device])
stastd.gauge("system.io.throughput", float(values[2]) * 1024 * 1024, tags=[device])
except:
pass
@alq666
Copy link
Author

alq666 commented Aug 7, 2012

iostat -w 1 -d disk1 | python iostat.py disk0

@alq666
Copy link
Author

alq666 commented Aug 7, 2012

Sorry, I meant:

iostat -w 1 -d disk1 | python iostat.py disk1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment