mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
add peak SPS for last 5 minutes
This commit is contained in:
@@ -2012,7 +2012,7 @@ SWITCH_STANDARD_API(lan_addr_function)
|
||||
SWITCH_STANDARD_API(status_function)
|
||||
{
|
||||
switch_core_time_duration_t duration = { 0 };
|
||||
int sps = 0, last_sps = 0, max_sps = 0;
|
||||
int sps = 0, last_sps = 0, max_sps = 0, max_sps_fivemin = 0;
|
||||
switch_bool_t html = SWITCH_FALSE; /* shortcut to format.html */
|
||||
char * nl = "\n"; /* shortcut to format.nl */
|
||||
stream_format format = { 0 };
|
||||
@@ -2059,7 +2059,8 @@ SWITCH_STANDARD_API(status_function)
|
||||
switch_core_session_ctl(SCSC_LAST_SPS, &last_sps);
|
||||
switch_core_session_ctl(SCSC_SPS, &sps);
|
||||
switch_core_session_ctl(SCSC_SPS_PEAK, &max_sps);
|
||||
stream->write_function(stream, "%d session(s) - %d out of max %d per sec peak %d %s", switch_core_session_count(), last_sps, sps, max_sps, nl);
|
||||
switch_core_session_ctl(SCSC_SPS_PEAK_FIVEMIN, &max_sps_fivemin);
|
||||
stream->write_function(stream, "%d session(s) - %d out of max %d per sec peak %d (%d last 5min) %s", switch_core_session_count(), last_sps, sps, max_sps, max_sps_fivemin, nl);
|
||||
stream->write_function(stream, "%d session(s) max%s", switch_core_session_limit(0), nl);
|
||||
stream->write_function(stream, "min idle cpu %0.2f/%0.2f%s", switch_core_min_idle_cpu(-1.0), switch_core_idle_cpu(), nl);
|
||||
|
||||
|
||||
@@ -146,9 +146,17 @@ peakSessionsPerSecond OBJECT-TYPE
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Maximum sessions per second"
|
||||
"Peak sessions per second"
|
||||
::= { systemStats 8 }
|
||||
|
||||
peakSessionsPerSecond OBJECT-TYPE
|
||||
SYNTAX Gauge32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Peak sessions per second last 5 minutes"
|
||||
::= { systemStats 9 }
|
||||
|
||||
|
||||
ChannelEntry ::= SEQUENCE {
|
||||
chanIndex Integer32,
|
||||
|
||||
@@ -158,7 +158,7 @@ void init_subagent(switch_memory_pool_t *pool)
|
||||
DEBUGMSGTL(("init_subagent", "mod_snmp subagent initializing\n"));
|
||||
|
||||
netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2);
|
||||
netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 8);
|
||||
netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 9);
|
||||
|
||||
ch_table_info = switch_core_alloc(pool, sizeof(netsnmp_table_registration_info));
|
||||
netsnmp_table_helper_add_indexes(ch_table_info, ASN_INTEGER, 0);
|
||||
@@ -216,6 +216,7 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio
|
||||
switch(reqinfo->mode) {
|
||||
case MODE_GET:
|
||||
subid = requests->requestvb->name[reginfo->rootoid_len - 2];
|
||||
snmp_log(LOG_DEBUG, "systemStats OID-suffix requested (%d)\n", (int) subid);
|
||||
|
||||
switch (subid) {
|
||||
case SS_UPTIME:
|
||||
@@ -261,6 +262,10 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio
|
||||
switch_core_session_ctl(SCSC_SPS_PEAK, &int_val);
|
||||
snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);
|
||||
break;
|
||||
case SS_PEAK_SESSIONS_PER_FIVEMIN:
|
||||
switch_core_session_ctl(SCSC_SPS_PEAK_FIVEMIN, &int_val);
|
||||
snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);
|
||||
break;
|
||||
default:
|
||||
snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
|
||||
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define SS_SESSIONS_PER_SECOND 6
|
||||
#define SS_MAX_SESSIONS_PER_SECOND 7
|
||||
#define SS_PEAK_SESSIONS_PER_SECOND 8
|
||||
#define SS_PEAK_SESSIONS_PER_FIVEMIN 9
|
||||
|
||||
/* .1.3.6.1.4.1.27880.1.9 */
|
||||
#define CH_INDEX 1
|
||||
|
||||
Reference in New Issue
Block a user