DX Application Performance Management

Expand all | Collapse all

javascript calculator access file

Jump to Best Answer
  • 1.  javascript calculator access file

    Posted 08-28-2014 08:05 AM

    Hi,

     

    Is there a way for a javascript calculator to read a file? Background: I want to keep the configuration of what the javascript should compare some metrics against separated from the logic within the javascript (to solve this: Alerting: Complicated alerting requirement to starting and ending a "problem" and sending mails on problem start & solved).

     

    Unfortunately I only find solution for reading files with Javascript for in browser executions or for nodejs (which I suppose I cannot use with Introscope)

     

    Thank you,
    Stefan



  • 2.  Re: javascript calculator access file
    Best Answer

    Broadcom Employee
    Posted 08-28-2014 08:46 AM

    Introscope uses the Rhino JS Engine (Rhino - Mozilla | MDN).

     

    Beyond that, you will only have access to features exposed by Introscope to Rhino.

     

    Why not just add your configurations as global variables in the script?



  • 3.  Re: javascript calculator access file

    Posted 08-28-2014 08:54 AM

    Hi,

     

    Thank you for this information. With Rhino this works great. As reference for other people, have a look at: Tutorial: Embedding Rhino - Mozilla | MDN

     

    > Why not just add your configurations as global variables in the script?

    We intend to use the javascript calculator to create measures on which we can then put alerts on (like mentioned by stig in the post I linked). As we might have many different metrics with different thresholds etc, we need to have different configuration. You are right that I can put them to javascript, but changing the javascript when adding new metrics is hard for us as we have a central service that takes care of the EMs. Thus we want to have a separate folder where we can upload new configurations and the javascript staying stable.


    Thank you again,

    Stefan



  • 4.  Re: javascript calculator access file

    Broadcom Employee
    Posted 08-28-2014 08:57 AM

    Calculators can be deployed to the MOM, which will then distribute to Collectors, so there's no complicated replication needed.



  • 5.  Re: javascript calculator access file

    Broadcom Employee
    Posted 08-28-2014 08:57 AM

    Calculators can be hotdeployed, so no need to restart to apply.



  • 6.  Re: javascript calculator access file

    Posted 08-28-2014 11:55 AM

    Also, because Introscope uses Rhino, you have access to the java.io.* packages and classes to do any file reading or writing, should you choose.



  • 7.  Re: javascript calculator access file

    Broadcom Employee
    Posted 08-28-2014 12:23 PM

    Yep, just remember that all of your actions must be completed in the timeframe that the script is executed.