int32_t sps;
int32_t sps_last;
int32_t sps_peak;
+ int32_t sps_peak_fivemin;
switch_log_level_t hard_log_level;
char *mailer_app;
char *mailer_app_args;
SCSC_SQL,
SCSC_API_EXPANSION,
SCSC_RECOVER,
- SCSC_SPS_PEAK
+ SCSC_SPS_PEAK,
+ SCSC_SPS_PEAK_FIVEMIN
} switch_session_ctl_t;
typedef enum {
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 };
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);
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,
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);
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:
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);
#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
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-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, "Idle-CPU", "%f", switch_core_idle_cpu());
switch_event_fire(&event);
}
newintval = runtime.sps_peak;
break;
+ case SCSC_SPS_PEAK_FIVEMIN:
+ newintval = runtime.sps_peak_fivemin;
+ break;
case SCSC_MAX_DTMF_DURATION:
newintval = switch_core_max_dtmf_duration(oldintval);
break;
{
switch_time_t too_late = runtime.microseconds_per_tick * 1000;
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;
int fwd_errs = 0, rev_errs = 0;
int profile_tick = 0;
switch_mutex_lock(runtime.throttle_mutex);
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) {
runtime.sps_peak = runtime.sps_last;
}