MXS-1220: Implement JSON diagnostics entry point in monitors
All monitors now implement the JSON version of the diagnostics function.
This commit is contained in:
committed by
Markus Mäkelä
parent
9d108a58de
commit
5e679aa167
@ -13,16 +13,6 @@
|
||||
|
||||
/**
|
||||
* @file mm_mon.c - A Multi-Master Multi Muster cluster monitor
|
||||
*
|
||||
* @verbatim
|
||||
* Revision History
|
||||
*
|
||||
* Date Who Description
|
||||
* 08/09/14 Massimiliano Pinto Initial implementation
|
||||
* 08/05/15 Markus Makela Addition of launchable scripts
|
||||
* 17/10/15 Martin Brampton Change DCB callback to hangup
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#define MXS_MODULE_NAME "mmmon"
|
||||
@ -49,7 +39,7 @@ MXS_MODULE info =
|
||||
|
||||
static void *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER *);
|
||||
static void stopMonitor(MXS_MONITOR *);
|
||||
static void diagnostics(DCB *, const MXS_MONITOR *);
|
||||
static json_t* diagnostics(const MXS_MONITOR *);
|
||||
static void detectStaleMaster(void *, int);
|
||||
static MXS_MONITOR_SERVERS *get_current_master(MXS_MONITOR *);
|
||||
static bool isMySQLEvent(mxs_monitor_event_t event);
|
||||
@ -174,16 +164,17 @@ stopMonitor(MXS_MONITOR *mon)
|
||||
}
|
||||
|
||||
/**
|
||||
* Daignostic interface
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param dcb DCB to print diagnostics
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static void diagnostics(DCB *dcb, const MXS_MONITOR *mon)
|
||||
static json_t* diagnostics(const MXS_MONITOR *mon)
|
||||
{
|
||||
const MM_MONITOR *handle = (const MM_MONITOR *) mon->handle;
|
||||
const MM_MONITOR *handle = (const MM_MONITOR *)mon->handle;
|
||||
|
||||
dcb_printf(dcb, "Detect Stale Master:\t%s\n", (handle->detectStaleMaster == 1) ? "enabled" : "disabled");
|
||||
json_t* rval = json_object();
|
||||
json_object_set_new(rval, "detect_stale_master", json_boolean(handle->detectStaleMaster));
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user