2 Replies Latest reply on Mar 4, 2011 11:51 AM by Lukas Krejci

    Reporting Features

    Benson Fung Newbie

      Hi,

       

      Is it possible to export the metrics monitiring data to a report in whatever file format?

       

      Thanks

        • 1. Reporting Features
          Heiko Rupp Master

          Sort of

           

          There is currently no way to do that in the UI.

          But you can do it from the command line interface:

           

          rhqadmin@pintsize:7080$ var start = new Date() - 8* 3600 * 1000;                                   

          rhqadmin@pintsize:7080$ var end = new Date()

          rhqadmin@pintsize:7080$ MeasurementDataManager.findDataForResource(10003,[10473],start,end,60)

           

          where 10003 is the resource id and 10473 is the metric definition id. You can get this e.g. from the big chart's url:

           

          http://pintsize:7080/resource/common/monitor/Visibility.do?mode=chartSingleMetricSingleResource&id=10003&m=10473

           

          In theory it should be possible to use the exporter to output the data to CSV, but I am currently failing at it - you may want to play around with it.

           

          The following wiki page gives you hints about CLI usage: http://www.rhq-project.org/display/JOPR2/Running+the+RHQ+CLI

          • 2. Reporting Features
            Lukas Krejci Apprentice

            To expand on what Heiko suggests, I was able to export the data using the exporter with commands like this:

             

            rhqadmin@pintsize:7080$ exporter.file = 'somewhere/over/the/rainbow'

            rhqadmin@pintsize:7080$ exporter.format = 'csv'

            rhqadmin@pintsize:7080$ var start = new Date() - 8* 3600 * 1000;                                   

            rhqadmin@pintsize:7080$ var end = new Date()

            rhqadmin@pintsize:7080$ var data = MeasurementDataManager.findDataForResource(10003,[10473],start,end,60)

            rhqadmin@pintsize:7080$ exporter.write(data.get(0))

             

            the "data.get(0)" bit is important because the findDataForResource method returns a list of lists, where each "inner" list corresponds to the index of the metric id in the provided array of metric ids ([10473])). And thus the data.get(0) contains the data for the first metric (and only) metric you asked for. The exporter cannot handle the "list of lists" in csv format.

             

            Note that I only tried this with the latest code in RHQ master branch, so your mileage may vary depending on the RHQ version you use.

            1 of 1 people found this helpful