Monitor API 2.0.0 implemented.
This commit is contained in:
@ -51,7 +51,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <ini.h>
|
||||
#include <config.h>
|
||||
#include <maxconfig.h>
|
||||
#include <service.h>
|
||||
#include <server.h>
|
||||
#include <users.h>
|
||||
@ -895,26 +895,12 @@ int error_count = 0;
|
||||
gateway.id = getpid();
|
||||
}
|
||||
|
||||
monitorStart(obj->element,obj->parameters)
|
||||
/* add the maxscale-id to monitor data */
|
||||
monitorSetId(obj->element, gateway.id);
|
||||
monitorStart(obj->element,obj->parameters);
|
||||
|
||||
/* set monitor interval */
|
||||
if (interval > 0)
|
||||
monitorSetInterval(obj->element, interval);
|
||||
|
||||
/* set replication heartbeat */
|
||||
if(replication_heartbeat == 1)
|
||||
monitorSetReplicationHeartbeat(obj->element, replication_heartbeat);
|
||||
|
||||
/* detect stale master */
|
||||
if(detect_stale_master == 1)
|
||||
monitorDetectStaleMaster(obj->element, detect_stale_master);
|
||||
|
||||
/* disable master failback */
|
||||
if(disable_master_failback == 1)
|
||||
monitorDisableMasterFailback(obj->element, disable_master_failback);
|
||||
|
||||
/* set timeouts */
|
||||
if (connect_timeout > 0)
|
||||
monitorSetNetworkTimeout(obj->element, MONITOR_CONNECT_TIMEOUT, connect_timeout);
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#include <dcb.h>
|
||||
#include <session.h>
|
||||
#include <modules.h>
|
||||
#include <config.h>
|
||||
#include <maxconfig.h>
|
||||
#include <poll.h>
|
||||
#include <housekeeper.h>
|
||||
#include <service.h>
|
||||
|
||||
@ -78,8 +78,10 @@ MONITOR *mon;
|
||||
free(mon);
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
mon->handle = (*mon->module->startMonitor)(NULL);
|
||||
mon->state = MONITOR_STATE_RUNNING;
|
||||
*/
|
||||
|
||||
spinlock_acquire(&monLock);
|
||||
mon->next = allMonitors;
|
||||
@ -125,9 +127,9 @@ MONITOR *ptr;
|
||||
* @param monitor The Monitor that should be started
|
||||
*/
|
||||
void
|
||||
monitorStart(MONITOR *monitor)
|
||||
monitorStart(MONITOR *monitor, void* params)
|
||||
{
|
||||
monitor->handle = (*monitor->module->startMonitor)(monitor->handle);
|
||||
monitor->handle = (*monitor->module->startMonitor)(monitor->handle,params);
|
||||
monitor->state = MONITOR_STATE_RUNNING;
|
||||
}
|
||||
|
||||
@ -279,22 +281,6 @@ MONITOR *ptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the id of the monitor.
|
||||
*
|
||||
* @param mon The monitor instance
|
||||
* @param id The id for the monitor
|
||||
*/
|
||||
|
||||
void
|
||||
monitorSetId(MONITOR *mon, unsigned long id)
|
||||
{
|
||||
if (mon->module->defaultId != NULL) {
|
||||
mon->module->defaultId(mon->handle, id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the monitor sampling interval.
|
||||
*
|
||||
@ -310,48 +296,6 @@ monitorSetInterval (MONITOR *mon, unsigned long interval)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Replication Heartbeat support in monitor.
|
||||
*
|
||||
* @param mon The monitor instance
|
||||
* @param enable The enabling value is 1, 0 turns it off
|
||||
*/
|
||||
void
|
||||
monitorSetReplicationHeartbeat(MONITOR *mon, int enable)
|
||||
{
|
||||
if (mon->module->replicationHeartbeat != NULL) {
|
||||
mon->module->replicationHeartbeat(mon->handle, enable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Stale Master assignement.
|
||||
*
|
||||
* @param mon The monitor instance
|
||||
* @param enable The enabling value is 1, 0 turns it off
|
||||
*/
|
||||
void
|
||||
monitorDetectStaleMaster(MONITOR *mon, int enable)
|
||||
{
|
||||
if (mon->module->detectStaleMaster != NULL) {
|
||||
mon->module->detectStaleMaster(mon->handle, enable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable Master Failback
|
||||
*
|
||||
* @param mon The monitor instance
|
||||
* @param disable The value 1 disable the failback, 0 keeps it
|
||||
*/
|
||||
void
|
||||
monitorDisableMasterFailback(MONITOR *mon, int disable)
|
||||
{
|
||||
if (mon->module->disableMasterFailback != NULL) {
|
||||
mon->module->disableMasterFailback(mon->handle, disable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Monitor timeouts for connect/read/write
|
||||
*
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include <skygw_utils.h>
|
||||
#include <log_manager.h>
|
||||
#include <gw.h>
|
||||
#include <config.h>
|
||||
#include <maxconfig.h>
|
||||
#include <housekeeper.h>
|
||||
#include <config.h>
|
||||
#include <mysql.h>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "../../include/hashtable.h"
|
||||
#include <hashtable.h>
|
||||
|
||||
static void
|
||||
read_lock(HASHTABLE *table)
|
||||
|
||||
Reference in New Issue
Block a user