Added more error logging when monitor scripts fail.

This commit is contained in:
Markus Makela
2015-06-10 06:09:42 +03:00
parent 528e69b726
commit 3fb1213dee
5 changed files with 55 additions and 14 deletions

View File

@ -123,7 +123,7 @@ startMonitor(void *arg,void* opt)
MONITOR* mon = arg;
GALERA_MONITOR *handle = mon->handle;
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*)opt;
bool have_events = false;
bool have_events = false,script_error = false;
if (handle != NULL)
{
handle->shutdown = 0;
@ -163,6 +163,7 @@ startMonitor(void *arg,void* opt)
}
else
{
script_error = true;
if(access(params->value,F_OK) == 0)
{
skygw_log_write(LE,
@ -175,17 +176,24 @@ startMonitor(void *arg,void* opt)
"Error: The file cannot be found: %s",
params->value);
}
handle->script = NULL;
}
}
else if(!strcmp(params->name,"events"))
{
mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value);
have_events = true;
if(mon_parse_event_string((bool*)&handle->events,sizeof(handle->events),params->value) != 0)
script_error = true;
else
have_events = true;
}
params = params->next;
}
if(script_error)
{
skygw_log_write(LE,"Error: Errors were found in the script configuration parameters "
"for the monitor '%s'. The script will not be used.",mon->name);
free(handle->script);
handle->script = NULL;
}
/** If no specific events are given, enable them all */
if(!have_events)
{