Re: [vserver] Bandwidth monitoring

From: Jean Weisbuch <jean_at_phpnet.org>
Date: Wed 24 Dec 2014 - 00:31:14 GMT
Message-ID: <549A0952.6010508@phpnet.org>

By default, a VServer has its own virtual interface with its own
statistics, its possible to share an interface with the host but its not
the default setup.
And if vnstat runs on VServer it should work fine, as the /proc and /sys
on a VServer is "limited" compared to a normal system. Tools relying on
values not present on a VServer guest might not work out of the box but
as vnstat it reads /proc/net/dev, it seems to be working fine.

Le 24/12/2014 01:20, Laurens Vets a écrit :
> Does that mean that each vserver keeps its own statistics? Because
> vnstat also parses that output:
>
> user@vserver:~$ strace -e trace=file vnstat -tr 2
> execve("/usr/bin/vnstat", ["vnstat", "-tr", "2"], [/* 12 vars */]) = 0
> access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
> directory)
> access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
> directory)
> open("/etc/ld.so.cache", O_RDONLY) = 3
> access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
> directory)
> open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY) = 3
> access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
> directory)
> open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY) = 3
> open("/home/user/.vnstatrc", O_RDONLY) = -1 ENOENT (No such file or
> directory)
> open("/etc/vnstat.conf", O_RDONLY) = 3
> open("/proc/net/dev", O_RDONLY) = 3
> Sampling eth0 (2 seconds average)...open("/proc/net/dev",
> O_RDONLY) = 3
> 42 packets sampled in 2 seconds
> Traffic average for eth0
>
> rx 8 kbit/s 10 packets/s
> tx 16 kbit/s 10 packets/s
>
> user@vserver:~$
>
> If I can just use vnstat that's fine by me, but I was under the
> impression that these statistics were shared?
>
> On 2014-12-23 16:08, Jean Weisbuch wrote:
>> You can read how much data has transited on each network interfaces
>> inside a guest by reading : /proc/net/dev
>> You just have to take the value at first then wait some time, take
>> the new value, substract the first one to the second then divide it by
>> how long in seconds you waited between the two checks.
>>
>> If you want to check from the host, here is a script i made :
>> http://paste.debian.net/137926/
>>
>> Le 24/12/2014 00:45, Laurens Vets a écrit :
>>> Hi list,
>>>
>>> Is it possible to monitor the bandwidth of 1 particular guest from
>>> inside that guest?
>>>
>>> Basically, I want to run vnstat inside a guest monitoring only the
>>> traffic that guest generates. Is that possible somehow?
Received on Wed Dec 24 00:31:22 2014

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 24 Dec 2014 - 00:31:22 GMT by hypermail 2.1.8