mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.
https://www.monitorix.org
GNU General Public License v2.0
1.12k stars 167 forks source link

Netstat statistics IPv6 issue #66

Closed Tarjaizaid closed 10 years ago

Tarjaizaid commented 10 years ago

Hello,

I think I have a problem with ipv6 netstat statistics. The graph show correct "listen connections" but wrong value for "established connections". I count 5 "established connections" for IPv6.

pbv6-graph

selection_002

What did you think ?

Thanks Tarjaizaid

mikaku commented 10 years ago

Hello,

Monitorix uses the command netstat -tn -A inet6 to get the network stats. Can you, please, compare in your system the output of that command with the one you used in your second screen shot?

Just to make sure that they are showing exact results. Thanks.

Tarjaizaid commented 10 years ago

i've run this command. I count 7 established connetion while the chart display 0 connection.

mikaku commented 10 years ago

Monitorix collects statistical data on every minute and the values represented are averages, so unless your established connections keep established for a whole minute (or more), you won't see such 7 counted reflected.

This is not a bug but a feature.

Tarjaizaid commented 10 years ago

I make another test :

$ while true; do date; sudo netstat -tn -A inet6 | wc -l ; sleep 35; done Mon Sep 15 19:56:33 CEST 2014 7 Mon Sep 15 19:57:08 CEST 2014 6 Mon Sep 15 19:57:43 CEST 2014 7 Mon Sep 15 19:58:19 CEST 2014 7 Mon Sep 15 19:58:54 CEST 2014 7 Mon Sep 15 19:59:29 CEST 2014 8 Mon Sep 15 20:00:04 CEST 2014 7 Mon Sep 15 20:00:39 CEST 2014 6 Mon Sep 15 20:01:14 CEST 2014 6 Mon Sep 15 20:01:50 CEST 2014 10 Mon Sep 15 20:02:25 CEST 2014 16 Mon Sep 15 20:03:01 CEST 2014 8 Mon Sep 15 20:03:36 CEST 2014 6 Mon Sep 15 20:04:11 CEST 2014 6 Mon Sep 15 20:04:46 CEST 2014 6 Mon Sep 15 20:05:22 CEST 2014 6 Mon Sep 15 20:05:57 CEST 2014 7 Mon Sep 15 20:06:32 CEST 2014 10 Mon Sep 15 20:07:07 CEST 2014 9 Mon Sep 15 20:07:43 CEST 2014 9 Mon Sep 15 20:08:18 CEST 2014 10

(remove 2 for : Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State )

mikaku commented 10 years ago

Tarjaizaid,

I think that you misunderstood the command line netstat -tn -A inet6. That command line doesn't returns only a list of ESTABLISHED connections, but a list of current connections including CLOSE_WAIT, TIME_WAIT, LAST_ACK, ESTABLISHED, etc.

So, the result after filtering with wc -l is not the number of ESTABLISHED connections. I hope that helped you.

Tarjaizaid commented 10 years ago

i've test the patch on two computer. The changes works.

This code count only UDP listen, but i've a weird behavior. Netstat display UDP established connection for NTP trafic and not for Mumble Voice trafic. I don't think it's a good idea to count.

mikaku commented 10 years ago

Ok thanks, I'll apply the patch right now.

Tarjaizaid commented 10 years ago

hello,

I noticed an error in the UDP listen. For IPv6, monitorix shows 0 when I count five.

There is an error in the file netstat.pm. Line 238: I replaced $ i6_udp ++ if / ^ udp \ s + /; by $ i6_udp ++ if / ^ udp6 \ s + /;

This solves the problem.

Best regards tgz :)

mikaku commented 10 years ago

Please, check the latest commit and let me know if that works for you. Thanks!

Tarjaizaid commented 10 years ago

it works well