AthennaMind / opnsense-exporter

OPNsense Exporter for Prometheus
Apache License 2.0
88 stars 9 forks source link

FEATURE: implement tcp stats metrics #9

Closed ihatemodels closed 7 months ago

ihatemodels commented 7 months ago

This PR implements a set of common TCP metrics exposed by OPNsense

Example:

# HELP opnsense_proto_statistics_arp_received_requests_total Number of received ARP requests
# TYPE opnsense_proto_statistics_arp_received_requests_total counter
opnsense_proto_statistics_arp_received_requests_total{opnsense_instance="opnsense-local1"} 6.526501e+06
# HELP opnsense_proto_statistics_arp_sent_requests_total Number of sent ARP requests
# TYPE opnsense_proto_statistics_arp_sent_requests_total counter
opnsense_proto_statistics_arp_sent_requests_total{opnsense_instance="opnsense-local1"} 11673
# HELP opnsense_proto_statistics_tcp_connection_count_by_state Number of TCP connections by state
# TYPE opnsense_proto_statistics_tcp_connection_count_by_state gauge
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="CLOSED"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="CLOSE_WAIT"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="CLOSING"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="ESTABLISHED"} 6
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="FIN_WAIT_1"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="FIN_WAIT_2"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="LAST_ACK"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="LISTEN"} 37
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="SYN_RCVD"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="SYN_SENT"} 0
opnsense_proto_statistics_tcp_connection_count_by_state{opnsense_instance="opnsense-local1",state="TIME_WAIT"} 12
# HELP opnsense_proto_statistics_tcp_received_packets_total Number of received TCP packets
# TYPE opnsense_proto_statistics_tcp_received_packets_total counter
opnsense_proto_statistics_tcp_received_packets_total{opnsense_instance="opnsense-local1"} 1.23587e+07
# HELP opnsense_proto_statistics_tcp_sent_packets_total Number of sent TCP packets 
# TYPE opnsense_proto_statistics_tcp_sent_packets_total counter
opnsense_proto_statistics_tcp_sent_packets_total{opnsense_instance="opnsense-local1"} 1.6408881e+07

Introduce pull_req_template as well