Reindent server/core/monitor.c
This commit is contained in:
@ -22,12 +22,12 @@
|
|||||||
* @verbatim
|
* @verbatim
|
||||||
* Revision History
|
* Revision History
|
||||||
*
|
*
|
||||||
* Date Who Description
|
* Date Who Description
|
||||||
* 08/07/13 Mark Riddoch Initial implementation
|
* 08/07/13 Mark Riddoch Initial implementation
|
||||||
* 23/05/14 Massimiliano Pinto Addition of monitor_interval parameter
|
* 23/05/14 Massimiliano Pinto Addition of monitor_interval parameter
|
||||||
* and monitor id
|
* and monitor id
|
||||||
* 30/10/14 Massimiliano Pinto Addition of disable_master_failback parameter
|
* 30/10/14 Massimiliano Pinto Addition of disable_master_failback parameter
|
||||||
* 07/11/14 Massimiliano Pinto Addition of monitor network timeouts
|
* 07/11/14 Massimiliano Pinto Addition of monitor network timeouts
|
||||||
* 08/05/15 Markus Makela Moved common monitor variables to MONITOR struct
|
* 08/05/15 Markus Makela Moved common monitor variables to MONITOR struct
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
@ -59,82 +59,88 @@ const monitor_def_t monitor_event_definitions[MAX_MONITOR_EVENT] =
|
|||||||
};
|
};
|
||||||
#undef ADDITEM
|
#undef ADDITEM
|
||||||
|
|
||||||
static MONITOR *allMonitors = NULL;
|
static MONITOR *allMonitors = NULL;
|
||||||
static SPINLOCK monLock = SPINLOCK_INIT;
|
static SPINLOCK monLock = SPINLOCK_INIT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a new monitor, load the associated module for the monitor
|
* Allocate a new monitor, load the associated module for the monitor
|
||||||
* and start execution on the monitor.
|
* and start execution on the monitor.
|
||||||
*
|
*
|
||||||
* @param name The name of the monitor module to load
|
* @param name The name of the monitor module to load
|
||||||
* @param module The module to load
|
* @param module The module to load
|
||||||
* @return The newly created monitor
|
* @return The newly created monitor
|
||||||
*/
|
*/
|
||||||
MONITOR *
|
MONITOR *
|
||||||
monitor_alloc(char *name, char *module)
|
monitor_alloc(char *name, char *module)
|
||||||
{
|
{
|
||||||
MONITOR *mon;
|
MONITOR *mon;
|
||||||
|
|
||||||
if ((mon = (MONITOR *)malloc(sizeof(MONITOR))) == NULL)
|
if ((mon = (MONITOR *)malloc(sizeof(MONITOR))) == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mon->module = load_module(module, MODULE_MONITOR)) == NULL)
|
if ((mon->module = load_module(module, MODULE_MONITOR)) == NULL)
|
||||||
{
|
{
|
||||||
MXS_ERROR("Unable to load monitor module '%s'.", name);
|
MXS_ERROR("Unable to load monitor module '%s'.", name);
|
||||||
free(mon);
|
free(mon);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
mon->state = MONITOR_STATE_ALLOC;
|
mon->state = MONITOR_STATE_ALLOC;
|
||||||
mon->name = strdup(name);
|
mon->name = strdup(name);
|
||||||
mon->handle = NULL;
|
mon->handle = NULL;
|
||||||
mon->databases = NULL;
|
mon->databases = NULL;
|
||||||
mon->password = NULL;
|
mon->password = NULL;
|
||||||
mon->user = NULL;
|
mon->user = NULL;
|
||||||
mon->password = NULL;
|
mon->password = NULL;
|
||||||
mon->read_timeout = DEFAULT_READ_TIMEOUT;
|
mon->read_timeout = DEFAULT_READ_TIMEOUT;
|
||||||
mon->write_timeout = DEFAULT_WRITE_TIMEOUT;
|
mon->write_timeout = DEFAULT_WRITE_TIMEOUT;
|
||||||
mon->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
mon->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
||||||
mon->interval = MONITOR_INTERVAL;
|
mon->interval = MONITOR_INTERVAL;
|
||||||
mon->parameters = NULL;
|
mon->parameters = NULL;
|
||||||
spinlock_init(&mon->lock);
|
spinlock_init(&mon->lock);
|
||||||
spinlock_acquire(&monLock);
|
spinlock_acquire(&monLock);
|
||||||
mon->next = allMonitors;
|
mon->next = allMonitors;
|
||||||
allMonitors = mon;
|
allMonitors = mon;
|
||||||
spinlock_release(&monLock);
|
spinlock_release(&monLock);
|
||||||
|
|
||||||
return mon;
|
return mon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free a monitor, first stop the monitor and then remove the monitor from
|
* Free a monitor, first stop the monitor and then remove the monitor from
|
||||||
* the chain of monitors and free the memory.
|
* the chain of monitors and free the memory.
|
||||||
*
|
*
|
||||||
* @param mon The monitor to free
|
* @param mon The monitor to free
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitor_free(MONITOR *mon)
|
monitor_free(MONITOR *mon)
|
||||||
{
|
{
|
||||||
MONITOR *ptr;
|
MONITOR *ptr;
|
||||||
|
|
||||||
mon->module->stopMonitor(mon);
|
mon->module->stopMonitor(mon);
|
||||||
mon->state = MONITOR_STATE_FREED;
|
mon->state = MONITOR_STATE_FREED;
|
||||||
spinlock_acquire(&monLock);
|
spinlock_acquire(&monLock);
|
||||||
if (allMonitors == mon)
|
if (allMonitors == mon)
|
||||||
allMonitors = mon->next;
|
{
|
||||||
else
|
allMonitors = mon->next;
|
||||||
{
|
}
|
||||||
ptr = allMonitors;
|
else
|
||||||
while (ptr->next && ptr->next != mon)
|
{
|
||||||
ptr = ptr->next;
|
ptr = allMonitors;
|
||||||
if (ptr->next)
|
while (ptr->next && ptr->next != mon)
|
||||||
ptr->next = mon->next;
|
{
|
||||||
}
|
ptr = ptr->next;
|
||||||
spinlock_release(&monLock);
|
}
|
||||||
free_config_parameter(mon->parameters);
|
if (ptr->next)
|
||||||
free(mon->name);
|
{
|
||||||
free(mon);
|
ptr->next = mon->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spinlock_release(&monLock);
|
||||||
|
free_config_parameter(mon->parameters);
|
||||||
|
free(mon->name);
|
||||||
|
free(mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,10 +152,10 @@ MONITOR *ptr;
|
|||||||
void
|
void
|
||||||
monitorStart(MONITOR *monitor, void* params)
|
monitorStart(MONITOR *monitor, void* params)
|
||||||
{
|
{
|
||||||
spinlock_acquire(&monitor->lock);
|
spinlock_acquire(&monitor->lock);
|
||||||
monitor->handle = (*monitor->module->startMonitor)(monitor,params);
|
monitor->handle = (*monitor->module->startMonitor)(monitor,params);
|
||||||
monitor->state = MONITOR_STATE_RUNNING;
|
monitor->state = MONITOR_STATE_RUNNING;
|
||||||
spinlock_release(&monitor->lock);
|
spinlock_release(&monitor->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,16 +178,16 @@ void monitorStartAll()
|
|||||||
/**
|
/**
|
||||||
* Stop a given monitor
|
* Stop a given monitor
|
||||||
*
|
*
|
||||||
* @param monitor The monitor to stop
|
* @param monitor The monitor to stop
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorStop(MONITOR *monitor)
|
monitorStop(MONITOR *monitor)
|
||||||
{
|
{
|
||||||
if(monitor->state != MONITOR_STATE_STOPPED)
|
if (monitor->state != MONITOR_STATE_STOPPED)
|
||||||
{
|
{
|
||||||
monitor->state = MONITOR_STATE_STOPPING;
|
monitor->state = MONITOR_STATE_STOPPING;
|
||||||
monitor->module->stopMonitor(monitor);
|
monitor->module->stopMonitor(monitor);
|
||||||
monitor->state = MONITOR_STATE_STOPPED;
|
monitor->state = MONITOR_STATE_STOPPED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,63 +197,69 @@ monitorStop(MONITOR *monitor)
|
|||||||
void
|
void
|
||||||
monitorStopAll()
|
monitorStopAll()
|
||||||
{
|
{
|
||||||
MONITOR *ptr;
|
MONITOR *ptr;
|
||||||
|
|
||||||
spinlock_acquire(&monLock);
|
spinlock_acquire(&monLock);
|
||||||
ptr = allMonitors;
|
ptr = allMonitors;
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
monitorStop(ptr);
|
monitorStop(ptr);
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
}
|
||||||
spinlock_release(&monLock);
|
spinlock_release(&monLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a server to a monitor. Simply register the server that needs to be
|
* Add a server to a monitor. Simply register the server that needs to be
|
||||||
* monitored to the running monitor module.
|
* monitored to the running monitor module.
|
||||||
*
|
*
|
||||||
* @param mon The Monitor instance
|
* @param mon The Monitor instance
|
||||||
* @param server The Server to add to the monitoring
|
* @param server The Server to add to the monitoring
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorAddServer(MONITOR *mon, SERVER *server)
|
monitorAddServer(MONITOR *mon, SERVER *server)
|
||||||
{
|
{
|
||||||
MONITOR_SERVERS *ptr, *db;
|
MONITOR_SERVERS *ptr, *db;
|
||||||
|
|
||||||
if ((db = (MONITOR_SERVERS *)malloc(sizeof(MONITOR_SERVERS))) == NULL)
|
if ((db = (MONITOR_SERVERS *)malloc(sizeof(MONITOR_SERVERS))) == NULL)
|
||||||
return;
|
{
|
||||||
db->server = server;
|
return;
|
||||||
db->con = NULL;
|
}
|
||||||
db->next = NULL;
|
db->server = server;
|
||||||
db->mon_err_count = 0;
|
db->con = NULL;
|
||||||
db->log_version_err = true;
|
db->next = NULL;
|
||||||
/** Server status is uninitialized */
|
db->mon_err_count = 0;
|
||||||
db->mon_prev_status = -1;
|
db->log_version_err = true;
|
||||||
/* pending status is updated by get_replication_tree */
|
/** Server status is uninitialized */
|
||||||
db->pending_status = 0;
|
db->mon_prev_status = -1;
|
||||||
|
/* pending status is updated by get_replication_tree */
|
||||||
|
db->pending_status = 0;
|
||||||
|
|
||||||
spinlock_acquire(&mon->lock);
|
spinlock_acquire(&mon->lock);
|
||||||
|
|
||||||
if (mon->databases == NULL)
|
if (mon->databases == NULL)
|
||||||
mon->databases = db;
|
{
|
||||||
else
|
mon->databases = db;
|
||||||
{
|
}
|
||||||
ptr = mon->databases;
|
else
|
||||||
while (ptr->next != NULL)
|
{
|
||||||
ptr = ptr->next;
|
ptr = mon->databases;
|
||||||
ptr->next = db;
|
while (ptr->next != NULL)
|
||||||
}
|
{
|
||||||
spinlock_release(&mon->lock);
|
ptr = ptr->next;
|
||||||
|
}
|
||||||
|
ptr->next = db;
|
||||||
|
}
|
||||||
|
spinlock_release(&mon->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a default user to the monitor. This user is used to connect to the
|
* Add a default user to the monitor. This user is used to connect to the
|
||||||
* monitored databases but may be overriden on a per server basis.
|
* monitored databases but may be overriden on a per server basis.
|
||||||
*
|
*
|
||||||
* @param mon The monitor instance
|
* @param mon The monitor instance
|
||||||
* @param user The default username to use when connecting
|
* @param user The default username to use when connecting
|
||||||
* @param passwd The default password associated to the default user.
|
* @param passwd The default password associated to the default user.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorAddUser(MONITOR *mon, char *user, char *passwd)
|
monitorAddUser(MONITOR *mon, char *user, char *passwd)
|
||||||
@ -259,98 +271,104 @@ monitorAddUser(MONITOR *mon, char *user, char *passwd)
|
|||||||
/**
|
/**
|
||||||
* Show all monitors
|
* Show all monitors
|
||||||
*
|
*
|
||||||
* @param dcb DCB for printing output
|
* @param dcb DCB for printing output
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorShowAll(DCB *dcb)
|
monitorShowAll(DCB *dcb)
|
||||||
{
|
{
|
||||||
MONITOR *ptr;
|
MONITOR *ptr;
|
||||||
|
|
||||||
spinlock_acquire(&monLock);
|
spinlock_acquire(&monLock);
|
||||||
ptr = allMonitors;
|
ptr = allMonitors;
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
dcb_printf(dcb, "Monitor: %p\n", ptr);
|
dcb_printf(dcb, "Monitor: %p\n", ptr);
|
||||||
dcb_printf(dcb, "\tName: %s\n", ptr->name);
|
dcb_printf(dcb, "\tName: %s\n", ptr->name);
|
||||||
if (ptr->module->diagnostics)
|
if (ptr->module->diagnostics)
|
||||||
ptr->module->diagnostics(dcb, ptr);
|
{
|
||||||
ptr = ptr->next;
|
ptr->module->diagnostics(dcb, ptr);
|
||||||
}
|
}
|
||||||
spinlock_release(&monLock);
|
ptr = ptr->next;
|
||||||
|
}
|
||||||
|
spinlock_release(&monLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a single monitor
|
* Show a single monitor
|
||||||
*
|
*
|
||||||
* @param dcb DCB for printing output
|
* @param dcb DCB for printing output
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorShow(DCB *dcb, MONITOR *monitor)
|
monitorShow(DCB *dcb, MONITOR *monitor)
|
||||||
{
|
{
|
||||||
|
|
||||||
dcb_printf(dcb, "Monitor: %p\n", monitor);
|
dcb_printf(dcb, "Monitor: %p\n", monitor);
|
||||||
dcb_printf(dcb, "\tName: %s\n", monitor->name);
|
dcb_printf(dcb, "\tName: %s\n", monitor->name);
|
||||||
if (monitor->module->diagnostics)
|
if (monitor->module->diagnostics)
|
||||||
monitor->module->diagnostics(dcb, monitor);
|
{
|
||||||
|
monitor->module->diagnostics(dcb, monitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all the monitors
|
* List all the monitors
|
||||||
*
|
*
|
||||||
* @param dcb DCB for printing output
|
* @param dcb DCB for printing output
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorList(DCB *dcb)
|
monitorList(DCB *dcb)
|
||||||
{
|
{
|
||||||
MONITOR *ptr;
|
MONITOR *ptr;
|
||||||
|
|
||||||
spinlock_acquire(&monLock);
|
spinlock_acquire(&monLock);
|
||||||
ptr = allMonitors;
|
ptr = allMonitors;
|
||||||
dcb_printf(dcb, "---------------------+---------------------\n");
|
dcb_printf(dcb, "---------------------+---------------------\n");
|
||||||
dcb_printf(dcb, "%-20s | Status\n", "Monitor");
|
dcb_printf(dcb, "%-20s | Status\n", "Monitor");
|
||||||
dcb_printf(dcb, "---------------------+---------------------\n");
|
dcb_printf(dcb, "---------------------+---------------------\n");
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
dcb_printf(dcb, "%-20s | %s\n", ptr->name,
|
dcb_printf(dcb, "%-20s | %s\n", ptr->name,
|
||||||
ptr->state & MONITOR_STATE_RUNNING
|
ptr->state & MONITOR_STATE_RUNNING
|
||||||
? "Running" : "Stopped");
|
? "Running" : "Stopped");
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
}
|
||||||
dcb_printf(dcb, "---------------------+---------------------\n");
|
dcb_printf(dcb, "---------------------+---------------------\n");
|
||||||
spinlock_release(&monLock);
|
spinlock_release(&monLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a monitor by name
|
* Find a monitor by name
|
||||||
*
|
*
|
||||||
* @param name The name of the monitor
|
* @param name The name of the monitor
|
||||||
* @return Pointer to the monitor or NULL
|
* @return Pointer to the monitor or NULL
|
||||||
*/
|
*/
|
||||||
MONITOR *
|
MONITOR *
|
||||||
monitor_find(char *name)
|
monitor_find(char *name)
|
||||||
{
|
{
|
||||||
MONITOR *ptr;
|
MONITOR *ptr;
|
||||||
|
|
||||||
spinlock_acquire(&monLock);
|
spinlock_acquire(&monLock);
|
||||||
ptr = allMonitors;
|
ptr = allMonitors;
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
if (!strcmp(ptr->name, name))
|
if (!strcmp(ptr->name, name))
|
||||||
break;
|
{
|
||||||
ptr = ptr->next;
|
break;
|
||||||
}
|
}
|
||||||
spinlock_release(&monLock);
|
ptr = ptr->next;
|
||||||
return ptr;
|
}
|
||||||
|
spinlock_release(&monLock);
|
||||||
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the monitor sampling interval.
|
* Set the monitor sampling interval.
|
||||||
*
|
*
|
||||||
* @param mon The monitor instance
|
* @param mon The monitor instance
|
||||||
* @param interval The sampling interval in milliseconds
|
* @param interval The sampling interval in milliseconds
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorSetInterval (MONITOR *mon, unsigned long interval)
|
monitorSetInterval(MONITOR *mon, unsigned long interval)
|
||||||
{
|
{
|
||||||
mon->interval = interval;
|
mon->interval = interval;
|
||||||
}
|
}
|
||||||
@ -358,9 +376,9 @@ monitorSetInterval (MONITOR *mon, unsigned long interval)
|
|||||||
/**
|
/**
|
||||||
* Set Monitor timeouts for connect/read/write
|
* Set Monitor timeouts for connect/read/write
|
||||||
*
|
*
|
||||||
* @param mon The monitor instance
|
* @param mon The monitor instance
|
||||||
* @param type The timeout handling type
|
* @param type The timeout handling type
|
||||||
* @param value The timeout to set
|
* @param value The timeout to set
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitorSetNetworkTimeout(MONITOR *mon, int type, int value) {
|
monitorSetNetworkTimeout(MONITOR *mon, int type, int value) {
|
||||||
@ -369,38 +387,49 @@ monitorSetNetworkTimeout(MONITOR *mon, int type, int value) {
|
|||||||
int new_timeout = max_timeout -1;
|
int new_timeout = max_timeout -1;
|
||||||
|
|
||||||
if (new_timeout <= 0)
|
if (new_timeout <= 0)
|
||||||
new_timeout = DEFAULT_CONNECT_TIMEOUT;
|
{
|
||||||
|
new_timeout = DEFAULT_CONNECT_TIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case MONITOR_CONNECT_TIMEOUT:
|
case MONITOR_CONNECT_TIMEOUT:
|
||||||
if (value < max_timeout) {
|
if (value < max_timeout)
|
||||||
memcpy(&mon->connect_timeout, &value, sizeof(int));
|
{
|
||||||
} else {
|
memcpy(&mon->connect_timeout, &value, sizeof(int));
|
||||||
memcpy(&mon->connect_timeout, &new_timeout, sizeof(int));
|
}
|
||||||
MXS_WARNING("Monitor Connect Timeout %i is greater than monitor interval ~%i seconds"
|
else
|
||||||
|
{
|
||||||
|
memcpy(&mon->connect_timeout, &new_timeout, sizeof(int));
|
||||||
|
MXS_WARNING("Monitor Connect Timeout %i is greater than monitor interval ~%i seconds"
|
||||||
", lowering to %i seconds", value, max_timeout, new_timeout);
|
", lowering to %i seconds", value, max_timeout, new_timeout);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MONITOR_READ_TIMEOUT:
|
case MONITOR_READ_TIMEOUT:
|
||||||
if (value < max_timeout) {
|
if (value < max_timeout)
|
||||||
memcpy(&mon->read_timeout, &value, sizeof(int));
|
{
|
||||||
} else {
|
memcpy(&mon->read_timeout, &value, sizeof(int));
|
||||||
memcpy(&mon->read_timeout, &new_timeout, sizeof(int));
|
}
|
||||||
MXS_WARNING("Monitor Read Timeout %i is greater than monitor interval ~%i seconds"
|
else
|
||||||
|
{
|
||||||
|
memcpy(&mon->read_timeout, &new_timeout, sizeof(int));
|
||||||
|
MXS_WARNING("Monitor Read Timeout %i is greater than monitor interval ~%i seconds"
|
||||||
", lowering to %i seconds", value, max_timeout, new_timeout);
|
", lowering to %i seconds", value, max_timeout, new_timeout);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MONITOR_WRITE_TIMEOUT:
|
case MONITOR_WRITE_TIMEOUT:
|
||||||
if (value < max_timeout) {
|
if (value < max_timeout)
|
||||||
memcpy(&mon->write_timeout, &value, sizeof(int));
|
{
|
||||||
} else {
|
memcpy(&mon->write_timeout, &value, sizeof(int));
|
||||||
memcpy(&mon->write_timeout, &new_timeout, sizeof(int));
|
}
|
||||||
MXS_WARNING("Monitor Write Timeout %i is greater than monitor interval ~%i seconds"
|
else
|
||||||
|
{
|
||||||
|
memcpy(&mon->write_timeout, &new_timeout, sizeof(int));
|
||||||
|
MXS_WARNING("Monitor Write Timeout %i is greater than monitor interval ~%i seconds"
|
||||||
", lowering to %i seconds", value, max_timeout, new_timeout);
|
", lowering to %i seconds", value, max_timeout, new_timeout);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MXS_ERROR("Monitor setNetworkTimeout received an unsupported action type %i", type);
|
MXS_ERROR("Monitor setNetworkTimeout received an unsupported action type %i", type);
|
||||||
break;
|
break;
|
||||||
@ -410,39 +439,39 @@ monitorSetNetworkTimeout(MONITOR *mon, int type, int value) {
|
|||||||
/**
|
/**
|
||||||
* Provide a row to the result set that defines the set of monitors
|
* Provide a row to the result set that defines the set of monitors
|
||||||
*
|
*
|
||||||
* @param set The result set
|
* @param set The result set
|
||||||
* @param data The index of the row to send
|
* @param data The index of the row to send
|
||||||
* @return The next row or NULL
|
* @return The next row or NULL
|
||||||
*/
|
*/
|
||||||
static RESULT_ROW *
|
static RESULT_ROW *
|
||||||
monitorRowCallback(RESULTSET *set, void *data)
|
monitorRowCallback(RESULTSET *set, void *data)
|
||||||
{
|
{
|
||||||
int *rowno = (int *)data;
|
int *rowno = (int *)data;
|
||||||
int i = 0;;
|
int i = 0;;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
RESULT_ROW *row;
|
RESULT_ROW *row;
|
||||||
MONITOR *ptr;
|
MONITOR *ptr;
|
||||||
|
|
||||||
spinlock_acquire(&monLock);
|
spinlock_acquire(&monLock);
|
||||||
ptr = allMonitors;
|
ptr = allMonitors;
|
||||||
while (i < *rowno && ptr)
|
while (i < *rowno && ptr)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
}
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
{
|
{
|
||||||
spinlock_release(&monLock);
|
spinlock_release(&monLock);
|
||||||
free(data);
|
free(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
(*rowno)++;
|
(*rowno)++;
|
||||||
row = resultset_make_row(set);
|
row = resultset_make_row(set);
|
||||||
resultset_row_set(row, 0, ptr->name);
|
resultset_row_set(row, 0, ptr->name);
|
||||||
resultset_row_set(row, 1, ptr->state & MONITOR_STATE_RUNNING
|
resultset_row_set(row, 1, ptr->state & MONITOR_STATE_RUNNING
|
||||||
? "Running" : "Stopped");
|
? "Running" : "Stopped");
|
||||||
spinlock_release(&monLock);
|
spinlock_release(&monLock);
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -453,21 +482,23 @@ MONITOR *ptr;
|
|||||||
RESULTSET *
|
RESULTSET *
|
||||||
monitorGetList()
|
monitorGetList()
|
||||||
{
|
{
|
||||||
RESULTSET *set;
|
RESULTSET *set;
|
||||||
int *data;
|
int *data;
|
||||||
|
|
||||||
if ((data = (int *)malloc(sizeof(int))) == NULL)
|
if ((data = (int *)malloc(sizeof(int))) == NULL)
|
||||||
return NULL;
|
{
|
||||||
*data = 0;
|
return NULL;
|
||||||
if ((set = resultset_create(monitorRowCallback, data)) == NULL)
|
}
|
||||||
{
|
*data = 0;
|
||||||
free(data);
|
if ((set = resultset_create(monitorRowCallback, data)) == NULL)
|
||||||
return NULL;
|
{
|
||||||
}
|
free(data);
|
||||||
resultset_add_column(set, "Monitor", 20, COL_TYPE_VARCHAR);
|
return NULL;
|
||||||
resultset_add_column(set, "Status", 10, COL_TYPE_VARCHAR);
|
}
|
||||||
|
resultset_add_column(set, "Monitor", 20, COL_TYPE_VARCHAR);
|
||||||
|
resultset_add_column(set, "Status", 10, COL_TYPE_VARCHAR);
|
||||||
|
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -489,11 +520,11 @@ bool check_monitor_permissions(MONITOR* monitor)
|
|||||||
user = monitor->user;
|
user = monitor->user;
|
||||||
dpasswd = decryptPassword(monitor->password);
|
dpasswd = decryptPassword(monitor->password);
|
||||||
|
|
||||||
if((mysql = mysql_init(NULL)) == NULL)
|
if ((mysql = mysql_init(NULL)) == NULL)
|
||||||
{
|
{
|
||||||
MXS_ERROR("[%s] Error: MySQL connection initialization failed.", __FUNCTION__);
|
MXS_ERROR("[%s] Error: MySQL connection initialization failed.", __FUNCTION__);
|
||||||
free(dpasswd);
|
free(dpasswd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
server = monitor->databases->server;
|
server = monitor->databases->server;
|
||||||
@ -502,22 +533,22 @@ bool check_monitor_permissions(MONITOR* monitor)
|
|||||||
|
|
||||||
/** Connect to the first server. This assumes all servers have identical
|
/** Connect to the first server. This assumes all servers have identical
|
||||||
* user permissions. */
|
* user permissions. */
|
||||||
if(mysql_real_connect(mysql,server->name,user,dpasswd,NULL,server->port,NULL,0) == NULL)
|
if (mysql_real_connect(mysql, server->name, user, dpasswd, NULL, server->port, NULL, 0) == NULL)
|
||||||
{
|
{
|
||||||
MXS_ERROR("%s: Failed to connect to server %s(%s:%d) when"
|
MXS_ERROR("%s: Failed to connect to server %s(%s:%d) when"
|
||||||
" checking monitor user credentials and permissions.",
|
" checking monitor user credentials and permissions.",
|
||||||
monitor->name,
|
monitor->name,
|
||||||
server->unique_name,
|
server->unique_name,
|
||||||
server->name,
|
server->name,
|
||||||
server->port);
|
server->port);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
free(dpasswd);
|
free(dpasswd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mysql_query(mysql,"show slave status") != 0)
|
if (mysql_query(mysql,"show slave status") != 0)
|
||||||
{
|
{
|
||||||
if(mysql_errno(mysql) == ER_SPECIFIC_ACCESS_DENIED_ERROR)
|
if (mysql_errno(mysql) == ER_SPECIFIC_ACCESS_DENIED_ERROR)
|
||||||
{
|
{
|
||||||
MXS_ERROR("%s: User '%s' is missing REPLICATION CLIENT privileges. MySQL error message: %s",
|
MXS_ERROR("%s: User '%s' is missing REPLICATION CLIENT privileges. MySQL error message: %s",
|
||||||
monitor->name,user,mysql_error(mysql));
|
monitor->name,user,mysql_error(mysql));
|
||||||
@ -531,7 +562,7 @@ bool check_monitor_permissions(MONITOR* monitor)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((res = mysql_use_result(mysql)) == NULL)
|
if ((res = mysql_use_result(mysql)) == NULL)
|
||||||
{
|
{
|
||||||
MXS_ERROR("%s: Result retrieval failed when checking for REPLICATION CLIENT permissions: %s",
|
MXS_ERROR("%s: Result retrieval failed when checking for REPLICATION CLIENT permissions: %s",
|
||||||
monitor->name,mysql_error(mysql));
|
monitor->name,mysql_error(mysql));
|
||||||
@ -600,13 +631,15 @@ monitor_clear_pending_status(MONITOR_SERVERS *ptr, int bit)
|
|||||||
monitor_event_t
|
monitor_event_t
|
||||||
mon_get_event_type(MONITOR_SERVERS* node)
|
mon_get_event_type(MONITOR_SERVERS* node)
|
||||||
{
|
{
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
DOWN_EVENT,
|
DOWN_EVENT,
|
||||||
UP_EVENT,
|
UP_EVENT,
|
||||||
LOSS_EVENT,
|
LOSS_EVENT,
|
||||||
NEW_EVENT,
|
NEW_EVENT,
|
||||||
UNSUPPORTED_EVENT
|
UNSUPPORTED_EVENT
|
||||||
} general_event_type;
|
} general_event_type;
|
||||||
|
|
||||||
general_event_type event_type = UNSUPPORTED_EVENT;
|
general_event_type event_type = UNSUPPORTED_EVENT;
|
||||||
|
|
||||||
unsigned int prev = node->mon_prev_status
|
unsigned int prev = node->mon_prev_status
|
||||||
@ -655,30 +688,30 @@ mon_get_event_type(MONITOR_SERVERS* node)
|
|||||||
|
|
||||||
switch (event_type)
|
switch (event_type)
|
||||||
{
|
{
|
||||||
case UP_EVENT:
|
case UP_EVENT:
|
||||||
return (present & SERVER_MASTER) ? MASTER_UP_EVENT :
|
return (present & SERVER_MASTER) ? MASTER_UP_EVENT :
|
||||||
(present & SERVER_SLAVE) ? SLAVE_UP_EVENT :
|
(present & SERVER_SLAVE) ? SLAVE_UP_EVENT :
|
||||||
(present & SERVER_JOINED) ? SYNCED_UP_EVENT :
|
(present & SERVER_JOINED) ? SYNCED_UP_EVENT :
|
||||||
(present & SERVER_NDB) ? NDB_UP_EVENT :
|
(present & SERVER_NDB) ? NDB_UP_EVENT :
|
||||||
SERVER_UP_EVENT;
|
SERVER_UP_EVENT;
|
||||||
case DOWN_EVENT:
|
case DOWN_EVENT:
|
||||||
return (prev & SERVER_MASTER) ? MASTER_DOWN_EVENT :
|
return (prev & SERVER_MASTER) ? MASTER_DOWN_EVENT :
|
||||||
(prev & SERVER_SLAVE) ? SLAVE_DOWN_EVENT :
|
(prev & SERVER_SLAVE) ? SLAVE_DOWN_EVENT :
|
||||||
(prev & SERVER_JOINED) ? SYNCED_DOWN_EVENT :
|
(prev & SERVER_JOINED) ? SYNCED_DOWN_EVENT :
|
||||||
(prev & SERVER_NDB) ? NDB_DOWN_EVENT :
|
(prev & SERVER_NDB) ? NDB_DOWN_EVENT :
|
||||||
SERVER_DOWN_EVENT;
|
SERVER_DOWN_EVENT;
|
||||||
case LOSS_EVENT:
|
case LOSS_EVENT:
|
||||||
return (prev & SERVER_MASTER) ? LOST_MASTER_EVENT :
|
return (prev & SERVER_MASTER) ? LOST_MASTER_EVENT :
|
||||||
(prev & SERVER_SLAVE) ? LOST_SLAVE_EVENT :
|
(prev & SERVER_SLAVE) ? LOST_SLAVE_EVENT :
|
||||||
(prev & SERVER_JOINED) ? LOST_SYNCED_EVENT :
|
(prev & SERVER_JOINED) ? LOST_SYNCED_EVENT :
|
||||||
LOST_NDB_EVENT;
|
LOST_NDB_EVENT;
|
||||||
case NEW_EVENT:
|
case NEW_EVENT:
|
||||||
return (present & SERVER_MASTER) ? NEW_MASTER_EVENT :
|
return (present & SERVER_MASTER) ? NEW_MASTER_EVENT :
|
||||||
(present & SERVER_SLAVE) ? NEW_SLAVE_EVENT :
|
(present & SERVER_SLAVE) ? NEW_SLAVE_EVENT :
|
||||||
(present & SERVER_JOINED) ? NEW_SYNCED_EVENT :
|
(present & SERVER_JOINED) ? NEW_SYNCED_EVENT :
|
||||||
NEW_NDB_EVENT;
|
NEW_NDB_EVENT;
|
||||||
default:
|
default:
|
||||||
return UNDEFINED_MONITOR_EVENT;
|
return UNDEFINED_MONITOR_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,7 +733,7 @@ mon_get_event_name(MONITOR_SERVERS* node)
|
|||||||
* @result monitor_event_t Monitor event corresponding to name
|
* @result monitor_event_t Monitor event corresponding to name
|
||||||
*/
|
*/
|
||||||
monitor_event_t
|
monitor_event_t
|
||||||
mon_name_to_event (const char *event_name)
|
mon_name_to_event(const char *event_name)
|
||||||
{
|
{
|
||||||
monitor_event_t event;
|
monitor_event_t event;
|
||||||
|
|
||||||
@ -751,14 +784,14 @@ mon_status_changed(MONITOR_SERVERS* mon_srv)
|
|||||||
{
|
{
|
||||||
/* Previous status is -1 if not yet set */
|
/* Previous status is -1 if not yet set */
|
||||||
return (mon_srv->mon_prev_status != -1
|
return (mon_srv->mon_prev_status != -1
|
||||||
&& mon_srv->mon_prev_status != mon_srv->server->status);
|
&& mon_srv->mon_prev_status != mon_srv->server->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if current monitored server has a loggable failure status
|
* Check if current monitored server has a loggable failure status
|
||||||
*
|
*
|
||||||
* @param mon_srv The monitored server
|
* @param mon_srv The monitored server
|
||||||
* @return true if failed status can be logged or false
|
* @return true if failed status can be logged or false
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
mon_print_fail_status(MONITOR_SERVERS* mon_srv)
|
mon_print_fail_status(MONITOR_SERVERS* mon_srv)
|
||||||
@ -917,11 +950,11 @@ void
|
|||||||
mon_log_connect_error(MONITOR_SERVERS* database, connect_result_t rval)
|
mon_log_connect_error(MONITOR_SERVERS* database, connect_result_t rval)
|
||||||
{
|
{
|
||||||
MXS_ERROR(rval == MONITOR_CONN_TIMEOUT ?
|
MXS_ERROR(rval == MONITOR_CONN_TIMEOUT ?
|
||||||
"Monitor timed out when connecting to "
|
"Monitor timed out when connecting to "
|
||||||
"server %s:%d : \"%s\"" :
|
"server %s:%d : \"%s\"" :
|
||||||
"Monitor was unable to connect to "
|
"Monitor was unable to connect to "
|
||||||
"server %s:%d : \"%s\"",
|
"server %s:%d : \"%s\"",
|
||||||
database->server->name,
|
database->server->name,
|
||||||
database->server->port,
|
database->server->port,
|
||||||
mysql_error(database->con));
|
mysql_error(database->con));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,23 +27,23 @@
|
|||||||
#include <secrets.h>
|
#include <secrets.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file monitor.h The interface to the monitor module
|
* @file monitor.h The interface to the monitor module
|
||||||
*
|
*
|
||||||
* @verbatim
|
* @verbatim
|
||||||
* Revision History
|
* Revision History
|
||||||
*
|
*
|
||||||
* Date Who Description
|
* Date Who Description
|
||||||
* 07/07/13 Mark Riddoch Initial implementation
|
* 07/07/13 Mark Riddoch Initial implementation
|
||||||
* 25/07/13 Mark Riddoch Addition of diagnotics
|
* 25/07/13 Mark Riddoch Addition of diagnotics
|
||||||
* 23/05/14 Mark Riddoch Addition of routine to find monitors by name
|
* 23/05/14 Mark Riddoch Addition of routine to find monitors by name
|
||||||
* 23/05/14 Massimiliano Pinto Addition of defaultId and setInterval
|
* 23/05/14 Massimiliano Pinto Addition of defaultId and setInterval
|
||||||
* 23/06/14 Massimiliano Pinto Addition of replicationHeartbeat
|
* 23/06/14 Massimiliano Pinto Addition of replicationHeartbeat
|
||||||
* 28/08/14 Massimiliano Pinto Addition of detectStaleMaster
|
* 28/08/14 Massimiliano Pinto Addition of detectStaleMaster
|
||||||
* 30/10/14 Massimiliano Pinto Addition of disableMasterFailback
|
* 30/10/14 Massimiliano Pinto Addition of disableMasterFailback
|
||||||
* 07/11/14 Massimiliano Pinto Addition of setNetworkTimeout
|
* 07/11/14 Massimiliano Pinto Addition of setNetworkTimeout
|
||||||
* 19/02/15 Mark Riddoch Addition of monitorGetList
|
* 19/02/15 Mark Riddoch Addition of monitorGetList
|
||||||
* 19/11/15 Martin Brampton Automation of event and name declaration, absorption
|
* 19/11/15 Martin Brampton Automation of event and name declaration, absorption
|
||||||
* of what was formerly monitor_common.h
|
* of what was formerly monitor_common.h
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -73,17 +73,18 @@
|
|||||||
* unregisterServer is called to remove a server from the set of servers that need to be
|
* unregisterServer is called to remove a server from the set of servers that need to be
|
||||||
* monitored.
|
* monitored.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct
|
||||||
void *(*startMonitor)(void *, void*);
|
{
|
||||||
void (*stopMonitor)(void *);
|
void *(*startMonitor)(void *, void*);
|
||||||
void (*diagnostics)(DCB *, void *);
|
void (*stopMonitor)(void *);
|
||||||
|
void (*diagnostics)(DCB *, void *);
|
||||||
} MONITOR_OBJECT;
|
} MONITOR_OBJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The monitor API version number. Any change to the monitor module API
|
* The monitor API version number. Any change to the monitor module API
|
||||||
* must change these versions usign the rules defined in modinfo.h
|
* must change these versions usign the rules defined in modinfo.h
|
||||||
*/
|
*/
|
||||||
#define MONITOR_VERSION {3, 0, 0}
|
#define MONITOR_VERSION {3, 0, 0}
|
||||||
|
|
||||||
/** Monitor's poll frequency */
|
/** Monitor's poll frequency */
|
||||||
#define MON_BASE_INTERVAL_MS 100
|
#define MON_BASE_INTERVAL_MS 100
|
||||||
@ -93,11 +94,11 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
MONITOR_STATE_ALLOC = 0x00,
|
MONITOR_STATE_ALLOC = 0x00,
|
||||||
MONITOR_STATE_RUNNING = 0x01,
|
MONITOR_STATE_RUNNING = 0x01,
|
||||||
MONITOR_STATE_STOPPING = 0x02,
|
MONITOR_STATE_STOPPING = 0x02,
|
||||||
MONITOR_STATE_STOPPED = 0x04,
|
MONITOR_STATE_STOPPED = 0x04,
|
||||||
MONITOR_STATE_FREED = 0x08
|
MONITOR_STATE_FREED = 0x08
|
||||||
} monitor_state_t;
|
} monitor_state_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,9 +106,9 @@ typedef enum
|
|||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
MONITOR_CONNECT_TIMEOUT = 0,
|
MONITOR_CONNECT_TIMEOUT = 0,
|
||||||
MONITOR_READ_TIMEOUT = 1,
|
MONITOR_READ_TIMEOUT = 1,
|
||||||
MONITOR_WRITE_TIMEOUT = 2
|
MONITOR_WRITE_TIMEOUT = 2
|
||||||
} monitor_timeouts_t;
|
} monitor_timeouts_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -127,9 +128,9 @@ typedef enum
|
|||||||
#define DEFAULT_WRITE_TIMEOUT 2
|
#define DEFAULT_WRITE_TIMEOUT 2
|
||||||
|
|
||||||
|
|
||||||
#define MONITOR_RUNNING 1
|
#define MONITOR_RUNNING 1
|
||||||
#define MONITOR_STOPPING 2
|
#define MONITOR_STOPPING 2
|
||||||
#define MONITOR_STOPPED 3
|
#define MONITOR_STOPPED 3
|
||||||
|
|
||||||
#define MONITOR_INTERVAL 10000 // in milliseconds
|
#define MONITOR_INTERVAL 10000 // in milliseconds
|
||||||
#define MONITOR_DEFAULT_ID 1UL // unsigned long value
|
#define MONITOR_DEFAULT_ID 1UL // unsigned long value
|
||||||
@ -158,56 +159,59 @@ extern const monitor_def_t monitor_event_definitions[];
|
|||||||
/**
|
/**
|
||||||
* The linked list of servers that are being monitored by the monitor module.
|
* The linked list of servers that are being monitored by the monitor module.
|
||||||
*/
|
*/
|
||||||
typedef struct monitor_servers {
|
typedef struct monitor_servers
|
||||||
SERVER *server; /**< The server being monitored */
|
{
|
||||||
MYSQL *con; /**< The MySQL connection */
|
SERVER *server; /**< The server being monitored */
|
||||||
bool log_version_err;
|
MYSQL *con; /**< The MySQL connection */
|
||||||
int mon_err_count;
|
bool log_version_err;
|
||||||
unsigned int mon_prev_status;
|
int mon_err_count;
|
||||||
unsigned int pending_status; /**< Pending Status flag bitmap */
|
unsigned int mon_prev_status;
|
||||||
struct monitor_servers
|
unsigned int pending_status; /**< Pending Status flag bitmap */
|
||||||
*next; /**< The next server in the list */
|
struct monitor_servers *next; /**< The next server in the list */
|
||||||
} MONITOR_SERVERS;
|
} MONITOR_SERVERS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of the running monitor.
|
* Representation of the running monitor.
|
||||||
*/
|
*/
|
||||||
typedef struct monitor {
|
typedef struct monitor
|
||||||
char *name; /**< The name of the monitor module */
|
{
|
||||||
char* user; /*< Monitor username */
|
char *name; /**< The name of the monitor module */
|
||||||
char* password; /*< Monitor password */
|
char *user; /*< Monitor username */
|
||||||
SPINLOCK lock;
|
char *password; /*< Monitor password */
|
||||||
CONFIG_PARAMETER* parameters; /*< configuration parameters */
|
SPINLOCK lock;
|
||||||
MONITOR_SERVERS* databases; /*< List of databases the monitor monitors */
|
CONFIG_PARAMETER* parameters; /*< configuration parameters */
|
||||||
monitor_state_t state; /**< The state of the monitor */
|
MONITOR_SERVERS* databases; /*< List of databases the monitor monitors */
|
||||||
int connect_timeout; /**< Connect timeout in seconds for mysql_real_connect */
|
monitor_state_t state; /**< The state of the monitor */
|
||||||
int read_timeout; /**< Timeout in seconds to read from the server.
|
int connect_timeout; /**< Connect timeout in seconds for mysql_real_connect */
|
||||||
* There are retries and the total effective timeout value is three times the option value.
|
int read_timeout; /**< Timeout in seconds to read from the server.
|
||||||
*/
|
* There are retries and the total effective timeout
|
||||||
int write_timeout; /**< Timeout in seconds for each attempt to write to the server.
|
* value is three times the option value.
|
||||||
* There are retries and the total effective timeout value is two times the option value.
|
*/
|
||||||
*/
|
int write_timeout; /**< Timeout in seconds for each attempt to write to the server.
|
||||||
MONITOR_OBJECT *module; /**< The "monitor object" */
|
* There are retries and the total effective timeout value is
|
||||||
void *handle; /**< Handle returned from startMonitor */
|
* two times the option value.
|
||||||
size_t interval; /**< The monitor interval */
|
*/
|
||||||
struct monitor *next; /**< Next monitor in the linked list */
|
MONITOR_OBJECT *module; /**< The "monitor object" */
|
||||||
|
void *handle; /**< Handle returned from startMonitor */
|
||||||
|
size_t interval; /**< The monitor interval */
|
||||||
|
struct monitor *next; /**< Next monitor in the linked list */
|
||||||
} MONITOR;
|
} MONITOR;
|
||||||
|
|
||||||
extern MONITOR *monitor_alloc(char *, char *);
|
extern MONITOR *monitor_alloc(char *, char *);
|
||||||
extern void monitor_free(MONITOR *);
|
extern void monitor_free(MONITOR *);
|
||||||
extern MONITOR *monitor_find(char *);
|
extern MONITOR *monitor_find(char *);
|
||||||
extern void monitorAddServer(MONITOR *, SERVER *);
|
extern void monitorAddServer(MONITOR *, SERVER *);
|
||||||
extern void monitorAddUser(MONITOR *, char *, char *);
|
extern void monitorAddUser(MONITOR *, char *, char *);
|
||||||
extern void monitorAddParameters(MONITOR *monitor, CONFIG_PARAMETER *params);
|
extern void monitorAddParameters(MONITOR *monitor, CONFIG_PARAMETER *params);
|
||||||
extern void monitorStop(MONITOR *);
|
extern void monitorStop(MONITOR *);
|
||||||
extern void monitorStart(MONITOR *, void*);
|
extern void monitorStart(MONITOR *, void*);
|
||||||
extern void monitorStopAll();
|
extern void monitorStopAll();
|
||||||
extern void monitorStartAll();
|
extern void monitorStartAll();
|
||||||
extern void monitorShowAll(DCB *);
|
extern void monitorShowAll(DCB *);
|
||||||
extern void monitorShow(DCB *, MONITOR *);
|
extern void monitorShow(DCB *, MONITOR *);
|
||||||
extern void monitorList(DCB *);
|
extern void monitorList(DCB *);
|
||||||
extern void monitorSetInterval (MONITOR *, unsigned long);
|
extern void monitorSetInterval (MONITOR *, unsigned long);
|
||||||
extern void monitorSetNetworkTimeout(MONITOR *, int, int);
|
extern void monitorSetNetworkTimeout(MONITOR *, int, int);
|
||||||
extern RESULTSET *monitorGetList();
|
extern RESULTSET *monitorGetList();
|
||||||
bool check_monitor_permissions(MONITOR* monitor);
|
bool check_monitor_permissions(MONITOR* monitor);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user