changed date format
This commit is contained in:
21
ixiostat.py
21
ixiostat.py
@@ -5,24 +5,8 @@ import os
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def convert_to_machine_readable(date_string):
|
||||
# Define the format string considering the time zone information (EDT)
|
||||
format_string = "%a %b %d %H:%M:%S %p %Z %Y"
|
||||
try:
|
||||
# Parse the date string using the format string
|
||||
datetime_obj = datetime.strptime(date_string, format_string)
|
||||
return datetime_obj
|
||||
except ValueError:
|
||||
print(f"given: {date_string}")
|
||||
print(
|
||||
f"Error: Invalid date format. Please provide a string in the format '{format_string}'."
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
# Define your shell command
|
||||
command = ["zpool", "iostat", "-Td", "-l", "-p", "-v", "-y", "1", "1"]
|
||||
command = ["zpool", "iostat", "-Tu", "-l", "-p", "-v", "-y", "1", "1"]
|
||||
|
||||
headerRow = [
|
||||
"time",
|
||||
@@ -63,9 +47,6 @@ def runZpoolIostat():
|
||||
# get timestamp
|
||||
timestamp = pool.splitlines()[0].strip()
|
||||
|
||||
if timestamp:
|
||||
timestamp = str(convert_to_machine_readable(timestamp))
|
||||
|
||||
else:
|
||||
# remove ------ lines
|
||||
pool = re.sub("^---.*", "", pool).strip()
|
||||
|
||||
Reference in New Issue
Block a user