Commit graph

6 commits

Author SHA1 Message Date
Danilo Egea Gondolfo 4bb3f0315d netstat_freebsd: add support for TCP state metrics
Metric added (gauge):
node_netstat_tcp_connections{state="CLOSED"}
node_netstat_tcp_connections{state="CLOSE_WAIT"}
node_netstat_tcp_connections{state="CLOSING"}
node_netstat_tcp_connections{state="ESTABLISHED"}
node_netstat_tcp_connections{state="FIN_WAIT_1"}
node_netstat_tcp_connections{state="FIN_WAIT_2"}
node_netstat_tcp_connections{state="LAST_ACK"}
node_netstat_tcp_connections{state="LISTEN"}
node_netstat_tcp_connections{state="SYN_RCVD"}
node_netstat_tcp_connections{state="SYN_SENT"}
node_netstat_tcp_connections{state="TIME_WAIT"}

Signed-off-by: Danilo Egea Gondolfo <danilo@FreeBSD.org>
2025-05-16 11:53:16 +01:00
Danilo Egea Gondolfo 2db27ff2fa netstat_freebsd: add support for some UDP metrics
Metrics added:
- udp_transmit_packets_total
- udp_receive_packets_total

Signed-off-by: Danilo Egea Gondolfo <danilo@FreeBSD.org>
2025-05-16 11:53:16 +01:00
Danilo Egea Gondolfo cbd8cc0eb1 netstat_freebsd: add support for some IPv6 metrics
Metrics added:
- ip6_transmit_packets_total
- ip6_transmit_raw_packets_total
- ip6_receive_packets_total
- ip6_receive_fragments_total
- ip6_forward_total
- ip6_delivered_total

Signed-off-by: Danilo Egea Gondolfo <danilo@FreeBSD.org>
2025-05-16 11:53:16 +01:00
Danilo Egea Gondolfo 5068195d94 netstat_freebsd: add support for some IPv4 metrics
Metrics added:
- ip4_transmit_packets_total
- ip4_transmit_raw_packets_total
- ip4_receive_packets_total
- ip4_receive_fragments_total
- ip4_forward_total
- ip4_fast_forward_total
- ip4_delivered_total

Signed-off-by: Danilo Egea Gondolfo <danilo@FreeBSD.org>
2025-05-16 11:53:16 +01:00
Danilo Egea Gondolfo f0dbecf061 netstat_freebsd: refactoring
Make the code testable and more maintainable:
- Encapsulate all the CGO code so it can be tested
- Fix the test file (it wasn't compiling) and improve tests
- Mock the data returned by unix.SysctlRaw so the code can be tested
  without actually calling sysctl.

No change in behavior intended

Signed-off-by: Danilo Egea Gondolfo <danilo@FreeBSD.org>
2025-05-16 11:53:16 +01:00
K Rin 43dfdcea5c
Add collector for netstats tcp packet counters for FreeBSD. (#3177)
* Add collector for netstats tcp packet counters for FreeBSD.

Signed-off-by: K Rin <rin@sandb0x.tw>

* Update collector/netstat_freebsd.go to keep the naming convention

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: K Rin <sandb0x.tw0913@gmail.com>

---------

Signed-off-by: K Rin <rin@sandb0x.tw>
Signed-off-by: K Rin <sandb0x.tw0913@gmail.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2025-02-02 11:32:08 +01:00