[one-users] oneacct - "incorrect" figures in output

Carlos Martín Sánchez cmartin at opennebula.org
Thu Jan 17 06:19:47 PST 2013


I forgot to add that meanwhile, you can try to filter records using xpath
expressions for HISTORY/STIME and HISTORY/ETIME

Regards
--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open-source Solution for Data Center Virtualization
www.OpenNebula.org | cmartin at opennebula.org |
@OpenNebula<http://twitter.com/opennebula><cmartin at opennebula.org>


On Thu, Jan 17, 2013 at 3:04 PM, Carlos Martín Sánchez <
cmartin at opennebula.org> wrote:

> You are right, that first entry should be filtered out. We'll look into it
> [1], thanks for reporting.
>
> Regards
>
> [1] http://dev.opennebula.org/issues/1732
>
> --
> Carlos Martín, MSc
> Project Engineer
> OpenNebula - The Open-source Solution for Data Center Virtualization
> www.OpenNebula.org | cmartin at opennebula.org | @OpenNebula<http://twitter.com/opennebula><cmartin at opennebula.org>
>
>
> On Thu, Jan 17, 2013 at 1:32 PM, Benadik, Jan <jan.benadik at atos.net>wrote:
>
>>
>> Dňa 16.01.2013 14:29, � wrote / napísal(a):
>>
>> Hi,
>>
>>  On Tue, Jan 15, 2013 at 5:18 PM, Benadik, Jan <jan.benadik at atos.net> wrote:
>>
>>>
>>> *My questions:*
>>> - how can I limit time frame for oneacct command (i.e. - from 1. 1. 2013
>>> to 31.1.2013 - only running VM's in that only period)?
>>> If I use -s and -e option, it displays all machines without any
>>> limitations ...
>>>
>>
>>  The -s and -e options will show all the history records that were
>> active during that time interval, but they may start or end outside that
>> interval. Maybe you were expecting records that started and ended within
>> the interval. Can you check if this is the case, or if you found a bug and
>> there is no filtering at all?
>>
>> But there are records in all state (stopped included) - I want to have
>> running state only in that report. That means - If I set exact time frame,
>> I expect records which were in state "Running" inside of that time frame
>> and only number of minutes in "running" state inside of that time frame.
>>
>> I.e. - I have three VM's, all with 4vCPU, 8096MB RAM:
>> - VM1 started on 12. 24. 2012, stopped on 12. 31. 2012
>> - VM2 started on 01. 01. 2013, stopped on 01. 15. 2013
>> - VM3 started on 12. 24. 2012, still running
>>
>> If I use (on 02. 01. 2013) command *bill "01/01/2013" "01/31/2013", *I
>> expect output like:
>> oid, vcpus, memory, minutes_running
>> VM2, 4, 8096, 21600
>> VM3, 4, 8096, 44640
>>
>>
>>
>>
>>  - how can I display correct figures in minutes for running machines in
>>> oneacct output?
>>>
>>
>>  That depends on how you plan to bill, by the month or waiting after the
>> registry ends.
>> If you want to get the minutes spent in this month, you need to take into
>> account that STIME and ETIME can be outside the range, you can compute them
>> as:
>>
>> bill_start = [$1, h['STIME'].to_i].max
>>
>>  etime = h['ETIME'].to_i == 0 ? Time.now : h['ETIME'].to_i
>>  bill_end = [$2, etime].min
>>
>>
>>  This is pseudo-ruby, but I hope you get the idea.
>>
>>
>> Thanks - I will try it.
>>
>> Jan
>>
>>
>>  Regards
>> --
>> Carlos Martín, MSc
>> Project Engineer
>> OpenNebula - The Open-source Solution for Data Center Virtualization
>> www.OpenNebula.org | cmartin at opennebula.org | @OpenNebula<http://twitter.com/opennebula>
>>
>>
>> On Tue, Jan 15, 2013 at 5:18 PM, Benadik, Jan <jan.benadik at atos.net>wrote:
>>
>>> Hi all,
>>>
>>> *I have a script /usr/bin/bill*
>>> #!/usr/bin/env ruby
>>>
>>> require 'json'
>>>
>>> j = JSON.parse(`oneacct -j -s $1 -e $2`)
>>>
>>> puts "oid,vcpus,memory,minutes_running"
>>>
>>> j['HISTORY_RECORDS']['HISTORY'].each do |h|
>>>     puts "#{h['OID']},"<<
>>>         "#{h['VM']['TEMPLATE']['VCPU']},"<<
>>>         "#{h['VM']['TEMPLATE']['MEMORY']},"<<
>>>         "#{(h['ETIME'].to_i - h['STIME'].to_i)/60}"
>>> end
>>>
>>> Output from that command:
>>> *oneadmin at myto-node:~$ bill "01/01/2013" "01/31/2013"*
>>> oid,vcpus,memory,minutes_running
>>> 0,2,1024,0
>>> 0,2,1024,0
>>> 1,2,1024,0
>>> 1,2,1024,32
>>> .
>>> .
>>> .
>>> 110,4,8096,29925
>>> 111,4,8096,84
>>> 112,4,8096,5939
>>> 113,4,8096,22
>>> 114,4,8096,-22637691
>>>
>>> First 4 lines were VM's running in october 2012 (for a while), last line
>>> is still running VM.
>>>
>>> *My questions:*
>>> - how can I limit time frame for oneacct command (i.e. - from 1. 1. 2013
>>> to 31.1.2013 - only running VM's in that only period)?
>>> If I use -s and -e option, it displays all machines without any
>>> limitations ...
>>> - how can I display correct figures in minutes for running machines in
>>> oneacct output?
>>>
>>> Jan
>>> --
>>>
>>> *Ján Beňadik*
>>> Managed Services - Solution Design Architect
>>> mobile: +421 903 691 634
>>> fax: +421 2 6852 8380
>>> jan.benadik at atos.net <//jan.benadik at atos.net>
>>> Vinohradnicka 6, 971 01 Prievidza
>>> www.sk.atos.net
>>> __________________________________
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>
>>>
>>
>> --
>>
>> *Ján Beňadik*
>> Managed Services - Solution Design Architect
>> mobile: +421 903 691 634
>> fax: +421 2 6852 8380
>> jan.benadik at atos.net <//jan.benadik at atos.net>
>> Vinohradnicka 6, 971 01 Prievidza
>> www.sk.atos.net
>> __________________________________
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130117/9db7ed78/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1723 bytes
Desc: not available
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130117/9db7ed78/attachment-0004.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 281 bytes
Desc: not available
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130117/9db7ed78/attachment-0005.gif>


More information about the Users mailing list