Monitoring CPU output on Solaris and report in excel

Monitoring CPU output on Solaris and report in excel

For any DBA to get the CPU utilization for the duration of the issue is very important.

For preparing the report to the management needs few non geeky reports.

Here is how I managed using AWK:-

  • Check the availability of sar files for previous days
 ls -l  /var/adm/sa/
total 163648
-rw-r--r--   1 sys      sys      2771712 Aug  1 23:55 sa01
-rw-r--r--   1 sys      sys      2771712 Aug  2 23:55 sa02
-rw-r--r--   1 sys      sys      2771712 Aug  3 23:55 sa03
-rw-r--r--   1 sys      sys      2771712 Aug  4 23:55 sa04
-rw-r--r--   1 sys      sys      2771712 Aug  5 23:55 sa05
-rw-r--r--   1 sys      sys      2771712 Aug  6 23:55 sa06
-rw-r--r--   1 sys      sys      2771712 Aug  7 23:55 sa07
-rw-r--r--   1 sys      sys      2771712 Aug  8 23:55 sa08
-rw-r--r--   1 sys      sys      2771712 Aug  9 23:55 sa09
-rw-r--r--   1 sys      sys      2771712 Aug 10 23:55 sa10
-rw-r--r--   1 sys      sys      2771712 Aug 11 23:55 sa11
 
  • take the SAR output for the required day and run the below AWK command
sar  -f /var/adm/sa/sa11 | grep -v Ave | awk '{if ($0 ~ /[0-9]/) { print $1","$2","$4","$5","$6; }  }'

  • This gives an output in CSV format  :- SunOS,rodez,Generic_141444-09,sun4u,08/11/2014
    00:00:00,%usr,%wio,%idle,
    00:05:00,15,0,84,
    00:10:01,15,0,84,
    00:15:00,15,0,84,
    00:20:00,15,0,84,
    00:25:00,15,0,84,
    00:30:01,15,0,84,
  • Save this in any file or copy the contents
  • Here are the steps in excel to convert to columns
Step 1. Copy the comma delimited text into your clipboard from your text editor or Microsoft Word.
Step 2. Fire up MS Excel and paste the comma separated text into a cell.
Step 3. Click on the Data Tab and then select Text to Columns.
Step 4. Now select Delimited as that is the type of Data we are working with.
Step 5. Select the Comma delimiter and clicked NEXT.
Step 6. Select your Data Type, mine is text so I left the default option of General selected and clicked Finish.
Step 7. All the words have now been separated into Columns.



No comments:

Post a Comment