diff --git a/collect.py b/collect.py index 2398824..779feb2 100644 --- a/collect.py +++ b/collect.py @@ -298,7 +298,9 @@ def collect_data(minutes): if is_freebsd(): coreCPUstat() coreMemstat() - coreIostat_disk() + + # gives same data each interval + # coreIostat_disk() if i == minutes: print("") @@ -433,40 +435,42 @@ def main(): print("Starting Collection") # Collect data - # if is_freebsd(): - # # timeout = f"{minutes}m" - # # "timeout", - # # timeout, + if is_freebsd(): + # timeout = f"{minutes}m" + # "timeout", + # timeout, - # gstat_command = [ - # "gstat", - # "-C", - # "-s", - # "-d", - # "-o", - # "-p", - # "-I", - # "5s", - # ] + gstat_command = [ + "gstat", + "-C", + "-s", + "-d", + "-o", + "-p", + "-I", + "5s", + ">", + "gstat.csv", + ] - # with open("gstat.csv", "a") as output_file: - # # Create a Popen object with stdout redirected to the file - # process = subprocess.Popen(gstat_command, stdout=output_file) + # with open("gstat.csv", "a") as output_file: + # Create a Popen object with stdout redirected to the file + process = subprocess.Popen(gstat_command) collect_data(minutes) # # kill gstat if freebsd - # if is_freebsd(): - # process.terminate() - # process.kill() + if is_freebsd(): + process.terminate() + process.kill() except KeyboardInterrupt: print("Caught Ctrl-C, cancelling collection...") # kill gstat if freebsd - # if is_freebsd(): - # process.terminate() - # process.kill() - # exit() + if is_freebsd(): + process.terminate() + process.kill() + exit() # Copy data files to /var/log (replace with appropriate copying function) collect_csv()