Files
statscollect/collect.sh
2024-05-30 18:51:12 -04:00

39 lines
937 B
Bash
Executable File

#!/bin/bash
minutes=$1
echo ""
echo "THIS SCRIPT IS FOR *FREEBSD* ONLY"
echo ""
greeting="Running perfcollect for $minutes minutes"
echo "$greeting"
echo "Will auto upload to ftp.ixsystem.com when completed."
echo "Airgapped Systems will need to exfiltrate *.csv"
echo ""
iterations=$1
echo "Starting gstat Collection"
timeout "$minutes"m gstat -C -s -d -o -p -I 60s > gstat.csv &
echo "Starting iostat Collection"
echo "Starting zpool iostat Collection"
echo "Starting cpu Collection"
for (( i=1; i<=$iterations; i++ )); do
# Execute the command
python3 zpooliostat.py
python3 iostat.py
python3 topstat.py
python3 ifstat.py
echo "minute: $i"
# Wait for 60 seconds before the next iteration
sleep 60
done
cp *.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