Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::tcp_state_counts Struct Reference

Counts of connections in each TCP state. More...

#include <network_metrics_collector.h>

Collaboration diagram for kcenon::monitoring::tcp_state_counts:
Collaboration graph

Public Member Functions

uint64_t get_count (tcp_state state) const
 
void increment (tcp_state state)
 
uint64_t total () const
 

Public Attributes

uint64_t established {0}
 ESTABLISHED connections.
 
uint64_t syn_sent {0}
 SYN_SENT connections.
 
uint64_t syn_recv {0}
 SYN_RECV connections.
 
uint64_t fin_wait1 {0}
 FIN_WAIT1 connections.
 
uint64_t fin_wait2 {0}
 FIN_WAIT2 connections.
 
uint64_t time_wait {0}
 TIME_WAIT connections.
 
uint64_t close {0}
 CLOSE connections.
 
uint64_t close_wait {0}
 CLOSE_WAIT connections (leak indicator)
 
uint64_t last_ack {0}
 LAST_ACK connections.
 
uint64_t listen {0}
 LISTEN sockets.
 
uint64_t closing {0}
 CLOSING connections.
 
uint64_t unknown {0}
 Unknown state connections.
 

Detailed Description

Counts of connections in each TCP state.

Definition at line 85 of file network_metrics_collector.h.

Member Function Documentation

◆ get_count()

uint64_t kcenon::monitoring::tcp_state_counts::get_count ( tcp_state state) const
inline

Get count for a specific state

Parameters
stateThe TCP state
Returns
Count of connections in that state

Definition at line 104 of file network_metrics_collector.h.

104 {
105 switch (state) {
107 case tcp_state::SYN_SENT: return syn_sent;
108 case tcp_state::SYN_RECV: return syn_recv;
109 case tcp_state::FIN_WAIT1: return fin_wait1;
110 case tcp_state::FIN_WAIT2: return fin_wait2;
111 case tcp_state::TIME_WAIT: return time_wait;
112 case tcp_state::CLOSE: return close;
114 case tcp_state::LAST_ACK: return last_ack;
115 case tcp_state::LISTEN: return listen;
116 case tcp_state::CLOSING: return closing;
117 default: return unknown;
118 }
119 }
@ FIN_WAIT1
FIN sent, waiting for ACK or FIN.
@ SYN_SENT
SYN sent, waiting for SYN-ACK.
@ TIME_WAIT
Waiting for enough time to pass (2MSL)
@ FIN_WAIT2
FIN-ACK received, waiting for FIN.
@ SYN_RECV
SYN received, SYN-ACK sent.
@ CLOSE
Connection closed.
@ ESTABLISHED
Connection established.
@ CLOSE_WAIT
Remote side has closed, waiting for local close.
@ LAST_ACK
FIN sent after CLOSE_WAIT, waiting for ACK.
@ CLOSING
Both sides sent FIN simultaneously.
@ LISTEN
Listening for incoming connections.
uint64_t close_wait
CLOSE_WAIT connections (leak indicator)
uint64_t established
ESTABLISHED connections.
uint64_t unknown
Unknown state connections.

References kcenon::monitoring::CLOSE, close, kcenon::monitoring::CLOSE_WAIT, close_wait, kcenon::monitoring::CLOSING, closing, kcenon::monitoring::ESTABLISHED, established, kcenon::monitoring::FIN_WAIT1, fin_wait1, kcenon::monitoring::FIN_WAIT2, fin_wait2, kcenon::monitoring::LAST_ACK, last_ack, kcenon::monitoring::LISTEN, listen, kcenon::monitoring::SYN_RECV, syn_recv, kcenon::monitoring::SYN_SENT, syn_sent, kcenon::monitoring::TIME_WAIT, time_wait, and unknown.

◆ increment()

void kcenon::monitoring::tcp_state_counts::increment ( tcp_state state)
inline

◆ total()

uint64_t kcenon::monitoring::tcp_state_counts::total ( ) const
inline

Get total connection count

Returns
Total number of connections across all states

Definition at line 146 of file network_metrics_collector.h.

References close, close_wait, closing, established, fin_wait1, fin_wait2, last_ack, listen, syn_recv, syn_sent, time_wait, and unknown.

Member Data Documentation

◆ close

uint64_t kcenon::monitoring::tcp_state_counts::close {0}

CLOSE connections.

Definition at line 92 of file network_metrics_collector.h.

92{0};

Referenced by get_count(), increment(), and total().

◆ close_wait

uint64_t kcenon::monitoring::tcp_state_counts::close_wait {0}

CLOSE_WAIT connections (leak indicator)

Definition at line 93 of file network_metrics_collector.h.

93{0};

Referenced by get_count(), increment(), and total().

◆ closing

uint64_t kcenon::monitoring::tcp_state_counts::closing {0}

CLOSING connections.

Definition at line 96 of file network_metrics_collector.h.

96{0};

Referenced by get_count(), increment(), and total().

◆ established

uint64_t kcenon::monitoring::tcp_state_counts::established {0}

ESTABLISHED connections.

Definition at line 86 of file network_metrics_collector.h.

86{0};

Referenced by get_count(), increment(), and total().

◆ fin_wait1

uint64_t kcenon::monitoring::tcp_state_counts::fin_wait1 {0}

FIN_WAIT1 connections.

Definition at line 89 of file network_metrics_collector.h.

89{0};

Referenced by get_count(), increment(), and total().

◆ fin_wait2

uint64_t kcenon::monitoring::tcp_state_counts::fin_wait2 {0}

FIN_WAIT2 connections.

Definition at line 90 of file network_metrics_collector.h.

90{0};

Referenced by get_count(), increment(), and total().

◆ last_ack

uint64_t kcenon::monitoring::tcp_state_counts::last_ack {0}

LAST_ACK connections.

Definition at line 94 of file network_metrics_collector.h.

94{0};

Referenced by get_count(), increment(), and total().

◆ listen

uint64_t kcenon::monitoring::tcp_state_counts::listen {0}

LISTEN sockets.

Definition at line 95 of file network_metrics_collector.h.

95{0};

Referenced by get_count(), increment(), and total().

◆ syn_recv

uint64_t kcenon::monitoring::tcp_state_counts::syn_recv {0}

SYN_RECV connections.

Definition at line 88 of file network_metrics_collector.h.

88{0};

Referenced by get_count(), increment(), and total().

◆ syn_sent

uint64_t kcenon::monitoring::tcp_state_counts::syn_sent {0}

SYN_SENT connections.

Definition at line 87 of file network_metrics_collector.h.

87{0};

Referenced by get_count(), increment(), and total().

◆ time_wait

uint64_t kcenon::monitoring::tcp_state_counts::time_wait {0}

TIME_WAIT connections.

Definition at line 91 of file network_metrics_collector.h.

91{0};

Referenced by get_count(), increment(), and total().

◆ unknown

uint64_t kcenon::monitoring::tcp_state_counts::unknown {0}

Unknown state connections.

Definition at line 97 of file network_metrics_collector.h.

97{0};

Referenced by get_count(), increment(), and total().


The documentation for this struct was generated from the following file: