cargomedia / bipbip

UNMAINTAINED. Gather services data and store in CopperEgg/IDERA
MIT License
4 stars 7 forks source link

Add netstat error statistics #154

Closed njam closed 8 years ago

njam commented 8 years ago
netstat --statistics

E.g. SndbufErrors and RcvbufErrors. They only show up if present.

[…]
Ip:
    49942134 total packets received
    890 with invalid addresses
    0 forwarded
    0 incoming packets discarded <----------
    49889719 incoming packets delivered
    49813641 requests sent out
    71 outgoing packets dropped <----------
[…]
Udp:
    5964 packets received
    93831 packets to unknown port received.
    0 packet receive errors
    5669588 packets sent
    SndbufErrors: 12345 <----------
    RcvbufErrors: 12345 <----------
[…]

(this output might be different for different "netstat" versions!)

Maybe also relevant:

Some input: http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/#monitoring-network-devices

njam commented 8 years ago

Some input: http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/#monitoring-network-devices

ppp0 commented 8 years ago

While researching about this topic, I came across some other methods to gather network errors..

e.g.

# bulldog4 (em1 main NIC)
$ ls /sys/class/net/em1/statistics
collisions           rx_dropped           rx_missed_errors     tx_carrier_errors    tx_heartbeat_errors
multicast            rx_errors            rx_over_errors       tx_compressed        tx_packets
rx_bytes             rx_fifo_errors       rx_packets           tx_dropped           tx_window_errors
rx_compressed        rx_frame_errors      tx_aborted_errors    tx_errors            
rx_crc_errors        rx_length_errors     tx_bytes             tx_fifo_errors     

# janus5
$ ls /sys/class/net/eth4/statistics/
collisions     rx_crc_errors   rx_frame_errors   rx_packets     tx_compressed   tx_heartbeat_errors
multicast      rx_dropped      rx_length_errors  tx_aborted_errors  tx_dropped      tx_packets
rx_bytes       rx_errors       rx_missed_errors  tx_bytes       tx_errors       tx_window_errors
rx_compressed  rx_fifo_errors  rx_over_errors    tx_carrier_errors  tx_fifo_errors

These values depend on the network card driver being loaded and used. (Needs ethtool to find out)

E.g.

# on bulldog:
$ ethtool -i em1
driver: tg3
version: 3.137
firmware-version: 5719-v1.41 NCSI v1.3.7.0
bus-info: 0000:02:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

# on janus5 (10Gbit)
$ ethtool -i eth4
driver: ixgbe
version: 3.19.1-k
firmware-version: 0x80000208
bus-info: 0000:81:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

Am I right to think that we're interested in:

Also, there is this:

$ cat /proc/net/snmp | grep Udp: 
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors
Udp: 483476138 415872 201069 3355572970 201068 0 1

which would yield RcvbufErrors and SndbufErrors even when their value is 0

ppp0 commented 8 years ago

let's wait for CI @njam please review

njam commented 8 years ago
njam commented 8 years ago

As discussed let's iterate over all interfaces and sum up statistics.

ppp0 commented 8 years ago

To be excluded:

~$ cat /sys/class/net/{bond0,eth0}/statistics/tx_packets 
473150133
473150133

May be make the interfaces to be excluded configurable per regex?

ppp0 commented 8 years ago

@njam please review

njam commented 8 years ago
ppp0 commented 8 years ago

Agree it looks much better now, @njam please review

njam commented 8 years ago
ppp0 commented 8 years ago

@njam true, now?

njam commented 8 years ago
njam commented 8 years ago

Generally we try to add doc-blocks to all functions, it helps with refactoring. In bipbip it's not done in many places yet.

ppp0 commented 8 years ago

makes sense, @njam please review

njam commented 8 years ago

lgtm! please remove the dashboard before releasing