corrected filename error in zpool iostat
This commit is contained in:
@@ -36,14 +36,6 @@ def runZpoolIostat():
|
|||||||
|
|
||||||
# Check the return code (0 for success)
|
# Check the return code (0 for success)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
# Check if the file exists
|
|
||||||
if not os.path.exists(filename):
|
|
||||||
# Create the file in write mode ('w') if it doesn't exist
|
|
||||||
with open(filename, "w", newline="") as csvfile:
|
|
||||||
csv_writer = csv.writer(csvfile)
|
|
||||||
# Write the header row (optional)
|
|
||||||
csv_writer.writerow(headerRow)
|
|
||||||
|
|
||||||
# Access the captured output as a string
|
# Access the captured output as a string
|
||||||
output = result.stdout
|
output = result.stdout
|
||||||
|
|
||||||
@@ -81,6 +73,14 @@ def runZpoolIostat():
|
|||||||
poolname = lineData[0]
|
poolname = lineData[0]
|
||||||
filename = poolname + "-zio.csv"
|
filename = poolname + "-zio.csv"
|
||||||
|
|
||||||
|
# Check if the file exists
|
||||||
|
if not os.path.exists(filename):
|
||||||
|
# Create the file in write mode ('w') if it doesn't exist
|
||||||
|
with open(filename, "w", newline="") as csvfile:
|
||||||
|
csv_writer = csv.writer(csvfile)
|
||||||
|
# Write the header row (optional)
|
||||||
|
csv_writer.writerow(headerRow)
|
||||||
|
|
||||||
# Now open the file in append mode ('a')
|
# Now open the file in append mode ('a')
|
||||||
with open(filename, "a", newline="") as csvfile:
|
with open(filename, "a", newline="") as csvfile:
|
||||||
csv_writer = csv.writer(csvfile)
|
csv_writer = csv.writer(csvfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user