Wednesday, February 23, 2011

Performance Collection Script for Solaris 10

I had the need to collect a bunch of system statistics on Solaris 10 servers during a performance test. I wanted to get these statistics at a much more frequent basis than I have sar configured for and I also wanted to include some scripts that I have found useful for collecting other performance statistics. So, I wrote a quick script to use during the test. One script that I plugged into mine is one written by Brendan Gregg. It’s called “nicstat” - it collects performance statistics for network interfaces. It can be dowloaded from http://www.brendangregg.com/Perf/network.html#nicstat

To use:
1) Download the script from here.http://sunblog.mbrannigan.com/collect.tgz
1) Unzip the collect.tgz archive with gtar.
2) Put a copy of Brendan Gregg’s nicstat script into the collect subdirectory.
3) Run the collect.sh script.

Results:
When the script first starts up, it will create a subdirectory of the output directory named after the system you are on. After this, the script will loop, collecting various statistics during its execution and storing the results in the directory it created. Currently, the script will collect the following statistics:
• netstat -an
• nicstat
• A list of TCP sessions in the ESTABLISHED state
• A count of TCP sessions in the ESTABLISHED state (based on SRC and DEST IPs)
• A list of TCP sessions in the TIME_WAIT state
• A count of TCP sessions in the TIME_WAIT state (based on SRC and DEST IPs)
• netstat -i
• TCP statistics from netstat -s
• I/O statistics from iostat -xnz
• Memory / CPU statistics from vmstat
• System event activity from vmstat -s
• Paging activity from vmstat -p
• Swap activity from vmstat -S

How to stop it:
The script will sleep for 5 minutes and then append to the end of the various files that it creates. To stop collection, simply press Ctrl-C. The snooze time between collections can be changed by modifying the SNOOZE parameter. It is currently configured to snooze 300 seconds (5 minutes).

No comments: