corrected indent
This commit is contained in:
18
collect.py
18
collect.py
@@ -19,6 +19,7 @@ def is_debian():
|
||||
# Debian-based systems often have 'debian' in their platform string
|
||||
return "linux" in platform.platform().lower()
|
||||
|
||||
|
||||
def getTimestamp():
|
||||
timestamp = time.time()
|
||||
local_time = time.localtime(timestamp)
|
||||
@@ -36,6 +37,7 @@ def runCollect(command):
|
||||
|
||||
return result.stderr
|
||||
|
||||
|
||||
def scaleIostat_disk():
|
||||
command = ["iostat", "-xyd", "1", "1"]
|
||||
filename = "ioStat.csv"
|
||||
@@ -101,7 +103,7 @@ def coreIostat_cpu():
|
||||
else:
|
||||
print(f"Error running command: {collect}")
|
||||
|
||||
|
||||
|
||||
def coreifstat():
|
||||
command = ["iostat", "-C", "-t", "proc", "-d"]
|
||||
filename = "cpuStat.csv"
|
||||
@@ -115,12 +117,12 @@ def coreifstat():
|
||||
|
||||
lineData = lineData[:-2] + [0] + lineData[-2:]
|
||||
|
||||
if lineData:
|
||||
with open(filename, "a", newline="") as csvfile:
|
||||
csv_writer = csv.writer(csvfile)
|
||||
lineData.insert(0, "cpu")
|
||||
lineData.insert(0, getTimestamp())
|
||||
csv_writer.writerow(lineData)
|
||||
if lineData:
|
||||
with open(filename, "a", newline="") as csvfile:
|
||||
csv_writer = csv.writer(csvfile)
|
||||
lineData.insert(0, "cpu")
|
||||
lineData.insert(0, getTimestamp())
|
||||
csv_writer.writerow(lineData)
|
||||
|
||||
else:
|
||||
print(f"Error running command: {collect}")
|
||||
@@ -195,7 +197,7 @@ def collect_data(minutes, interval):
|
||||
|
||||
if is_freebsd():
|
||||
coreIostat_cpu()
|
||||
|
||||
|
||||
if i == 1:
|
||||
print("Minute:", end="", flush=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user