Popular Post

Search This Blog

Wednesday, January 29, 2014

MXG against NMON to process AIX performance data

In my last www.CMG.org paper "AIX frame and LPAR level Capacity Planning. User Case for Online Banking Application" I have demonstrated how to analyze AIX server based application performance by exceptions (including IT-Control charting).  

But what type of server performance data I used for that? NMON data. And how to process that data? I would recommenced to use SAS and MXG -  that is the way,  if you are lucky to have access to SAS and MXG tools ...

Below are a few hints for readers who want to try to set up MXG to process NMON data.

How to set up and run MXG against AIX nmon data is documented in the following useful ppt document http://mxg.com/downloads/chuck/mxgtoolmagic.ppt that has ASCII installation and tailoring instructions starting from page 16.

-        There is also install.sas document inside of MXM package .../mxg/sourclib that has the following instructions regarding ascii installation:

"****************************************************************
    For ASCII Execution:

    Instead of JCL Procs, it is the AUTOEXEC.SAS file that conrols and
    sets up the MXG environment.  You will need to copy and EDIT the MXG
    example autoexec for the directory names, etc., for your platform
       AUTOEXEC  -   SAS - Windows
       AUTOEXEU  -   SAS - Unix
       AUTOEXEW  -   WPS - All ASCII
    into the your SAS root directory, if all users are MXG users, or you
    can add the -autoexec option to the start-up icon, or in batch, use
      sas -autoexec 'c:\mxg\userid\autoexec.sas' ...

************************************************************************"
When the MXG environment is set up properly, to run MXG against NMON data and creating PDBs with nmon data one needs to do just following steps:

-    - Submit FILENAME NMONIN  "*.nmon";  * to provide the path to raw nmon log file;
-    - Submit TYPENMON macro:

%INCLUDE SOURCLIB(VMACNMON,IMACKEEP);
DATA
_VARNMON
_CDENMON
_SNMON

To prove/test that I have:
 
-         -  copied MXG folder (could be downloaded from MXG) to my laptop folder to C:\MXG\sourclib;
-          - created a few new folders like C:\MXG\PDB  (see p. 17 ) ;
-          - modified a bit and submitted  the autoexec.sas (I have added there the nmon log to process - “FILENAME NMONIN   "C:\MXG\DATA\aprcmix1_131212_0000.nmon" LRECL=32000;”
-         -  submitted  C:\MXG\sourclib\formats macro to rebuild formats library ;
-          - submitted the main macro C:\MXG\sourclib\typenmon  to process “C:\MXG\DATA\prix1.nmon” and build PDB with nmon SAS datasets in C:\MXG\PDB ;
-          - checked the resulted PDBs in C:\MXG\PDB. 


Last thing is to use SAS /IML with R to build control charts (HERE hints how to do that) or if you have SAS/Graph - HERE is how to use that.

Good luck! And put you questions to comments!


Friday, January 24, 2014

R script to run in SAS: one more way to built IT-Control Chart

Sure SAS and SAS/GRAPH is good to plot (control) charts. See example here, But if you are a R lover you can also submit R script in SAS to do any analysis or charting you want. How?

SAS 9.3 can be used to run R scripts and packages within SAS/IML proc. To do that the following needs to be done:


1. Check if your SAS instance support R language. Just submit "proc options option=RLANG; run;" and check the sas log. If that is not supported, do next:
2. Add the following line at the end of the config file:
  C:\Program Files (x86)\SASHome\SASFoundation\9.3\nls\en\sasv9.cfg

-RLANG

3. Install  R-2.15.3 for Windows (32/64 bit) (note the R version 3 is not supported by SAS at this point)
4. Insert R-script to the following SAS/IML script:   
         proc iml;
          submit / R;
..... your R scrpt is here ....
        endsubmit;

5. Some simple test R-scripts samples to run in SAS is  below:
proc iml;
/* Comparison of matrix operations in IML and R */
print "----------  SAS/IML Results  -----------------";
x = 1:3;                                 /* vector of sequence 1,2,3 */
m = {1 2 3, 4 5 6, 7 8 9};               /* 3 x 3 matrix */
q = m * t(x);                            /* matrix multiplication */
print q;
print "-------------  R Results  --------------------";
submit / R;
  rx <- 1:3="" 1="" matrix="" nrow="1)            " of="" sequence="" span="" vector="">
  rm <- 1:9="" 3="" byrow="TRUE)" matrix="" nrow="3," span="" x="">
  rq <- matrix="" multiplication="" nbsp="" rm="" rx="" span="" t="">
  print(rq)
endsubmit;

More complex example:   Call R Packages from PROC IML

And finally my own script to build IT-Control Chart against CSV data is following:
proc iml;
submit / R;
## R script to plot IT-chart against CSV data - Igor Trubin 2009
cchrt <- appsdata.csv="" header="T," ocuments="" read.table="" sep="," sers="" span="" workshop="">
plot    (cchrt[,1],cchrt[,2],type="l",col="black",ylim=c(0,0.15),lwd=1.6,ann=F)
points (cchrt[,1],cchrt[,3],type="l",col="red",   ylim=c(0,0.15),lwd=1,ann=F)
points (cchrt[,1],cchrt[,4],type="l",col="green",ylim=c(0,0.15),lwd=1,ann=F)
points (cchrt[,1],cchrt[,5],type="l",col="blue", ylim=c(0,0.15),lwd=1,ann=F)
points (cchrt[,1],cchrt[,6],type="l",col="MAGENTA", ylim=c(0,0.1),lwd=1,ann=F)
mtext("I/O Time/Thrd",   side=2, line=3.0)
mtext("hours of week",   side=1, line=3.0)
mtext("IT-CHART",        side=3, line=1.0)
legend(10,0.16,c("Actual","UpperLimit","Mean","LowerLimit"),
          col=c("black","red","green","blue"),lwd=c(.2,.1,.1,.1),bty="n")
endsubmit;


The code is similar to the one I published in my other post here. And below is the result: