JBoss Community Archive (Read Only)

RHQ 4.9

Exporting metrics to csv

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))

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

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.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 08:48:34 UTC, last content change 2013-09-18 19:43:35 UTC.