<div dir="ltr"><div>I'm sorry to dropping in, but isn't Proxmox already counting traffic in it's internal RRD? Couldn't the "rrddata" API call be used to retrieve the data in the RRD externally and process it to count the total bandwidth used in 1 month?<br>
<br></div>Maybe I've misunderstood what the issue is here...<br><br><br></div><div class="gmail_extra"><br clear="all"><div>Best regards,<br>Adrian Costin</div>
<br><br><div class="gmail_quote">On Wed, Apr 17, 2013 at 3:29 PM, Stefan Priebe - Profihost AG <span dir="ltr"><<a href="mailto:s.priebe@profihost.ag" target="_blank">s.priebe@profihost.ag</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Am 17.04.2013 14:17, schrieb Dietmar Maurer:<br>
<div class="im">>> Nowhere ;-) how about just return the counter values for the correct tap device<br>
>> through API?<br>
>><br>
>> So it is basically:<br>
>> 1.) a wrapper from netX to correct tap<br>
>> 2.) query tap counter inout / output values<br>
>> 3.) allow to query this through API<br>
>><br>
>> So it is at least possible to implement traffic account in external software. You<br>
>> jsut have to query the API every X seconds and detect resets yourself. It acts<br>
>> than basically like SNMP traffic counters in switches.<br>
><br>
> sounds reasonable.<br>
<br>
</div>Then let's go this way. It's much simpler than adding RRD.<br>
<br>
So the question is should this be a completely new call or do you want<br>
to add a new hash key to sub vmstatus { ?<br>
<br>
this could be<br>
<br>
my $netdev = PVE::ProcFSTools::read_proc_net_dev();<br>
foreach my $dev (keys %$netdev) {<br>
next if $dev !~ m/^tap([1-9]\d*)i/;<br>
my $vmid = $1;<br>
my $d = $res->{$vmid};<br>
next if !$d;<br>
<br>
$d->{netout} += $netdev->{$dev}->{receive};<br>
$d->{netin} += $netdev->{$dev}->{transmit};<br>
}<br>
<br>
converted to:<br>
<br>
my $netdev = PVE::ProcFSTools::read_proc_net_dev();<br>
foreach my $dev (keys %$netdev) {<br>
next if $dev !~ m/^tap([1-9]\d*)i(\d+)/;<br>
my $vmid = $1;<br>
my $netid = $2;<br>
my $d = $res->{$vmid};<br>
next if !$d;<br>
<br>
$d->{netout} += $netdev->{$dev}->{receive};<br>
$d->{netin} += $netdev->{$dev}->{transmit};<br>
$d->{traffic}{'net'.$netid}{netout} = $netdev->{$dev}{receive};<br>
$d->{traffic}{'net'.$netid}{netin} = $netdev->{$dev}{transmit};<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
Stefan<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
pve-devel mailing list<br>
<a href="mailto:pve-devel@pve.proxmox.com">pve-devel@pve.proxmox.com</a><br>
<a href="http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel" target="_blank">http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel</a><br>
</div></div></blockquote></div><br></div>