added startHour
This commit is contained in:
23
collect.py
23
collect.py
@@ -358,7 +358,7 @@ def welcome():
|
|||||||
print("########################################################################")
|
print("########################################################################")
|
||||||
print("# FreeNAS CORE/SCALE performance capture script v.02 #")
|
print("# FreeNAS CORE/SCALE performance capture script v.02 #")
|
||||||
print("########################################################################")
|
print("########################################################################")
|
||||||
print("# This script runs for x minutes and collects cpu/disk/network stats #")
|
print("# This script collects cpu/mem/disk/network/pool #")
|
||||||
print("# When it is completed, it will copy csv files to your /var/log folder #")
|
print("# When it is completed, it will copy csv files to your /var/log folder #")
|
||||||
print("# It will then attempt to take a debug and upload both to our FTP #")
|
print("# It will then attempt to take a debug and upload both to our FTP #")
|
||||||
print("# If not connected to the internet, it will have to be manually d/l #")
|
print("# If not connected to the internet, it will have to be manually d/l #")
|
||||||
@@ -369,10 +369,31 @@ def welcome():
|
|||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
|
||||||
|
def is_two_digit_number(number):
|
||||||
|
return 10 <= number < 100
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
welcome()
|
welcome()
|
||||||
|
|
||||||
minutes = int(input("Enter the duration in minutes: "))
|
minutes = int(input("Enter the duration in minutes: "))
|
||||||
|
startHour = 0
|
||||||
|
|
||||||
|
while not is_two_digit_number(startHour):
|
||||||
|
startHour = int(
|
||||||
|
input("Enter start time on 24hr format, 2-digit (ie 2pm = 14): ")
|
||||||
|
)
|
||||||
|
if not is_two_digit_number(startTime):
|
||||||
|
print("please enter only 2 digits.")
|
||||||
|
|
||||||
|
currentTime = datetime.datetime.now()
|
||||||
|
currentHour = currentTime.hour
|
||||||
|
|
||||||
|
while not currentHour == startHour:
|
||||||
|
print(f"Current Time: {currentTime}, script will start at: {startHour}:00")
|
||||||
|
datetime.datetime.sleep(5)
|
||||||
|
currentTime = datetime.datetime.now()
|
||||||
|
currentHour = currentTime.hour
|
||||||
|
|
||||||
print("Starting Collection")
|
print("Starting Collection")
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ iostat -xyd 1 1
|
|||||||
"f_s",
|
"f_s",
|
||||||
"f_await",
|
"f_await",
|
||||||
"aqu-sz",
|
"aqu-sz",
|
||||||
"%utilread_s",
|
"%util",
|
||||||
]
|
]
|
||||||
|
|
||||||
** CPU
|
** CPU
|
||||||
@@ -82,7 +82,6 @@ top -bn 1
|
|||||||
"mem_free",
|
"mem_free",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
** Network
|
** Network
|
||||||
|
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
|
|||||||
Reference in New Issue
Block a user