Discussion:
[Monitorix-general] Support for more than 10 network interfaces (net.pm)
Andrei-Marius Radu
2014-11-11 15:36:36 UTC
Permalink
Hello Monitorix, Hello Jordi,

First of all a big thank you for Monitorix, it's really great :)

And second, I recently came across a limitation in net.pm of only 10
network interfaces. I took a quick look in net.pm and I see that when
the RRD is created the data sources are net0 ... net9 irrespective of
how many interfaces are in the config.

Also in some places in net.pm I see:

< .............. >
for($n = 0; $n < 10; $n++)
< .............. >

while in some other places I see:

< .............. >
for($n = 0; $n < scalar(my @nl = split(',', $net->{list})); $n++)
< .............. >

Anyway, for my specific use case (which I understand might be a bit
unusual) I can bend net.pm to work with more than 10.

Would it be desirable to add support in a general way ? Perl is not my
daily programming language but I can try and contribute a patch for
net.pm.

Cheers,
Andrei.
Jordi Sanfeliu
2014-11-12 17:23:25 UTC
Permalink
Hello Andrei,
Post by Andrei-Marius Radu
Hello Monitorix, Hello Jordi,
First of all a big thank you for Monitorix, it's really great :)
Thanks for your words on Monitorix, I'm very glad to know you are
enjoying it!
Post by Andrei-Marius Radu
And second, I recently came across a limitation in net.pm of only 10
network interfaces. I took a quick look in net.pm and I see that when
the RRD is created the data sources are net0 ... net9 irrespective of
how many interfaces are in the config.
well ... when I put the limit to 10 network interfaces I did it thinking
that it would be almost impossible that some day someone would need more
than 10. Heh, it looks like such day has come! :)
Post by Andrei-Marius Radu
< .............. >
for($n = 0; $n < 10; $n++)
< .............. >
< .............. >
< .............. >
That's fine because Monitorix will show only the same number of graphs
as network interfaces are defined regardless the maximum number of
interfaces (10).
Post by Andrei-Marius Radu
Anyway, for my specific use case (which I understand might be a bit
unusual) I can bend net.pm to work with more than 10.
Would it be desirable to add support in a general way ? Perl is not my
daily programming language but I can try and contribute a patch for
net.pm.
There are some graphs where changing the number of elements of the array
it forces a regeneration of the .rrd file losing all your historical
data. I tried to avoid this in the 'net.pm' putting a fixed number of
elements of 10.

Of course this is modifiable, you have the source code. Just add more
lines during the RRDs::create() function and change the lines with
'for($n = 0; $n < 10; $n++)' accordingly. You'll have to remove the
'net.rrd' to accommodate all these changes, losing all your historical data.

I'll include in my TODO list a note to change this in the 'net.pm'
module in order to be able to extend the number of network interfaces
beyond 10.
Post by Andrei-Marius Radu
Cheers,
Andrei.
Regards.
--
Jordi Sanfeliu
FIBRANET Network Services Provider
http://www.fibranet.cat
Loading...