updated killswitch
This commit is contained in:
13
collect.sh
13
collect.sh
@@ -6,21 +6,12 @@ greeting="Running perfcollect for $minutes minutes"
|
|||||||
echo "$greeting"
|
echo "$greeting"
|
||||||
echo "Will auto upload to iXsystem when completed."
|
echo "Will auto upload to iXsystem when completed."
|
||||||
echo "Airgapped Systems will need to exfiltrate /root/*.csv"
|
echo "Airgapped Systems will need to exfiltrate /root/*.csv"
|
||||||
|
echo ""
|
||||||
|
|
||||||
python3 ./collect.zpool.iostat.py --minutes $minutes &
|
python3 ./collect.zpool.iostat.py --minutes $minutes &
|
||||||
|
|
||||||
start_time=$(date +%s) # Get start time in seconds since epoch
|
|
||||||
duration=$(($1/60)) # Set duration in seconds (here: 5 minutes)
|
|
||||||
|
|
||||||
echo "running gstat"
|
echo "running gstat"
|
||||||
gstat -C -s -d -o -p -I 60s > /root/gstat.csv & # Run the command in the background
|
timeout "$minutes"m gstat -C -s -d -o -p -I 60s > /root/gstat.csv &
|
||||||
|
|
||||||
while [[ $(($(date +%s) - $start_time)) -lt $duration ]]; do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "killing gstat"
|
|
||||||
pkill gstat
|
|
||||||
|
|
||||||
cp /root/zpool_iostat.csv /root/gstat.csv /var/log
|
cp /root/zpool_iostat.csv /root/gstat.csv /var/log
|
||||||
|
|
||||||
|
|||||||
@@ -322,9 +322,7 @@ if __name__ == "__main__":
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
TIMETORUN = args.minutes
|
TIMETORUN = args.minutes
|
||||||
|
|
||||||
print("Script started.")
|
|
||||||
try:
|
try:
|
||||||
run_zpool_iostat(INTERVAL, COUNT, OUTPUT_FILE, UPDATE_INTERVAL, TIMETORUN)
|
run_zpool_iostat(INTERVAL, COUNT, OUTPUT_FILE, UPDATE_INTERVAL, TIMETORUN)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An error occurred: {e}")
|
print(f"An error occurred: {e}")
|
||||||
print("Script ended.")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user