MXS-2219 Implement rudimentary Clustrix monitoring

The monitor now pings the health check ports of the Clustrix nodes.
A response translates to RUNNING and a non-response to DOWN.
This commit is contained in:
Johan Wikman
2018-12-18 15:50:45 +02:00
parent 839b9b781d
commit 4512295e40
4 changed files with 172 additions and 0 deletions

View File

@ -14,17 +14,52 @@
#include "clustrixmon.hh"
#include <maxscale/monitor.hh>
#include <maxbase/http.hh>
class ClustrixMonitor : public maxscale::MonitorInstance
{
ClustrixMonitor(const ClustrixMonitor&) = delete;
ClustrixMonitor& operator=(const ClustrixMonitor&) = delete;
public:
class Config
{
public:
Config()
: m_cluster_monitor_interval(DEFAULT_CLUSTER_MONITOR_INTERVAL_VALUE)
{
};
long cluster_monitor_interval() const
{
return m_cluster_monitor_interval;
}
void set_cluster_monitor_interval(long l)
{
m_cluster_monitor_interval = l;
}
private:
long m_cluster_monitor_interval;
};
static ClustrixMonitor* create(MXS_MONITOR* pMonitor);
bool configure(const MXS_CONFIG_PARAMETER* pParams) override;
private:
ClustrixMonitor(MXS_MONITOR* pMonitor);
void pre_tick();
void tick();
void initiate_delayed_http_check();
bool check_http(Call::action_t action);
private:
Config m_config;
mxb::http::Async m_http;
std::vector<std::string> m_health_urls;
uint32_t m_delayed_http_check_id;
};