Is it possible the file needs to be closed to flush the write buffers?
Al Amyot | Consultant
Sierra Systems
I will be away on vacation Dec 25 to Jan 2.
(eHealth): 204-926-4257 (T): 204-942-2575 (F): 204-942-2047
444 St. Mary Avenue, Suite 1050
Winnipeg, MB R3C 3T1
Management Consulting | System Integration | Managed Services
website:
www.SierraSystems.com
-----Original Message-----
From: rhq-users-bounces(a)lists.fedorahosted.org
[mailto:rhq-users-bounces@lists.fedorahosted.org] On Behalf Of Heiko W.Rupp
Sent: Friday, December 17, 2010 2:50 AM
To: rhq-users(a)lists.fedorahosted.org
Subject: Re: Request, Info,solution For Exporting measurments from JON/RHQ. (Again)
Hey,
Can you help me anybody how to export over 1 month collected
measurments data from RHQ ?
I need a simple script, - a method - of making solution to get a resource/metric data
be exported into csv.
You will not get the raw data for the whole month out of the RHQ database, because we
store 7 days of raw data only.
So you would need to run a periodic job to export that. Probably as some sort of DB-dump.
If you are interested in the values as RHQ sees them on the UI (graphs etc), you can do
something like
var end = new Date().getTime();
var msecInDay = 86400 * 1000;
var numDays = 1;
var start = end - msecInDay * numDays;
MeasurementDataManager.findDataForResource(subject,10001,[10025],start,end,60)
10001 = resource Id
10025 = Id of the metric definition for the metric / schedule to look at
This will give you a table like the following:
rhqadmin@localhost:7080$
MeasurementDataManager.findDataForResource(subject,10001,[10025],start,end,60)
one row
highValue lowValue timestamp value
--------------------------------------------------------------------------------------------------------------------------------------
NaN NaN 1292487275639 NaN
[...]
NaN NaN 1292497355639 NaN
NaN NaN 1292498795639 NaN
3.42523904E8 1.52313856E8 1292500235639 2.684440203636364E8
3.37698816E8 2.03624448E8 1292501675639 2.582952690526316E8 [...]
4.33119232E8 1.18632448E8 1292507435639 2.740608E8
You see that there are rows with a value of NaN - this means that there is no metric data
present for that time (interval)
The last bit that I am now struggling with is to export this data to csv.
It should go like:
exporter.setTarget('csv','/tmp/foo.csv')
var data = MeasurementDataManager.findDataForResource(subject,10001,[10025],start,end,60)
exporter.write(data);
But the result is not as expected.
I hope this helps you somewhat anyway.
Heiko
--
Reg. Adresse: Red Hat GmbH, Otto-Hahn-Strasse 20, 85609 Dornach bei München
Handelsregister: Amtsgericht München HRB 153243
Geschaeftsführer: Brendan Lane, Charlie Peters, Michael Cunningham, Charles Cachera
_______________________________________________
rhq-users mailing list
rhq-users(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/rhq-users
This email and/or any documents in this transmission is intended for the
addressee(s) only and may contain legally privileged or confidential information. Any
unauthorized use, disclosure, distribution, copying or dissemination is strictly
prohibited. If you receive this transmission in error, please notify the sender
immediately and return the original.
Ce courriel et tout document dans cette transmission est destiné à la personne ou aux
personnes à qui il est adressé. Il peut contenir des informations privilégiées ou
confidentielles. Toute utilisation, divulgation, distribution, copie, ou diffusion non
autorisée est strictement défendue. Si vous n'êtes pas le destinataire de ce message,
veuillez en informer l'expéditeur immédiatement et lui remettre l'original.