vCenter

 View Only
  • 1.  How to write a script plugin?

    Posted Jun 25, 2007 06:25 AM
    I'm evaluating Hyperic for use as a monitoring tool at my company. We would like to use it to monitor (among other things) our application (to gather various metrics along with error conditions). Our application is written mostly in a scripting language, with some parts in Java.

    I have read the documentation at http://support.hyperic.com/confluence/display/DOCSHQ30/Plugin+Development+Center but the example given aren't great. Could someone help me with instructions on how to write the following two types of plugins?

    1- Our main application is written in a scripting language (K) and we want to have it publish out metrics and events/errors to Hyperic. We want Hyperic to then store and act upon what is published. What would be the simplest way? For our scripting language we can communicate with the outside using a C API, or by writing to a log file and having Hyperic monitor the log file.

    2- For the parts of our application written in Java (stand alone back end applications) we would also want to have metrics and events monitored by Hyperic. Again what would be the simplest way? I'm hoping there is an API we can include in our code and then just publish our metrics/events to Hyperic?

    I'm hoping to be able to write some simple plugins, as a proof of concept, to hook Hyperic into our application and demonstrate that Hyperic can be used for monitoring, alerting, and trend analysis of historical metric/event data.

    Thanks


  • 2.  RE: How to write a script plugin?

    Posted Jun 25, 2007 11:33 PM
    > 1- Our main application is written in a scripting
    > language (K) and we want to have it publish out
    > metrics and events/errors to Hyperic. We want Hyperic
    > to then store and act upon what is published. What
    > would be the simplest way? For our scripting language
    > we can communicate with the outside using a C API, or
    > by writing to a log file and having Hyperic monitor
    > the log file.
    >

    It's possible to have the HQ agent interact directly using your C based API's, but that would require you write a C library and Java bindings that could be called from our agent. This would also require you to write your HQ plugin in Java rather than XML. As an example, this is how our DB2 plugin works.

    A simpler method would be to write a script or application that outputs your metrics on stdout in key/value pairs. You would then describe your metrics in an HQ plugin that extends the script plugin. Documentation on this can be found here:

    http://support.hyperic.com/confluence/display/DOCSHQ30/Script+Plugin

    This example uses a script to format iostat output in key/value pairs so that HQ can read in the data.

    > 2- For the parts of our application written in Java
    > (stand alone back end applications) we would also
    > want to have metrics and events monitored by Hyperic.
    > Again what would be the simplest way? I'm hoping
    > there is an API we can include in our code and then
    > just publish our metrics/events to Hyperic?
    >

    Would it be possible for you to publish your metrics via JMX? That is the standard way we recommend application developers to expose metrics:

    http://support.hyperic.com/confluence/display/DOCSHQ30/JMX+Plugin

    > I'm hoping to be able to write some simple plugins,
    > as a proof of concept, to hook Hyperic into our
    > application and demonstrate that Hyperic can be used
    > for monitoring, alerting, and trend analysis of
    > historical metric/event data.
    >

    This is exactly what HQ is meant for. If you need any additional info on how to expose your metrics, or on how to gather them from HQ let us know.

    -Ryan


  • 3.  RE: How to write a script plugin?

    Posted Jun 26, 2007 12:49 AM
    Hi Ryan and thanks for the quick response.

    Concerning #1

    1- I did read the document you gave a link to before posting but found it incomplete and difficult to understand. It's not clear how to create a simple XML file. I'll give it a try again and post more specific questions

    2- I may have misunderstood you point but it seems like you are suggesting that we write our script so that it can be called (possibly with parameters) and would output metric values on stdout? If so I might not have described our application in enough detail. Think of our application as one big program continually running. It can't be queried directly. It can receive input from TCP/IP, and HTTP and can reply back on the same transports. It can also write to a log file.

    For point #2 (the Java App) I'm not very familiar with JMX but this does indeed sound like a very good solution. I will look into this some more. Would you have pointers to some Hyperic documentation (or other) on how to enable our application for JMX?

    Thanks,

    Jc