Fixed monitor scripts and added extra logging.

This commit is contained in:
Markus Makela
2015-09-11 18:38:19 +03:00
parent 743fb5774b
commit 3b0b740e47
2 changed files with 23 additions and 16 deletions

View File

@ -114,6 +114,7 @@ EXTERNCMD* externcmd_allocate(char* argstr)
externcmd_free(cmd);
return NULL;
}
skygw_log_write(LT, "Executing script %s.", cmd->parameters[0]);
}
return cmd;
}

View File

@ -294,6 +294,12 @@ bool mon_print_fail_status(
return succp;
}
/**
* Launch a script
* @param mon Owning monitor
* @param ptr The server which has changed state
* @param script Script to execute
*/
void monitor_launch_script(MONITOR* mon, MONITOR_SERVERS* ptr, char* script)
{
char argstr[PATH_MAX + MON_ARG_MAX + 1];
@ -318,7 +324,7 @@ void monitor_launch_script(MONITOR* mon,MONITOR_SERVERS* ptr, char* script)
skygw_log_write(LOGFILE_ERROR,
"Error: Failed to execute script "
"'%s' on server state change event %s.",
script,mon_get_event_type(ptr));
script, mon_get_event_name(ptr));
}
externcmd_free(cmd);
}