-
Notifications
You must be signed in to change notification settings - Fork 2
/
missedSlots.sh
39 lines (36 loc) · 1.19 KB
/
missedSlots.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
#!/bin/bash
sudo zgrep -h "TraceStartLeadershipCheck" /var/log/syslog | awk '{print $3, $(NF)}' > missedSlots
sed 's/[:,] */ /g' missedSlots > missedSlots1
awk '{if (NF == 15) print $1":"$2":"$3, $(NF-2); else print $1":"$2":"$3, $(NF-6);}' missedSlots1 > missedSlots
rm missedSlots1
((num = $(awk 'NR==1{print $NF}' missedSlots)))
((last = $(awk 'END{print $NF}' missedSlots)))
((first = num))
((miss = 0))
((hit = 0))
echo "firstSlot: $num"
echo "lastSlot: $last"
echo ""
echo "miss: TimeStamp SlotExpected SlotSeen SlotsMissed"
echo "================================================================="
while read -r line1 line2 remainder
do
if [[ "$num" -eq "$line2" ]]
then
((num += 1))
else
((slots = line2 - num))
echo "miss: $line1 $num $line2 $slots"
((miss += line2 - num))
((num = line2 + 1))
fi
((hit += 1))
done < missedSlots
rm missedSlots
((total = num - first))
((num -= 1))
echo ""
echo "lastSlotCheck: $num"
echo "totalSlots: $total"
echo "hitSlots: $hit"
echo "missSlots: $miss"