One liner to add Timestamp to Solaris vmstat and iostat output
$ vmstat 2 |while read line; do echo -e "$line" '\t' "`date +%T`" ;done
$ iostat -xncz 2 | while read line; do if [[ $line == *extended* ]]; then echo -e "$line" '\t' "`date +%T`"; else echo -e "$line"; fi done
or you can also use like this, putting this script in /usr/bin, you can just run "$vmstat_withtime <interval>"
$vi vmstat_withtime
#!/bin/bash
INTR=$1
if [ $# -eq 0 ]
then
INTR=10
fi
vmstat $INTR |while read line; do echo -e "$line" '\t' "`date +%T`" ;done
$vi iostat_withtime
#!/bin/bash
INTR=$1
if [ $# -eq 0 ]
then
INTR=10
fi
iostat -xncz $INTR |while read line; do if [[ $line == *extended* ]]; then echo -e "$line" '\t' "`date +%T`"; else echo -e "$line"; fi done
No comments:
Post a Comment