-
Notifications
You must be signed in to change notification settings - Fork 0
/
sarme
47 lines (32 loc) · 1.2 KB
/
sarme
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
#!/bin/bash
# Usage:
# export M=odb-p01 && scp sarme $M:~ && ssh $M bash -x sarme && scp $M:/tmp/sar*.txt .
DAY1="23"
DAY2="24"
START="00:00:00" END="23:59:59"
# Use grep -v to get raw data w/o averages
GREP="grep -E"
rm -f /tmp/sar_*.txt
for day in $DAY1 $DAY2; do
FILE="/tmp/sar_$HOST_$day.txt"
SAR="sar -f /var/log/sa/sa${day} -s $START -e $END"
$SAR | $GREP '(Linux)' >> $FILE
echo "##### Load average #####" >> $FILE
$SAR -q | $GREP '(runq|Average)' >> $FILE
echo "##### CPU #####" >> $FILE
$SAR -u | $GREP '(nice|Average)' >> $FILE
echo "##### Memory #####" >> $FILE
$SAR -r | $GREP '(kbmem|Average)' >> $FILE
echo "##### Swap #####" >> $FILE
$SAR -S | $GREP '(swp|Average)' >> $FILE
echo "##### Memory #####" >> $FILE
$SAR -r | $GREP '(kbmem|Average)' >> $FILE
echo "##### IO #####" >> $FILE
$SAR -p -d | $GREP '(tps|Average)' >> $FILE
echo "##### Network #####" >> $FILE
$SAR -n DEV | $GREP '(IFACE|Average)' >> $FILE
echo "##### Network Errors #####" >> $FILE
$SAR -n EDEV | $GREP '(IFACE|Average)' >> $FILE
echo "##### Network NFS #####" >> $FILE
$SAR -n NFS | $GREP '(retrans|Average)' >> $FILE
done