Changed ftdm_cpu_monitor behaviour
This commit is contained in:
parent
f37729152d
commit
1c9fe263d6
|
@ -4099,8 +4099,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load)
|
|||
|
||||
ftdm_global_set_config_directory(SWITCH_GLOBAL_dirs.conf_dir);
|
||||
|
||||
ftdm_cpu_monitor_disable();
|
||||
|
||||
if (ftdm_global_init() != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Error loading FreeTDM\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
|
|
|
@ -86,6 +86,7 @@ FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void)
|
|||
}
|
||||
|
||||
typedef struct {
|
||||
uint8_t enabled;
|
||||
uint8_t running;
|
||||
uint8_t alarm;
|
||||
uint32_t interval;
|
||||
|
@ -112,8 +113,6 @@ static struct {
|
|||
cpu_monitor_t cpu_monitor;
|
||||
} globals;
|
||||
|
||||
static uint8_t ftdm_cpu_monitor_disabled = 0;
|
||||
|
||||
enum ftdm_enum_cpu_alarm_action_flags
|
||||
{
|
||||
FTDM_CPU_ALARM_ACTION_WARN = (1 << 0),
|
||||
|
@ -4004,7 +4003,14 @@ static ftdm_status_t load_config(void)
|
|||
ftdm_log(FTDM_LOG_ERROR, "unknown span variable '%s'\n", var);
|
||||
}
|
||||
} else if (!strncasecmp(cfg.category, "general", 7)) {
|
||||
if (!strncasecmp(var, "cpu_monitoring_interval", sizeof("cpu_monitoring_interval")-1)) {
|
||||
if (!strncasecmp(var, "cpu_monitor", sizeof("cpu_monitor")-1)) {
|
||||
if (!strncasecmp(val, "yes", 3)) {
|
||||
globals.cpu_monitor.enabled = 1;
|
||||
if (!globals.cpu_monitor.alarm_action_flags) {
|
||||
globals.cpu_monitor.alarm_action_flags |= FTDM_CPU_ALARM_ACTION_WARN;
|
||||
}
|
||||
}
|
||||
} else if (!strncasecmp(var, "cpu_monitoring_interval", sizeof("cpu_monitoring_interval")-1)) {
|
||||
if (atoi(val) > 0) {
|
||||
globals.cpu_monitor.interval = atoi(val);
|
||||
} else {
|
||||
|
@ -4749,12 +4755,6 @@ static void ftdm_cpu_monitor_stop(void)
|
|||
ftdm_interrupt_destroy(&globals.cpu_monitor.interrupt);
|
||||
}
|
||||
|
||||
FT_DECLARE(void) ftdm_cpu_monitor_disable(void)
|
||||
{
|
||||
ftdm_cpu_monitor_disabled = 1;
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_init(void)
|
||||
{
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
@ -4796,8 +4796,9 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void)
|
|||
|
||||
ftdm_log(FTDM_LOG_NOTICE, "Modules configured: %d \n", modcount);
|
||||
|
||||
globals.cpu_monitor.enabled = 0;
|
||||
globals.cpu_monitor.interval = 1000;
|
||||
globals.cpu_monitor.alarm_action_flags = FTDM_CPU_ALARM_ACTION_WARN | FTDM_CPU_ALARM_ACTION_REJECT;
|
||||
globals.cpu_monitor.alarm_action_flags = 0;
|
||||
globals.cpu_monitor.set_alarm_threshold = 80;
|
||||
globals.cpu_monitor.reset_alarm_threshold = 70;
|
||||
|
||||
|
@ -4807,7 +4808,12 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void)
|
|||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (!ftdm_cpu_monitor_disabled) {
|
||||
if (globals.cpu_monitor.enabled) {
|
||||
ftdm_log(FTDM_LOG_INFO, "CPU Monitor is running interval:%d lo-thres:%d hi-thres:%d\n",
|
||||
globals.cpu_monitor.interval,
|
||||
globals.cpu_monitor.set_alarm_threshold,
|
||||
globals.cpu_monitor.reset_alarm_threshold);
|
||||
|
||||
if (ftdm_cpu_monitor_start() != FTDM_SUCCESS) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
|
|
@ -611,6 +611,7 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span)
|
|||
|
||||
cfg.hdr.response.selector=0;
|
||||
|
||||
|
||||
cfg.t.cfg.s.inDLSAP.sapId = signal_data->link_id;
|
||||
cfg.t.cfg.s.inDLSAP.spId = signal_data->link_id;
|
||||
cfg.t.cfg.s.inDLSAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype);
|
||||
|
|
Loading…
Reference in New Issue