Skip to content

Instantly share code, notes, and snippets.

@aminamid
Last active August 29, 2015 14:16
Show Gist options
  • Save aminamid/3676402e09430404e198 to your computer and use it in GitHub Desktop.
Save aminamid/3676402e09430404e198 to your computer and use it in GitHub Desktop.
performance information of host
#!/bin/bash
DATESTR=`date "+%Y%m%d%H%M%S"`
INTERVAL=3
DURATION=10
OUTDIR=/tmp/pss$DATESTR
TARGETS="java influxd"
function pgreps() { echo $(for target in $@ ; do pgrep $target; done); return 0; }
mkdir $OUTDIR
for pid in $(pgreps $TARGETS) ;
do while true; do gstack $pid ; sleep $INTERVAL; done | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' >> $OUTDIR/gsta.$pid &
done
netstat -s $INTERVAL | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/snet &
netstat -ntoape $INTERVAL | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/net &
vmstat $INTERVAL 65535 | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/vms &
iostat -xdN -j PATH $INTERVAL | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/io &
sar -A -o $OUTDIR/sb $INTERVAL 65535 &
#pidstat -t -u -p ALL $INTERVAL 65535 | grep --line-buffered -v -e " 0.00 0.00 0.00 0.00 " > $OUTDIR/pcpu &
#pidstat -d -p ALL $INTERVAL 65535 | grep --line-buffered -v -e " 0.00 0.00 0.00 " > $OUTDIR/pio &
pidstat -h -w -u -d -t -p ALL $INTERVAL 65535 | grep -v -e " 0.00 0.00 0.00 0.00 .* \( 0\|-1\).00 \( 0\|-1\).00 \( 0\|-1\).00 0.00 0.00 " > $OUTDIR/pidstat &
sleep $DURATION
jobs -p | xargs kill
#!/bin/bash
DATESTR=`date "+%Y%m%d%H%M%S"`
INTERVAL=2
DURATION=10
OUTDIR=/tmp/pss$DATESTR
TARGETS="bash sshd"
function pgreps() { echo $(for target in $@ ; do pgrep $target; done); return 0; }
mkdir $OUTDIR
for pid in $(pgreps $TARGETS) ;
do while true; do gstack $pid ; sleep $INTERVAL; done | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/gsta.$pid &
done
netstat -s $INTERVAL | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/snet &
netstat -ntoape $INTERVAL | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/net &
vmstat $INTERVAL 65535 | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/vms &
iostat -xdN -j PATH $INTERVAL | awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/io &
top -Hbd $INTERVAL | awk '{$1=$1; print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush() }' > $OUTDIR/top &
sar -A -o $OUTDIR/sb $INTERVAL 65535 &
pidstat -I -u -t -d -p ALL ${INTERVAL} 65535 | grep --line-buffered -v -e " 0.00 0.00 0.00 " -e " 0.00 0.00 0.00 0.00 " > $OUTDIR/pidstat &
sleep $DURATION
jobs -p | xargs kill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment