peak sessions step 1
This commit is contained in:
parent
b9c9d34482
commit
3c7e78ac5a
|
@ -240,6 +240,8 @@ struct switch_runtime {
|
|||
int32_t sps_last;
|
||||
int32_t sps_peak;
|
||||
int32_t sps_peak_fivemin;
|
||||
int32_t sessions_peak;
|
||||
int32_t sessions_peak_fivemin;
|
||||
switch_log_level_t hard_log_level;
|
||||
char *mailer_app;
|
||||
char *mailer_app_args;
|
||||
|
|
|
@ -1863,7 +1863,9 @@ typedef enum {
|
|||
SCSC_API_EXPANSION,
|
||||
SCSC_RECOVER,
|
||||
SCSC_SPS_PEAK,
|
||||
SCSC_SPS_PEAK_FIVEMIN
|
||||
SCSC_SPS_PEAK_FIVEMIN,
|
||||
SCSC_SESSIONS_PEAK,
|
||||
SCSC_SESSIONS_PEAK_FIVEMIN
|
||||
} switch_session_ctl_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -149,7 +149,7 @@ peakSessionsPerSecond OBJECT-TYPE
|
|||
"Peak sessions per second"
|
||||
::= { systemStats 8 }
|
||||
|
||||
peakSessionsPerSecond OBJECT-TYPE
|
||||
peakSessionsPerSecondFiveMin OBJECT-TYPE
|
||||
SYNTAX Gauge32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
|
@ -157,6 +157,21 @@ peakSessionsPerSecond OBJECT-TYPE
|
|||
"Peak sessions per second last 5 minutes"
|
||||
::= { systemStats 9 }
|
||||
|
||||
peakSessions OBJECT-TYPE
|
||||
SYNTAX Gauge32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Peak sessions"
|
||||
::= { systemStats 10 }
|
||||
|
||||
peakSessionsFiveMin OBJECT-TYPE
|
||||
SYNTAX Gauge32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Peak sessions last 5 minutes"
|
||||
::= { systemStats 11 }
|
||||
|
||||
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, 9);
|
||||
netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 11);
|
||||
|
||||
ch_table_info = switch_core_alloc(pool, sizeof(netsnmp_table_registration_info));
|
||||
netsnmp_table_helper_add_indexes(ch_table_info, ASN_INTEGER, 0);
|
||||
|
@ -266,6 +266,14 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio
|
|||
switch_core_session_ctl(SCSC_SPS_PEAK_FIVEMIN, &int_val);
|
||||
snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);
|
||||
break;
|
||||
case SS_PEAK_SESSIONS:
|
||||
switch_core_session_ctl(SCSC_SESSIONS_PEAK, &int_val);
|
||||
snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val);
|
||||
break;
|
||||
case SS_PEAK_SESSIONS_FIVEMIN:
|
||||
switch_core_session_ctl(SCSC_SESSIONS_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);
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#define SS_MAX_SESSIONS_PER_SECOND 7
|
||||
#define SS_PEAK_SESSIONS_PER_SECOND 8
|
||||
#define SS_PEAK_SESSIONS_PER_FIVEMIN 9
|
||||
#define SS_PEAK_SESSIONS 10
|
||||
#define SS_PEAK_SESSIONS_FIVEMIN 11
|
||||
|
||||
/* .1.3.6.1.4.1.27880.1.9 */
|
||||
#define CH_INDEX 1
|
||||
|
|
|
@ -91,6 +91,8 @@ static void send_heartbeat(void)
|
|||
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-Peak-Max", "%u", runtime.sessions_peak);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Peak-FiveMin", "%u", runtime.sessions_peak_fivemin);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Idle-CPU", "%f", switch_core_idle_cpu());
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
@ -2475,6 +2477,12 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
|
|||
case SCSC_SPS_PEAK_FIVEMIN:
|
||||
newintval = runtime.sps_peak_fivemin;
|
||||
break;
|
||||
case SCSC_SESSIONS_PEAK:
|
||||
newintval = runtime.sessions_peak;
|
||||
break;
|
||||
case SCSC_SESSIONS_PEAK_FIVEMIN:
|
||||
newintval = runtime.sessions_peak_fivemin;
|
||||
break;
|
||||
case SCSC_MAX_DTMF_DURATION:
|
||||
newintval = switch_core_max_dtmf_duration(oldintval);
|
||||
break;
|
||||
|
|
|
@ -2293,6 +2293,14 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
|
|||
switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
|
||||
session->id = session_manager.session_id++;
|
||||
session_manager.session_count++;
|
||||
|
||||
if (session_manager.session_count > runtime.sessions_peak) {
|
||||
runtime.sessions_peak = session_manager.session_count;
|
||||
}
|
||||
if (session_manager.session_count > runtime.sessions_peak_fivemin) {
|
||||
runtime.sessions_peak_fivemin = session_manager.session_count;
|
||||
}
|
||||
|
||||
switch_mutex_unlock(runtime.session_hash_mutex);
|
||||
|
||||
switch_channel_set_variable_printf(session->channel, "session_id", "%u", session->id);
|
||||
|
|
|
@ -1012,7 +1012,11 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
|||
if (sps_interval_ticks >= 300) {
|
||||
runtime.sps_peak_fivemin = 0;
|
||||
sps_interval_ticks = 0;
|
||||
switch_mutex_lock(runtime.session_hash_mutex);
|
||||
runtime.sessions_peak_fivemin = session_manager.session_count;
|
||||
switch_mutex_unlock(runtime.session_hash_mutex);
|
||||
}
|
||||
|
||||
sps_interval_ticks++;
|
||||
|
||||
if (runtime.sps_last > runtime.sps_peak_fivemin) {
|
||||
|
|
Loading…
Reference in New Issue