Monday, April 15, 2013

Pivot AIX 'vmstat -v' Output

Gotta grab some trends from vmstat over the next few nights, using 'vmstat -v' and 'vmstat -s'.

Most vmstat options give a long line table, white space delimited, with many columns.  Not the -v or -s options.  An ugly list of values and categories, not at all friendly for trending.


$ vmstat -v
              6291456 memory pages
              6084656 lruable pages
               705556 free pages
                    4 memory pools
              1503109 pinned pages
                 80.0 maxpin percentage
                  3.0 minperm percentage
                 90.0 maxperm percentage
                 27.7 numperm percentage
              1689829 file pages
                  0.0 compressed percentage
                    0 compressed pages
                 27.7 numclient percentage
                 90.0 maxclient percentage
              1689829 client pages
                    0 remote pageouts scheduled
               347103 pending disk I/Os blocked with no pbuf
             20634977 paging space I/Os blocked with no psbuf
                 2228 filesystem I/Os blocked with no fsbuf
                    0 client filesystem I/Os blocked with no fsbuf
               144278 external pager filesystem I/Os blocked with no fsbuf
                 61.9 percentage of memory used for computational pages



A little script that looks like the one below, yields a comma-separated long line of output.

vmstat -v | awk 'BEGIN{ORS=","} {for (i=2; i<=NF; ++i) $(i-1) = $i; NF = NF-1; print;}' ; echo "timestamp" ; vmstat -v | awk 'BEGIN{ORS=",";} {print $1;}'; date "+%D %H:%M:%S"

memory pages,lruable pages,free pages,memory pools,pinned pages,maxpin percentage,minperm percentage,maxperm percentage,numperm percentage,file pages,compressed percentage,compressed pages,numclient percentage,maxclient percentage,client pages,remote pageouts scheduled,pending disk I/Os blocked with no pbuf,paging space I/Os blocked with no psbuf,filesystem I/Os blocked with no fsbuf,client filesystem I/Os blocked with no fsbuf,external pager filesystem I/Os blocked with no fsbuf,percentage of memory used for computational pages,
6291456,6084656,454133,4,1504941,80.0,3.0,90.0,27.8,1692421,0.0,0,27.8,90.0,1692421,0,347103,20634977,2228,0,144278,65.9,04/15/13 10:37:03



Much better, dontcha think?

I think the cool kids call that a 'pivot'.

Some other pivots, using the same strategy:



vmstat -s | awk 'BEGIN{ORS=","} {for (i=2; i<=NF; ++i) $(i-1) = $i; NF = NF-1; print;}' ; echo "timestamp" ; vmstat -s | awk 'BEGIN{ORS=",";} {print $1;}'; date "+%D %H:%M:%S"

netstat -p tcp | awk 'BEGIN{ORS=","} {for (i=2; i<=NF; ++i) $(i-1) = $i; NF = NF-1; print;}' ; echo "timestamp" ; netstat -p tcp | awk 'BEGIN{ORS=",";} {print $1;}'; date "+%D %H:%M:%S"

fcstat fcs0 | grep -e 'Command Resource' -e 'Adapter Elements' | tail -2 | awk 'BEGIN{FS=":";ORS=","} {print $1;}' ; echo "timestamp" ; fcstat fcs0 | grep -e 'Command Resource' -e 'Adapter Elements' | tail -2 | awk 'BEGIN{FS=":";ORS=",";} {for (i=2; i<=NF; ++i) $(i-1) = $i; NF = NF-1; print;}'; date "+%D %H:%M:%S"
 




No comments:

Post a Comment