[one-users] oneacct - "incorrect" figures in output
Benadik, Jan
jan.benadik at atos.net
Tue Jan 15 08:18:33 PST 2013
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
--
[cid:part1.07070903.00000000 at atos.net]
Ján Beňadik
Managed Services - Solution Design Architect
mobile: +421 903 691 634
fax: +421 2 6852 8380
jan.benadik at atos.net<mailto://jan.benadik@atos.net>
Vinohradnicka 6, 971 01 Prievidza
www.sk.atos.net<http://www.sk.atos.net>
__________________________________
[cid:part4.06050801.07060407 at atos.net]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130115/85c5ab28/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ciara.gif
Type: image/gif
Size: 281 bytes
Desc: ciara.gif
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130115/85c5ab28/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atos.gif
Type: image/gif
Size: 1723 bytes
Desc: atos.gif
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130115/85c5ab28/attachment-0001.gif>
More information about the Users
mailing list