MXS-977: Move common diagnostic code to the core

Almost all monitors printed the same diagnostic output inside the
modules. This should be a part of the core, not the modules themselves.
This commit is contained in:
Markus Makela
2016-11-16 19:16:32 +02:00
parent cd31b2c2c3
commit 72622bc92f
5 changed files with 50 additions and 123 deletions

View File

@ -218,35 +218,8 @@ stopMonitor(MONITOR *mon)
static void diagnostics(DCB *dcb, const MONITOR *mon)
{
const MM_MONITOR *handle = (const MM_MONITOR *) mon->handle;
MONITOR_SERVERS *db;
char *sep;
switch (handle->status)
{
case MONITOR_RUNNING:
dcb_printf(dcb, "\tMonitor running\n");
break;
case MONITOR_STOPPING:
dcb_printf(dcb, "\tMonitor stopping\n");
break;
case MONITOR_STOPPED:
dcb_printf(dcb, "\tMonitor stopped\n");
break;
}
dcb_printf(dcb, "\tSampling interval:\t%lu milliseconds\n", mon->interval);
dcb_printf(dcb, "\tDetect Stale Master:\t%s\n", (handle->detectStaleMaster == 1) ? "enabled" : "disabled");
dcb_printf(dcb, "\tMonitored servers: ");
db = mon->databases;
sep = "";
while (db)
{
dcb_printf(dcb, "%s%s:%d", sep, db->server->name, db->server->port);
sep = ", ";
db = db->next;
}
dcb_printf(dcb, "\n");
dcb_printf(dcb, "Detect Stale Master:\t%s\n", (handle->detectStaleMaster == 1) ? "enabled" : "disabled");
}
/**