Module: sip-router Branch: master Commit: 57bb2450a5b0db4c18dd139ae3ae28f480b379c7 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=57bb2450...
Author: Olle E. Johansson oej@edvina.net Committer: Olle E. Johansson oej@edvina.net Date: Thu Mar 28 21:30:57 2013 +0100
snmpstats Add a few more TCP connection settings
---
modules/snmpstats/kamailioNet.c | 113 +++++++++++++++++++++++++++++++--- modules/snmpstats/kamailioNet.h | 3 + modules/snmpstats/mibs/KAMAILIO-MIB | 44 +++++++++++--- 3 files changed, 142 insertions(+), 18 deletions(-)
diff --git a/modules/snmpstats/kamailioNet.c b/modules/snmpstats/kamailioNet.c index efac0b9..76b87c3 100644 --- a/modules/snmpstats/kamailioNet.c +++ b/modules/snmpstats/kamailioNet.c @@ -64,6 +64,9 @@ init_kamailioNet(void) const oid kamailioNetTcpEnabled_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,1 }; const oid kamailioNetTcpMaxConns_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,2 }; const oid kamailioNetTcpAsync_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,3 }; + const oid kamailioNetTcpConnTimeout_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,4 }; + const oid kamailioNetTcpSendTimeout_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,5 }; + const oid kamailioNetTcpConnLifetime_oid[] = { 1,3,6,1,4,1,34352,3,1,3,1,4,1,3,6 };
DEBUGMSGTL(("kamailioNet", "Initializing\n"));
@@ -117,18 +120,23 @@ init_kamailioNet(void) kamailioNetTcpAsync_oid, OID_LENGTH(kamailioNetTcpAsync_oid), HANDLER_CAN_RONLY )); + netsnmp_register_scalar( + netsnmp_create_handler_registration("kamailioNetTcpConnTimeout", handle_kamailioNetTcpConnTimeout, + kamailioNetTcpConnTimeout_oid, OID_LENGTH(kamailioNetTcpConnTimeout_oid), + HANDLER_CAN_RONLY + )); + netsnmp_register_scalar( + netsnmp_create_handler_registration("kamailioNetTcpSendTimeout", handle_kamailioNetTcpSendTimeout, + kamailioNetTcpSendTimeout_oid, OID_LENGTH(kamailioNetTcpSendTimeout_oid), + HANDLER_CAN_RONLY + )); + netsnmp_register_scalar( + netsnmp_create_handler_registration("kamailioNetTcpConnLifetime", handle_kamailioNetTcpConnLifetime, + kamailioNetTcpConnLifetime_oid, OID_LENGTH(kamailioNetTcpConnLifetime_oid), + HANDLER_CAN_RONLY + )); }
-#ifdef SKREP - con_timeout: 0 - connect_success: 0 - current_write_queue_size: 0 - local_reject: 0 - passive_open: 0 - send_timeout: 0 - sendq_full: 0 -#endif - int handle_kamailioNetTcpConnEstablished(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, @@ -400,3 +408,88 @@ handle_kamailioNetTcpAsync(netsnmp_mib_handler *handler,
return SNMP_ERR_NOERROR; } + +int +handle_kamailioNetTcpConnTimeout(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + struct cfg_group_tcp t; + unsigned int value; + + tcp_options_get(&t); + value = t.connect_timeout_s; + + switch(reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) &value, sizeof(int)); + break; + + + default: + /* we should never get here, so this is a really bad error */ + snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnTimeout\n", reqinfo->mode ); + return SNMP_ERR_GENERR; + } + + return SNMP_ERR_NOERROR; +} +int +handle_kamailioNetTcpSendTimeout(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + struct cfg_group_tcp t; + unsigned int value; + + tcp_options_get(&t); + value = t.send_timeout; + + switch(reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) &value, sizeof(int)); + break; + + + default: + /* we should never get here, so this is a really bad error */ + snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpSendTimeout\n", reqinfo->mode ); + return SNMP_ERR_GENERR; + } + + return SNMP_ERR_NOERROR; +} +int +handle_kamailioNetTcpConnLifetime(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + struct cfg_group_tcp t; + unsigned int value; + + tcp_options_get(&t); + value = t.con_lifetime; + + switch(reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) &value, sizeof(int)); + break; + + + default: + /* we should never get here, so this is a really bad error */ + snmp_log(LOG_ERR, "unknown mode (%d) in handle_kamailioNetTcpConnLifetime\n", reqinfo->mode ); + return SNMP_ERR_GENERR; + } + + return SNMP_ERR_NOERROR; +} diff --git a/modules/snmpstats/kamailioNet.h b/modules/snmpstats/kamailioNet.h index f037b3b..9690b3a 100644 --- a/modules/snmpstats/kamailioNet.h +++ b/modules/snmpstats/kamailioNet.h @@ -17,5 +17,8 @@ Netsnmp_Node_Handler handle_kamailioNetTcpConnReject; Netsnmp_Node_Handler handle_kamailioNetTcpEnabled; Netsnmp_Node_Handler handle_kamailioNetTcpMaxConns; Netsnmp_Node_Handler handle_kamailioNetTcpAsync; +Netsnmp_Node_Handler handle_kamailioNetTcpConnTimeout; +Netsnmp_Node_Handler handle_kamailioNetTcpSendTimeout; +Netsnmp_Node_Handler handle_kamailioNetTcpConnLifetime;
#endif /* KAMAILIONET_H */ diff --git a/modules/snmpstats/mibs/KAMAILIO-MIB b/modules/snmpstats/mibs/KAMAILIO-MIB index 96bc9e9..0b896e0 100644 --- a/modules/snmpstats/mibs/KAMAILIO-MIB +++ b/modules/snmpstats/mibs/KAMAILIO-MIB @@ -318,7 +318,7 @@ KAMAILIO-MIB DEFINITIONS ::= BEGIN MAX-ACCESS read-only STATUS current DESCRIPTION - "Maximum number of TCP connections (configurable)" + "Maximum number of TCP connections (tcp_max_connections)" ::= { kamailioNetTcpConfig 2 }
kamailioNetTcpAsync OBJECT-TYPE @@ -326,13 +326,41 @@ KAMAILIO-MIB DEFINITIONS ::= BEGIN MAX-ACCESS read-only STATUS current DESCRIPTION - "True if TCP Async is enabled in this server." + "True if TCP Async is enabled in this server (tcp_async)" ::= { kamailioNetTcpConfig 3 }
- --- connect_timeout: 10 - --- send_timeout: 10 - --- connection_lifetime: 120 - --- max_connections(soft): 2048 + kamailioNetTcpConnTimeout OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "TCP Connection Timeout (tcp_connect_timeout)" + ::= { kamailioNetTcpConfig 4 } + + kamailioNetTcpSendTimeout OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Time in seconds after a TCP connection will be closed if it is not available for writing in this interval (tcp_send_timeout)" + ::= { kamailioNetTcpConfig 5 } + + kamailioNetTcpConnLifetime OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Lifetime in seconds for TCP sessions (tcp_connection_lifetime)" + ::= { kamailioNetTcpConfig 6 } + + kamailioNetTcpConnLifetime OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Maximum number of tcp connections (tcp_max_connections)" + ::= { kamailioNetTcpConfig 7 } + --- max_tls_connections(soft): 2048 --- no_connect: 0 --- fd_cache: 1 @@ -388,12 +416,12 @@ KAMAILIO-MIB DEFINITIONS ::= BEGIN "Number of successful TCP connections" ::= { kamailioNetTcpStat 4 }
- kamailioNetTcpConnOpened OBJECT-TYPE + kamailioNetTcpConnOpen OBJECT-TYPE SYNTAX Gauge32 MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of current opened TCP connections" + "Number of current open TCP connections" ::= { kamailioNetTcpStat 5 }
kamailioNetTcpConnPassiveOpen OBJECT-TYPE