MXS-1775 Cleanup monitor class headers
- All classes now declared in separate header file - Header files have .hh-suffix
This commit is contained in:
@ -17,42 +17,12 @@
|
|||||||
|
|
||||||
#define MXS_MODULE_NAME "auroramon"
|
#define MXS_MODULE_NAME "auroramon"
|
||||||
|
|
||||||
#include <maxscale/cppdefs.hh>
|
#include "auroramon.hh"
|
||||||
#include <mysqld_error.h>
|
#include <mysqld_error.h>
|
||||||
#include <maxscale/alloc.h>
|
#include <maxscale/alloc.h>
|
||||||
#include <maxscale/debug.h>
|
#include <maxscale/debug.h>
|
||||||
#include <maxscale/modinfo.h>
|
#include <maxscale/modinfo.h>
|
||||||
#include <maxscale/monitor.hh>
|
|
||||||
#include <maxscale/mysql_utils.h>
|
#include <maxscale/mysql_utils.h>
|
||||||
#include <maxscale/thread.h>
|
|
||||||
|
|
||||||
class AuroraMonitor : public MXS_MONITOR_INSTANCE
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AuroraMonitor(const AuroraMonitor&) = delete;
|
|
||||||
AuroraMonitor& operator = (const AuroraMonitor&) = delete;
|
|
||||||
|
|
||||||
static AuroraMonitor* create(MXS_MONITOR* monitor);
|
|
||||||
void destroy();
|
|
||||||
bool start(const MXS_CONFIG_PARAMETER* param);
|
|
||||||
void stop();
|
|
||||||
void diagnostics(DCB* dcb) const;
|
|
||||||
json_t* diagnostics_json() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_shutdown; /**< True if the monitor is stopped */
|
|
||||||
THREAD m_thread; /**< Monitor thread */
|
|
||||||
char* m_script; /**< Launchable script */
|
|
||||||
uint64_t m_events; /**< Enabled monitor events */
|
|
||||||
MXS_MONITOR* m_monitor; /**< Pointer to generic monitor structure */
|
|
||||||
bool m_checked; /**< Whether server access has been checked */
|
|
||||||
|
|
||||||
AuroraMonitor(MXS_MONITOR* monitor);
|
|
||||||
~AuroraMonitor();
|
|
||||||
|
|
||||||
void main();
|
|
||||||
static void main(void* data);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
AuroraMonitor::AuroraMonitor(MXS_MONITOR* monitor)
|
AuroraMonitor::AuroraMonitor(MXS_MONITOR* monitor)
|
||||||
|
|||||||
49
server/modules/monitor/auroramon/auroramon.hh
Normal file
49
server/modules/monitor/auroramon/auroramon.hh
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#pragma once
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||||
|
*
|
||||||
|
* Use of this software is governed by the Business Source License included
|
||||||
|
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
|
||||||
|
*
|
||||||
|
* Change Date: 2020-01-01
|
||||||
|
*
|
||||||
|
* On the date above, in accordance with the Business Source License, use
|
||||||
|
* of this software will be governed by version 2 or later of the General
|
||||||
|
* Public License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <maxscale/cppdefs.hh>
|
||||||
|
#include <maxscale/monitor.hh>
|
||||||
|
#include <maxscale/thread.hh>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file auroramon.hh - The Aurora monitor
|
||||||
|
*/
|
||||||
|
|
||||||
|
class AuroraMonitor : public MXS_MONITOR_INSTANCE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AuroraMonitor(const AuroraMonitor&) = delete;
|
||||||
|
AuroraMonitor& operator = (const AuroraMonitor&) = delete;
|
||||||
|
|
||||||
|
static AuroraMonitor* create(MXS_MONITOR* monitor);
|
||||||
|
void destroy();
|
||||||
|
bool start(const MXS_CONFIG_PARAMETER* param);
|
||||||
|
void stop();
|
||||||
|
void diagnostics(DCB* dcb) const;
|
||||||
|
json_t* diagnostics_json() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_shutdown; /**< True if the monitor is stopped */
|
||||||
|
THREAD m_thread; /**< Monitor thread */
|
||||||
|
char* m_script; /**< Launchable script */
|
||||||
|
uint64_t m_events; /**< Enabled monitor events */
|
||||||
|
MXS_MONITOR* m_monitor; /**< Pointer to generic monitor structure */
|
||||||
|
bool m_checked; /**< Whether server access has been checked */
|
||||||
|
|
||||||
|
AuroraMonitor(MXS_MONITOR* monitor);
|
||||||
|
~AuroraMonitor();
|
||||||
|
|
||||||
|
void main();
|
||||||
|
static void main(void* data);
|
||||||
|
};
|
||||||
@ -17,10 +17,20 @@
|
|||||||
|
|
||||||
#define MXS_MODULE_NAME "galeramon"
|
#define MXS_MODULE_NAME "galeramon"
|
||||||
|
|
||||||
#include "galeramon.h"
|
#include "galeramon.hh"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <mysql.h>
|
||||||
|
#include <mysqld_error.h>
|
||||||
#include <maxscale/alloc.h>
|
#include <maxscale/alloc.h>
|
||||||
|
#include <maxscale/config.h>
|
||||||
#include <maxscale/dcb.h>
|
#include <maxscale/dcb.h>
|
||||||
|
#include <maxscale/log_manager.h>
|
||||||
|
#include <maxscale/modinfo.h>
|
||||||
#include <maxscale/mysql_utils.h>
|
#include <maxscale/mysql_utils.h>
|
||||||
|
#include <maxscale/secrets.h>
|
||||||
|
#include <maxscale/spinlock.h>
|
||||||
|
|
||||||
#define DONOR_NODE_NAME_MAX_LEN 60
|
#define DONOR_NODE_NAME_MAX_LEN 60
|
||||||
#define DONOR_LIST_SET_VAR "SET GLOBAL wsrep_sst_donor = \""
|
#define DONOR_LIST_SET_VAR "SET GLOBAL wsrep_sst_donor = \""
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef _GALERAMON_H
|
|
||||||
#define _GALERAMON_H
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||||
*
|
*
|
||||||
@ -15,31 +13,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file galeramon.h - The Galera cluster monitor
|
* @file galeramon.hh - The Galera cluster monitor
|
||||||
*
|
|
||||||
* @verbatim
|
|
||||||
* Revision History
|
|
||||||
*
|
|
||||||
* Date Who Description
|
|
||||||
* 07/05/15 Markus Makela Initial Implementation of galeramon.h
|
|
||||||
* @endverbatim
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <maxscale/cppdefs.hh>
|
#include <maxscale/cppdefs.hh>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <maxscale/monitor.hh>
|
|
||||||
#include <maxscale/spinlock.h>
|
|
||||||
#include <maxscale/thread.h>
|
|
||||||
#include <mysql.h>
|
|
||||||
#include <mysqld_error.h>
|
|
||||||
#include <maxscale/log_manager.h>
|
|
||||||
#include <maxscale/secrets.h>
|
|
||||||
#include <maxscale/dcb.h>
|
|
||||||
#include <maxscale/modinfo.h>
|
|
||||||
#include <maxscale/config.h>
|
|
||||||
#include <maxscale/hashtable.h>
|
#include <maxscale/hashtable.h>
|
||||||
|
#include <maxscale/monitor.hh>
|
||||||
|
#include <maxscale/thread.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Galera Variables and server reference for each
|
* Galera Variables and server reference for each
|
||||||
@ -71,9 +51,7 @@ typedef struct galera_cluster_info
|
|||||||
char *c_uuid; /**< The Cluster UUID */
|
char *c_uuid; /**< The Cluster UUID */
|
||||||
} GALERA_CLUSTER_INFO;
|
} GALERA_CLUSTER_INFO;
|
||||||
|
|
||||||
/**
|
|
||||||
* The handle for an instance of a Galera Monitor module
|
|
||||||
*/
|
|
||||||
class GaleraMonitor : public MXS_MONITOR_INSTANCE
|
class GaleraMonitor : public MXS_MONITOR_INSTANCE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -124,5 +102,3 @@ private:
|
|||||||
void main();
|
void main();
|
||||||
static void main(void* data);
|
static void main(void* data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -17,45 +17,14 @@
|
|||||||
|
|
||||||
#define MXS_MODULE_NAME "grmon"
|
#define MXS_MODULE_NAME "grmon"
|
||||||
|
|
||||||
#include <maxscale/cppdefs.hh>
|
#include "grmon.hh"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <maxscale/monitor.hh>
|
|
||||||
#include <maxscale/thread.h>
|
|
||||||
#include <maxscale/protocol/mysql.h>
|
#include <maxscale/protocol/mysql.h>
|
||||||
#include <mysqld_error.h>
|
#include <mysqld_error.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* The instance of a Group Replication Monitor
|
|
||||||
*/
|
|
||||||
struct GRMon : public MXS_MONITOR_INSTANCE
|
|
||||||
{
|
|
||||||
GRMon(const GRMon&);
|
|
||||||
GRMon& operator&(const GRMon&);
|
|
||||||
public:
|
|
||||||
static GRMon* create(MXS_MONITOR* monitor);
|
|
||||||
void destroy();
|
|
||||||
bool start(const MXS_CONFIG_PARAMETER* params);
|
|
||||||
void stop();
|
|
||||||
void diagnostics(DCB* dcb) const;
|
|
||||||
json_t* diagnostics_json() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
THREAD m_thread; /**< Monitor thread */
|
|
||||||
int m_shutdown; /**< Flag to shutdown the monitor thread */
|
|
||||||
MXS_MONITORED_SERVER* m_master; /**< The master server */
|
|
||||||
std::string m_script;
|
|
||||||
uint64_t m_events; /**< Enabled events */
|
|
||||||
MXS_MONITOR* m_monitor;
|
|
||||||
|
|
||||||
GRMon(MXS_MONITOR* monitor);
|
|
||||||
~GRMon();
|
|
||||||
|
|
||||||
void main();
|
|
||||||
static void main(void* data);
|
|
||||||
};
|
|
||||||
|
|
||||||
GRMon::GRMon(MXS_MONITOR* monitor):
|
GRMon::GRMon(MXS_MONITOR* monitor):
|
||||||
m_shutdown(0),
|
m_shutdown(0),
|
||||||
|
|||||||
49
server/modules/monitor/grmon/grmon.hh
Normal file
49
server/modules/monitor/grmon/grmon.hh
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#pragma once
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||||
|
*
|
||||||
|
* Use of this software is governed by the Business Source License included
|
||||||
|
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
|
||||||
|
*
|
||||||
|
* Change Date: 2020-01-01
|
||||||
|
*
|
||||||
|
* On the date above, in accordance with the Business Source License, use
|
||||||
|
* of this software will be governed by version 2 or later of the General
|
||||||
|
* Public License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <maxscale/cppdefs.hh>
|
||||||
|
#include <maxscale/monitor.hh>
|
||||||
|
#include <maxscale/thread.hh>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file grmon.hh A MySQL Group Replication cluster monitor
|
||||||
|
*/
|
||||||
|
|
||||||
|
class GRMon : public MXS_MONITOR_INSTANCE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRMon(const GRMon&) = delete;
|
||||||
|
GRMon& operator&(const GRMon&) = delete;
|
||||||
|
|
||||||
|
static GRMon* create(MXS_MONITOR* monitor);
|
||||||
|
void destroy();
|
||||||
|
bool start(const MXS_CONFIG_PARAMETER* params);
|
||||||
|
void stop();
|
||||||
|
void diagnostics(DCB* dcb) const;
|
||||||
|
json_t* diagnostics_json() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
THREAD m_thread; /**< Monitor thread */
|
||||||
|
int m_shutdown; /**< Flag to shutdown the monitor thread */
|
||||||
|
MXS_MONITORED_SERVER* m_master; /**< The master server */
|
||||||
|
std::string m_script;
|
||||||
|
uint64_t m_events; /**< Enabled events */
|
||||||
|
MXS_MONITOR* m_monitor;
|
||||||
|
|
||||||
|
GRMon(MXS_MONITOR* monitor);
|
||||||
|
~GRMon();
|
||||||
|
|
||||||
|
void main();
|
||||||
|
static void main(void* data);
|
||||||
|
};
|
||||||
@ -17,10 +17,20 @@
|
|||||||
|
|
||||||
#define MXS_MODULE_NAME "mmmon"
|
#define MXS_MODULE_NAME "mmmon"
|
||||||
|
|
||||||
#include "mmmon.h"
|
#include "mmmon.hh"
|
||||||
#include <maxscale/dcb.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <mysql.h>
|
||||||
|
#include <mysqld_error.h>
|
||||||
#include <maxscale/alloc.h>
|
#include <maxscale/alloc.h>
|
||||||
|
#include <maxscale/config.h>
|
||||||
|
#include <maxscale/dcb.h>
|
||||||
|
#include <maxscale/dcb.h>
|
||||||
|
#include <maxscale/log_manager.h>
|
||||||
|
#include <maxscale/modinfo.h>
|
||||||
#include <maxscale/mysql_utils.h>
|
#include <maxscale/mysql_utils.h>
|
||||||
|
#include <maxscale/secrets.h>
|
||||||
|
|
||||||
static void detectStaleMaster(void *, int);
|
static void detectStaleMaster(void *, int);
|
||||||
static bool isMySQLEvent(mxs_monitor_event_t event);
|
static bool isMySQLEvent(mxs_monitor_event_t event);
|
||||||
|
|||||||
@ -13,26 +13,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <maxscale/cppdefs.hh>
|
#include <maxscale/cppdefs.hh>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <maxscale/monitor.hh>
|
#include <maxscale/monitor.hh>
|
||||||
#include <maxscale/thread.h>
|
#include <maxscale/thread.h>
|
||||||
#include <mysql.h>
|
|
||||||
#include <mysqld_error.h>
|
|
||||||
#include <maxscale/log_manager.h>
|
|
||||||
#include <maxscale/secrets.h>
|
|
||||||
#include <maxscale/dcb.h>
|
|
||||||
#include <maxscale/modinfo.h>
|
|
||||||
#include <maxscale/config.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file mmmon.h - The Multi-Master monitor
|
* @file mmmon.hh - The Multi-Master monitor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* The handle for an instance of a Multi-Master Monitor module
|
|
||||||
*/
|
|
||||||
class MMMonitor : public MXS_MONITOR_INSTANCE
|
class MMMonitor : public MXS_MONITOR_INSTANCE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#define MXS_MODULE_NAME "ndbclustermon"
|
#define MXS_MODULE_NAME "ndbclustermon"
|
||||||
|
|
||||||
#include "ndbclustermon.h"
|
#include "ndbclustermon.hh"
|
||||||
#include <maxscale/alloc.h>
|
#include <maxscale/alloc.h>
|
||||||
#include <maxscale/mysql_utils.h>
|
#include <maxscale/mysql_utils.h>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||||
*
|
*
|
||||||
@ -13,11 +12,14 @@
|
|||||||
* Public License.
|
* Public License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <maxscale/cppdefs.hh>
|
||||||
#include <maxscale/monitor.hh>
|
#include <maxscale/monitor.hh>
|
||||||
#include <maxscale/spinlock.h>
|
|
||||||
#include <maxscale/thread.h>
|
#include <maxscale/thread.h>
|
||||||
|
|
||||||
// The handle for an instance of a NDB Cluster Monitor module
|
/**
|
||||||
|
* @file ndbcclustermon.hh A NDBC cluster monitor
|
||||||
|
*/
|
||||||
|
|
||||||
class NDBCMonitor : public MXS_MONITOR_INSTANCE
|
class NDBCMonitor : public MXS_MONITOR_INSTANCE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Reference in New Issue
Block a user