add peak SPS for last 5 minutes
This commit is contained in:
parent
b830e6fd4b
commit
5660f90509
|
@ -241,6 +241,7 @@ struct switch_runtime {
|
||||||
int32_t sps;
|
int32_t sps;
|
||||||
int32_t sps_last;
|
int32_t sps_last;
|
||||||
int32_t sps_peak;
|
int32_t sps_peak;
|
||||||
|
int32_t sps_peak_fivemin;
|
||||||
switch_log_level_t hard_log_level;
|
switch_log_level_t hard_log_level;
|
||||||
char *mailer_app;
|
char *mailer_app;
|
||||||
char *mailer_app_args;
|
char *mailer_app_args;
|
||||||
|
|
|
@ -1888,7 +1888,8 @@ typedef enum {
|
||||||
SCSC_SQL,
|
SCSC_SQL,
|
||||||
SCSC_API_EXPANSION,
|
SCSC_API_EXPANSION,
|
||||||
SCSC_RECOVER,
|
SCSC_RECOVER,
|
||||||
SCSC_SPS_PEAK
|
SCSC_SPS_PEAK,
|
||||||
|
SCSC_SPS_PEAK_FIVEMIN
|
||||||
} switch_session_ctl_t;
|
} switch_session_ctl_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -2012,7 +2012,7 @@ SWITCH_STANDARD_API(lan_addr_function)
|
||||||
SWITCH_STANDARD_API(status_function)
|
SWITCH_STANDARD_API(status_function)
|
||||||
{
|
{
|
||||||
switch_core_time_duration_t duration = { 0 };
|
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 */
|
switch_bool_t html = SWITCH_FALSE; /* shortcut to format.html */
|
||||||
char * nl = "\n"; /* shortcut to format.nl */
|
char * nl = "\n"; /* shortcut to format.nl */
|
||||||
stream_format format = { 0 };
|
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_LAST_SPS, &last_sps);
|
||||||
switch_core_session_ctl(SCSC_SPS, &sps);
|
switch_core_session_ctl(SCSC_SPS, &sps);
|
||||||
switch_core_session_ctl(SCSC_SPS_PEAK, &max_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, "%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);
|
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
|
MAX-ACCESS read-only
|
||||||
STATUS current
|
STATUS current
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
"Maximum sessions per second"
|
"Peak sessions per second"
|
||||||
::= { systemStats 8 }
|
::= { 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 {
|
ChannelEntry ::= SEQUENCE {
|
||||||
chanIndex Integer32,
|
chanIndex Integer32,
|
||||||
|
|
|
@ -158,7 +158,7 @@ void init_subagent(switch_memory_pool_t *pool)
|
||||||
DEBUGMSGTL(("init_subagent", "mod_snmp subagent initializing\n"));
|
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("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));
|
ch_table_info = switch_core_alloc(pool, sizeof(netsnmp_table_registration_info));
|
||||||
netsnmp_table_helper_add_indexes(ch_table_info, ASN_INTEGER, 0);
|
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) {
|
switch(reqinfo->mode) {
|
||||||
case MODE_GET:
|
case MODE_GET:
|
||||||
subid = requests->requestvb->name[reginfo->rootoid_len - 2];
|
subid = requests->requestvb->name[reginfo->rootoid_len - 2];
|
||||||
|
snmp_log(LOG_DEBUG, "systemStats OID-suffix requested (%d)\n", (int) subid);
|
||||||
|
|
||||||
switch (subid) {
|
switch (subid) {
|
||||||
case SS_UPTIME:
|
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);
|
switch_core_session_ctl(SCSC_SPS_PEAK, &int_val);
|
||||||
snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);
|
snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);
|
||||||
break;
|
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:
|
default:
|
||||||
snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
|
snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid);
|
||||||
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#define SS_SESSIONS_PER_SECOND 6
|
#define SS_SESSIONS_PER_SECOND 6
|
||||||
#define SS_MAX_SESSIONS_PER_SECOND 7
|
#define SS_MAX_SESSIONS_PER_SECOND 7
|
||||||
#define SS_PEAK_SESSIONS_PER_SECOND 8
|
#define SS_PEAK_SESSIONS_PER_SECOND 8
|
||||||
|
#define SS_PEAK_SESSIONS_PER_FIVEMIN 9
|
||||||
|
|
||||||
/* .1.3.6.1.4.1.27880.1.9 */
|
/* .1.3.6.1.4.1.27880.1.9 */
|
||||||
#define CH_INDEX 1
|
#define CH_INDEX 1
|
||||||
|
|
|
@ -89,6 +89,7 @@ static void send_heartbeat(void)
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Max-Sessions", "%u", switch_core_session_limit(0));
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Max-Sessions", "%u", switch_core_session_limit(0));
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec", "%u", runtime.sps);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec", "%u", runtime.sps);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec-Max", "%u", runtime.sps_peak);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec-Max", "%u", runtime.sps_peak);
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec-FiveMin", "%u", runtime.sps_peak_fivemin);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Since-Startup", "%" SWITCH_SIZE_T_FMT, switch_core_session_id() - 1);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Since-Startup", "%" SWITCH_SIZE_T_FMT, switch_core_session_id() - 1);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Idle-CPU", "%f", switch_core_idle_cpu());
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Idle-CPU", "%f", switch_core_idle_cpu());
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
|
@ -2484,6 +2485,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
|
||||||
}
|
}
|
||||||
newintval = runtime.sps_peak;
|
newintval = runtime.sps_peak;
|
||||||
break;
|
break;
|
||||||
|
case SCSC_SPS_PEAK_FIVEMIN:
|
||||||
|
newintval = runtime.sps_peak_fivemin;
|
||||||
|
break;
|
||||||
case SCSC_MAX_DTMF_DURATION:
|
case SCSC_MAX_DTMF_DURATION:
|
||||||
newintval = switch_core_max_dtmf_duration(oldintval);
|
newintval = switch_core_max_dtmf_duration(oldintval);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -802,7 +802,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
||||||
{
|
{
|
||||||
switch_time_t too_late = runtime.microseconds_per_tick * 1000;
|
switch_time_t too_late = runtime.microseconds_per_tick * 1000;
|
||||||
uint32_t current_ms = 0;
|
uint32_t current_ms = 0;
|
||||||
uint32_t x, tick = 0;
|
uint32_t x, tick = 0, sps_interval_ticks = 0;
|
||||||
switch_time_t ts = 0, last = 0;
|
switch_time_t ts = 0, last = 0;
|
||||||
int fwd_errs = 0, rev_errs = 0;
|
int fwd_errs = 0, rev_errs = 0;
|
||||||
int profile_tick = 0;
|
int profile_tick = 0;
|
||||||
|
@ -1009,6 +1009,16 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
||||||
switch_mutex_lock(runtime.throttle_mutex);
|
switch_mutex_lock(runtime.throttle_mutex);
|
||||||
runtime.sps_last = runtime.sps_total - runtime.sps;
|
runtime.sps_last = runtime.sps_total - runtime.sps;
|
||||||
|
|
||||||
|
if (sps_interval_ticks >= 300) {
|
||||||
|
runtime.sps_peak_fivemin = 0;
|
||||||
|
sps_interval_ticks = 0;
|
||||||
|
}
|
||||||
|
sps_interval_ticks++;
|
||||||
|
|
||||||
|
if (runtime.sps_last > runtime.sps_peak_fivemin) {
|
||||||
|
runtime.sps_peak_fivemin = runtime.sps_last;
|
||||||
|
}
|
||||||
|
|
||||||
if (runtime.sps_last > runtime.sps_peak) {
|
if (runtime.sps_last > runtime.sps_peak) {
|
||||||
runtime.sps_peak = runtime.sps_last;
|
runtime.sps_peak = runtime.sps_last;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue