Skip to content

Commit

Permalink
iostat.py: add statistic metric util.
Browse files Browse the repository at this point in the history
Signed-off-by: Vasiliy Kiryanov <[email protected]>
  • Loading branch information
soarpenguin authored and vasiliyk committed Jun 6, 2014
1 parent 21b965c commit ef9a87b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions collectors/0/iostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def main():
device))

ret = is_device(device, 0)
# if a device or a partition, calculate the svctm/await/util"""
if ret:
stats = dict(zip(FIELDS_DISK, values[3:]))
nr_ios = float(stats.get("read_requests")) + float(stats.get("write_requests"))
Expand All @@ -173,14 +174,14 @@ def main():

if tput:
svctm = util / tput
print ("%s%s %d %.2f dev=%s" % (metric, "svctm", ts, svctm, device))

if nr_ios:
rd_ticks = stats.get("msec_read")
wr_ticks = stats.get("msec_write")
await = (float(rd_ticks) + float(wr_ticks)) / float(nr_ios)
print ("%s%s %d %.2f dev=%s" % (metric, "svctm", ts, svctm, device))
print ("%s%s %d %.2f dev=%s" % (metric, "await", ts, await, device))
#print ("%s%s %d %.2f dev=%s" % (metric, "util", ts, float(util/10.0), device))
print ("%s%s %d %.2f dev=%s" % (metric, "util", ts, float(util/1000.0), device))

elif len(values) == 7:
# partial stats line
Expand Down

0 comments on commit ef9a87b

Please sign in to comment.