DX Application Performance Management

Expand all | Collapse all

Branched Discussion: RTAM doc

  • 1.  Branched Discussion: RTAM doc

    Posted Oct 01, 2014 12:56 PM

    Hi Davis, I created MM Calc with following metrics in investigator

     

    (.*)\|Custom Metric Process \(Virtual\)\|Custom Metric Agent \(Virtual\) - TAAS\|Availability:Total Transactions

    (.*)\|Custom Metric Process \(Virtual\)\|Custom Metric Agent \(Virtual\) - TAAS\|Availability:Total Availability Defects

     

    while I see above two metrics in investigator I still do not see Availiblity % metric off of this .js.

     

    pls advise.



  • 2.  Re: Branched Discussion: RTAM doc
    Best Answer

    Broadcom Employee
    Posted Oct 01, 2014 01:03 PM
    Make sure your agent and metrics are getting matched by the calculator.

    You can check this by adding debug statements in the calc to write to the EM logfile.


  • 3.  Re: Branched Discussion: RTAM doc

    Broadcom Employee
    Posted Oct 01, 2014 01:06 PM
    You also need to create the metric with the transaction name. I don't see the transaction in your metric path.

    You must create two calculators for each business transaction for this to work right.


  • 4.  Re: Branched Discussion: RTAM doc

    Posted Oct 01, 2014 01:18 PM

    ok so you are saying this .js calc won't work for unless and until those two metrics ( total . * ) are under CEM Agent for each transaction?

     

    I was under impression this somehow finds those two metrics defined anywhere in the invetigator and adds third metric 'availibility %' to it.

     

    i don't want 'availibility %' for each transaction but rather for whole application, my MM calc takes factor into whole application availibility and not each Xactions.



  • 5.  Re: Branched Discussion: RTAM doc

    Broadcom Employee
    Posted Oct 01, 2014 03:28 PM

    The original design is to provide an availability metric for CEM Business Transactions in Introscope.

     

    CEM already provides an availability metric in their reports. Does that not work for you?

     

    Your other option is to modify the JS calculator to aggregate metrics across multiple Business Transactions.



  • 6.  Re: Branched Discussion: RTAM doc

    Posted Oct 01, 2014 05:04 PM

    Thanks Davis and I know CEM reports, but I want to show it to Introscope dashboard and hence working out this way.

     

    lastly, for aggregates, so I made those two metrics mentioned in above threads, how would your script be modified to only look for those two aggregates metrics? if you could advise/provide updates.

     

    reards,



  • 7.  Re: Branched Discussion: RTAM doc

    Broadcom Employee
    Posted Oct 01, 2014 05:21 PM

    The calculator is not intelligent enough to know what makes up your Application, so you will need to do that in the calculator.

     

    Using the same logic that is there, dividing the the two values to provide a percentage, you will need to have the calculator do a running total for 'Total Transactions' and 'Total Availability Defects'. Once you have your totals, then do your division and multiplication to create your 'Availaiblity %'.



  • 8.  Re: Branched Discussion: RTAM doc

    Posted Oct 01, 2014 05:24 PM

    understood, i will figure out somewhere.

     

    in the meantime, if possible if you could update your script and do add some of heavy prerequistes it relies on so as to grasp its maintainibility.

     

    thanks for your time.



  • 9.  Re: Branched Discussion: RTAM doc

    Broadcom Employee
    Posted Oct 01, 2014 05:38 PM

    I'll see what I can do for you.

     

    Basically what needs to be done is to create a global variable to hold each metric's value and total them up as they're found.

     

    You will still need to adjust your MM calculators to do the individual Business Transactions for this to work.



  • 10.  Re: Branched Discussion: RTAM doc

    Posted Oct 01, 2014 06:57 PM

    appreciated ,

     

    btw, how would I print out system.out in IntroxxEnterxxx.log from this .js?

     

    log.info or log.debug?



  • 11.  Re: Branched Discussion: RTAM doc

    Broadcom Employee
    Posted Oct 01, 2014 07:02 PM

    Global variable log

    All JavaScript calculator functions have access to a global variable log, which is of type IModuleFeedbackChannel. For example:

    function execute(metricData,javascriptResultSetHelper) { log.info("message"); log.error("message"); log.debug("message"); }


  • 12.  Re: Branched Discussion: RTAM doc

    Broadcom Employee
    Posted Oct 01, 2014 07:05 PM

    I'll expand on my reply:

     

    • log.info will print an INFO event in the EM log,
    • log.info will print an ERROR event in the EM log, and
    • log.debug will print a DEBUG event in the EM log.

     

    Any one of these should make it easier for you to see what was being reported by the calculator. It's a matter of choice and there's no right or wrong as to which to use.



  • 13.  Re: Branched Discussion: RTAM doc

    Posted Oct 01, 2014 07:15 PM

    hmmm...no luck , attached is my script for your reference, if you could easily pick any flaw in it, it would be a great help !!

     

    // Sample Javascript code for Wily Introscope
    //
    // Compute the Heap Used % metric based on the Heap Total and Heap In Use metrics
    //
    function execute(metricData,javascriptResultSetHelper)
    {

        // for each input agent, compute a calculated metric named
        // "<metric>|<agentname>:Heap Used %" as
        // that agent's "Math.round(Bytes in Use / Bytes Total *100)".


        var i=0;                                            // binding iterator
        var agentList = {};                         // list of agents
        var defectvalue = {};           // array of bytesTotal values by agent
        var totalTrans = {};            // array of bytesUsed values by agent
        var agentFrequency = {};            // array of frequency by agent

        for(i=0; i < metricData.length; i++)
        {
            var metric = metricData[i].agentMetric.attributeURL;
            var agent = metricData[i].agentName.processURL;
            var value = metricData[i].timeslicedValue.value;
            var frequency = metricData[i].frequency;

            // add to agentList if we haven't seen the agent yet
            if (agentList[agent] == null)
            {
                agentList[agent] = agent;
            }
            log.info("metricFound is: " + metric);
            log.info("agentFound is: " + metric);
                    // put the value in the right array
            if (metric.indexOf(":Total Availability Defects"))
            {
                defectvalue[agent] =  value;
            }
            if (metric.indexOf(":Total Transactions"))
            {
                totalTrans[agent] =  value;
            }

            agentFrequency[agent] =  frequency;
        }


        // now iterate found agents and report calculated metrics, build array of metrics
        for (var agent in agentList)
        {
                    // set up metric name
                    var metricName = agent + "TAAS\|Availability:Application Availability (%)";
            var frequency = agentFrequency[agent];
            var AvailValue = 100;

                    // make sure we're not going to divide by zero
            if (defectvalue[agent] > 0 && totalTrans[agent] > 0)
            {
                            // perform the math
                            AvailValue = Math.round((100-((defectValue[agent] / totalTrans[agent]) * 100)));
            }
                    // add the calculated value to the result set
                            javascriptResultSetHelper.addMetric(metricName,
                                    AvailValue,
                                    javascriptResultSetHelper.kIntegerPercentage,
                                    frequency);


        }

        // return the result set
        return javascriptResultSetHelper;

    }

    // Tell the EM what agents we should match against
    function getAgentRegex() {
        return "Custom(.*)";

    }
    // Tell the EM what agent metrics we should match against
    function getMetricRegex()
    {
        return "Availability.*";

    }

    // must return a multiple of default system frequency (currently 15 seconds)
    function getFrequency()
    {
            return 15;
    }

    // Return false if the script should not run on the MOM.
    // Scripts that create metrics on agents other than the Custom Metric Agent
    // should not run on the MOM because the agents exist only in the Collectors.
    // Default is true.
    function runOnMOM()
    {
            return true;
    }



  • 14.  Re: Branched Discussion: RTAM doc

    Broadcom Employee
    Posted Oct 01, 2014 07:24 PM

    You need to do this with the calculator I posted, not this example one from the EM.



  • 15.  Re: Branched Discussion: RTAM doc

    Posted Oct 01, 2014 08:37 PM

    looks like I have figured it out Davis, with all inspiration I have had through you , here is my version of it, keeping it very simple:

     

    // Sample Javascript code for Wily Introscope
    //
    // Compute the Heap Used % metric based on the Heap Total and Heap In Use metrics
    //
    function execute(metricData,javascriptResultSetHelper)
    {

        // for each input agent, compute a calculated metric named
        // "<metric>|<agentname>:Heap Used %" as
        // that agent's "Math.round(Bytes in Use / Bytes Total *100)".


        var i=0;                                            // binding iterator
        var defectvalueFound=0;
        var totalTransFound=0;
        var agentList = {};                         // list of agents
        var defectvalue = {};           // array of bytesTotal values by agent
        var totalTrans = {};            // array of bytesUsed values by agent
        var agentFrequency = {};            // array of frequency by agent

         log.info("1-metricDATA is: " + metricData);

        for(i=0; i < metricData.length; i++)
        {
            var metric = metricData[i].agentMetric.attributeURL;
            var agent = metricData[i].agentName.processURL;
            var value = metricData[i].timeslicedValue.value;
            var frequency = metricData[i].frequency;

            // add to agentList if we haven't seen the agent yet
            if (agentList[agent] == null)
            {
                agentList[agent] = agent;
            }
            log.info("2-metricFound is: " + metric);
            log.info("2-agentFound is: " + agent);


                    // put the value in the right array
            if (metric.indexOf(":Total Availability Defects"))
            {
                defectvalueFound =  value;
            }
            if (metric.indexOf(":Total Transactions"))
            {
                totalTransFound =  value;
            }

            agentFrequency[agent] =  frequency;
        }

     

                    // set up metric name
                    var metricName = "SuperDomain|Custom Metric Host (Virtual)|Custom Metric Process (Virtual)|Custom Metric Agent (Virtual)" + "|TAAS|Availability:Application Availability (%)";
            var frequency = agentFrequency[agent];
            var AvailValue = 100;

                    // make sure we're not going to divide by zero
            if (defectvalueFound > 0 && totalTransFound > 0)
            {
                            // perform the math
                            AvailValue = Math.round((100-((defectValueFound / totalTransFound) * 100)));
            }
                    // add the calculated value to the result set
                            javascriptResultSetHelper.addMetric(metricName,
                                    AvailValue,
                                    javascriptResultSetHelper.kIntegerPercentage,
                                    frequency);

     


        // return the result set
        return javascriptResultSetHelper;

    }

    // Tell the EM what agents we should match against
    function getAgentRegex() {
        return "Custom(.*)";

    }
    // Tell the EM what agent metrics we should match against
    function getMetricRegex()
    {
        return ".*Availability.*";

    }

    // must return a multiple of default system frequency (currently 15 seconds)
    function getFrequency()
    {
            return 15;
    }

    // Return false if the script should not run on the MOM.
    // Scripts that create metrics on agents other than the Custom Metric Agent
    // should not run on the MOM because the agents exist only in the Collectors.
    // Default is true.
    function runOnMOM()
    {
            return true;
    }