-
Notifications
You must be signed in to change notification settings - Fork 3
/
gather.sh
executable file
·58 lines (47 loc) · 1.19 KB
/
gather.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# Information gathering script written by Craig Dods
# 15/02/2011
# This script is provided for debugging purposes only
# with no warranty. User assumes all risk
#
# Interrupt this script with a Control-C to stop
#
# Collect stats once per $sleep_time, in sec. Tunable.
# 5 min by default, 86400 seconds = 1 day
sleep_time=600
cur_time=`date +'%m%d%H%M%S'`
LOG_FILE="CP-$cur_time.log"
trap cleanup 2 3 5 6 9 11
cleanup ()
{
echo > /dev/tty
echo "Submit $LOG_FILE to support site" > /dev/tty
exit 0
}
exec_cmd ()
{
echo "================ output of $1 =================="
eval $1
}
# collect stats per $sleep_time.
while :
do
cur_time=`date`
echo "$cur_time {{{"
echo "============== Hostname ==============="
hostname
echo "============== Uptime ==============="
uptime
echo "============== vmstat 1 2 ==============="
vmstat 1 30
echo "============== free -m ==============="
free -m
echo "============== cpstat -f cpu os ==============="
cpstat -f cpu os
echo "============== fw tab -t connections -s ==============="
fw tab -t connections -s
echo "============== fw ctl pstat ==============="
fw ctl pstat
echo "}}}"
sleep $sleep_time
done >> $LOG_FILE