Skip to content

Commit

Permalink
archive coredump files in the generate_dump (sonic-net#38)
Browse files Browse the repository at this point in the history
improve app/sai/counter db dump performance

get bgp neighbor received routes
  • Loading branch information
lguohan authored Apr 24, 2017
1 parent 45a8d38 commit 11db861
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ DUMPDIR=/var/dump
TARDIR=$DUMPDIR/$BASE
TARFILE=$DUMPDIR/$BASE.tar
LOGDIR=$DUMPDIR/$BASE/dump
COREDIR=$DUMPDIR/$BASE/core

###############################################################################
# Runs a comamnd and saves its output to the incrementally built tar.
Expand Down Expand Up @@ -126,7 +125,7 @@ save_bgp_neighbor() {
neighbor_list=`vtysh -c "show ip bgp neighbors" | grep "BGP neighbor is" | awk -F '[, ]' '{print $4}'`
for word in $neighbor_list; do
save_vtysh "show ip bgp neighbors $word advertised-routes" "ip.bgp.neighbor.$word.adv"
save_vtysh "show ip bgp neighbors $word received-routes" "ip.bgp.neighbor.$word.rcv"
save_vtysh "show ip bgp neighbors $word routes" "ip.bgp.neighbor.$word.rcv"
done
}

Expand Down Expand Up @@ -166,7 +165,7 @@ save_proc() {
save_redis() {
local db=$1
local db_name=$2
save_cmd "docker exec -i database redis-cli -n $db keys \* | docker exec -i database xargs --verbose -n 1 redis-cli -n $db hgetall" "$db_name"
save_cmd "redis-dump -d $db -s /var/run/redis/redis.sock -y" "$db_name.json"
}

###############################################################################
Expand Down Expand Up @@ -308,6 +307,17 @@ main() {
save_file $file log true
fi
done

# archive core dump files
for file in $(find -L /var/core -type f); do
# don't gzip already-gzipped log files :)
if [ -z "${file##*.gz}" ]; then
save_file $file core false
else
save_file $file core true
fi
done

# clean up working tar dir before compressing
$RM $V -rf $TARDIR

Expand Down

0 comments on commit 11db861

Please sign in to comment.