Example Of Capturing IOStat With Python

The below Example captures IOStat output with Python in Solaris #!/bin/python import subprocess import csv io_c = subprocess.Popen([‘iostat’, ‘-xnsMr’, ‘1’, ‘2’], stdout=subprocess.PIPE, shell=False, stderr=subprocess.PIPE) stdout = io_c.communicate()[0] lc = len(stdout.split(‘n’)) it_lc = lc / 2 + 2 reader = csv.reader(stdout.split(‘n’)[it_lc:], delimiter=’,’) for row in reader: if any(row): #print row print row[0],row[1],row[2],row[3],row[7],row[8],row[9],row[10] Output should look similar …

Example Of Capturing IOStat With Python Read More »