quentin-st / Freebox-OS-munin

Low depencendies Freebox OS munin plugin
GNU General Public License v2.0
17 stars 10 forks source link

freebox-connection is broken since 43ce1ecdc838d57619783c9dc598cf3b6cf4feaa #25

Closed LudovicRousseau closed 5 years ago

LudovicRousseau commented 5 years ago

The patch in https://github.com/chteuchteu/Freebox-OS-munin/commit/43ce1ecdc838d57619783c9dc598cf3b6cf4feaa is wrong.

The problem is that the config now uses bits_up & bits_down:

graph_category freebox
graph_scale yes
graph_title bits/s up/down
graph_vlabel bits in (-) / out (+) per second
bits_down.type COUNTER
bits_down.label bits/s
bits_down.graph no
bits_up.label bits/s
bits_up.type COUNTER
bits_up.negative bits_down

and the data still uses bytes_up & bytes_down:

bytes_up.value 1358518780
bytes_down.value 8665417156

Have you checked a correct graph is generated?

Also the freebox OS documentation indicates:

bytes_up int Read-only total uploaded bytes since last connection bytes_down int Read-only total downloaded bytes since last connection

If you really want to use bits and not bytes you have to multiply the result by 8.

quentin-st commented 5 years ago

+1, I didn't check. Waiting for @ruliane feedback on this!

ruliane commented 5 years ago

That was a fast patch and, indeed, I didn't check before pushing this PR. It looks like it's more complicated than expected : data reported by Freebox API might be mislabeled as well. For now, I think it's better to rollback this change.

airvb commented 5 years ago

Hello, Can you lake it as an option ? I prefer old version myself !

ruliane commented 5 years ago

A simple workaround is to convert bits into bytes by using cdef :

print('graph_scale yes')
print('graph_title bytes up/down')
print('graph_vlabel bytes in (-) / out (+) per second')
print('bytes_down.type COUNTER')
print('bytes_down.label bytes/s')
print('bytes_down.cdef bytes_down,8,/')
print('bytes_down.graph no')
print('bytes_up.label bytes/s')
print('bytes_up.type COUNTER')
print('bytes_up.negative bytes_down')
print('bytes_up.cdef bytes_up,8,/')

I just tested it successfully : image

LudovicRousseau commented 5 years ago

@ruliane why do you think the values returned by bytes_up and bytes_down fields are in bits and not in bytes?

ruliane commented 5 years ago

@ruliane why do you think the values returned by bytes_up and bytes_down fields are in bits and not in bytes?

Consider the following scenario: [NAS] --- [Freebox] --- [Internet]

NAS is downloading a large file through Freebox, at an average speed of ~10 MB/s. image

This is confirmed by Freebox management interface. image

But here is the result of freebox-connection: image

Munin reports a average download speed of 628 MB/s, which is obviously wrong. This speed would be actually far beyond my Freebox capabilities. It appears that this speed is not in bytes/s. So, what "628 M" could be? I tried some calculation, here what I found. 628 M might be in the following units:

The only believable case is 10.5 MB/s. Considering this, the value reported by munin-connection is likely in bytes/minute.

LudovicRousseau commented 5 years ago

Very nice experiment @ruliane

On my side I did something similar. I downloaded many times the same big file to saturate the 1 Gb/s fibre connection. On the freebox I get around 100 MBytes/s freebox

On Munin with freebox-connection (without your change) I get around 90M-100M or 10^8 (100 000 000) for the logarithmic scale bytes up down The unit must be bytes/s.

On munin with freebox-traffic I get between 80M and 90M: traffic Again the unit is bytes/s.

On munin with freebox-switch1 I get around 90M and 100M or 10^8: switch1 Again the unit is bytes/s.

I have no idea why you get ~600M. Maybe your freebox OS is bogus.

Note that what the script freebox-connection returns is NOT a speed but a number (of bytes here) since the freebox booted. The type of data is COUNTER for munin. The speed is computed by munin itself by using the difference of two measures divided by the time (5 minutes).

@chteuchteu please revert the commit 43ce1ecdc838d57619783c9dc598cf3b6cf4feaa I am pretty sure the unit is NOT bytes/minute (minute really?) as demonstrated by @ruliane.

ruliane commented 5 years ago

I have no idea why you get ~600M. Maybe your freebox OS is bogus.

I will revert to the original freebox-connection plugin and check again.

@chteuchteu please revert the commit 43ce1ec

Agreed.

I am pretty sure the unit is NOT bytes/minute (minute really?) as demonstrated by @ruliane.

That indeed sounds strange.

quentin-st commented 5 years ago

Thanks all for your investigations! I just reverted the commit This issue can be closed, right?

ruliane commented 5 years ago

Right.