Files
statscollect/collect.sh
Marc Mance 33e32e118e updated
2024-04-30 15:47:46 -04:00

29 lines
858 B
Bash
Executable File

#!/bin/bash
minutes=$1
greeting="Running perfcollect for $minutes minutes"
echo "$greeting"
echo "Will auto upload to iXsystem when completed."
echo "Airgapped Systems will need to exfiltrate /root/*.csv"
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"
gstat -C -s -d -o -p -I 60s > /root/gstat.csv & # Run the command in the background
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
DEBUGFILE=`midclt call system.debug_generate -job` && export DEBUGFILE
curl --user customer:ixcustomer -T $DEBUGFILE ftp.ixsystems.com/debug-`hostname`-`date +%Y%m%d%H%M`.tgz