66
65
ListenMySQLProtocol::~ListenMySQLProtocol()
68
void ListenMySQLProtocol::addCountersToTable()
70
counters.push_back(new drizzled::plugin::ListenCounter(new std::string("connection_count"), &getCounters()->connectionCount));
71
counters.push_back(new drizzled::plugin::ListenCounter(new std::string("connected"), &getCounters()->connected));
72
counters.push_back(new drizzled::plugin::ListenCounter(new std::string("failed_connections"), &getCounters()->failedConnections));
69
75
const std::string ListenMySQLProtocol::getHost(void) const
992
996
context.add(mysql_password);
994
998
listen_obj= new ListenMySQLProtocol("mysql_protocol", vm["bind-address"].as<std::string>(), true);
999
listen_obj->addCountersToTable();
995
1000
context.add(listen_obj);
996
1001
context.registerVariable(new sys_var_constrained_value_readonly<in_port_t>("port", port));
997
1002
context.registerVariable(new sys_var_constrained_value<uint32_t>("connect_timeout", connect_timeout));
1039
1044
_("A restrictive IP address list for incoming admin connections."));
1042
static int mysql_protocol_connection_count_func(drizzle_show_var *var, char *buff)
1044
var->type= SHOW_LONGLONG;
1046
*((uint64_t *)buff)= ListenMySQLProtocol::mysql_counters->connectionCount;
1050
static int mysql_protocol_connected_count_func(drizzle_show_var *var, char *buff)
1052
var->type= SHOW_LONGLONG;
1054
*((uint64_t *)buff)= ListenMySQLProtocol::mysql_counters->connected;
1058
static int mysql_protocol_failed_count_func(drizzle_show_var *var, char *buff)
1060
var->type= SHOW_LONGLONG;
1062
*((uint64_t *)buff)= ListenMySQLProtocol::mysql_counters->failedConnections;
1066
static st_show_var_func_container mysql_protocol_connection_count=
1067
{ &mysql_protocol_connection_count_func };
1069
static st_show_var_func_container mysql_protocol_connected_count=
1070
{ &mysql_protocol_connected_count_func };
1072
static st_show_var_func_container mysql_protocol_failed_count=
1073
{ &mysql_protocol_failed_count_func };
1075
static drizzle_show_var mysql_protocol_status_variables[]= {
1077
(char*) &mysql_protocol_connection_count, SHOW_FUNC},
1079
(char*) &mysql_protocol_connected_count, SHOW_FUNC},
1080
{"Failed_connections",
1081
(char*) &mysql_protocol_failed_count, SHOW_FUNC},
1082
{NULL, NULL, SHOW_LONGLONG}
1085
MysqlProtocolStatus::Generator::Generator(drizzled::Field **fields) :
1086
plugin::TableFunction::Generator(fields)
1088
status_var_ptr= mysql_protocol_status_variables;
1091
bool MysqlProtocolStatus::Generator::populate()
1093
MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, int64_t);
1094
char * const buff= (char *) &buff_data;
1095
drizzle_show_var tmp;
1097
if (status_var_ptr->name)
1099
std::ostringstream oss;
1100
string return_value;
1104
push(status_var_ptr->name);
1106
if (status_var_ptr->type == SHOW_FUNC)
1108
((drizzle_show_var_func)((st_show_var_func_container *)status_var_ptr->value)->func)(&tmp, buff);
1114
value= status_var_ptr->value;
1115
type= status_var_ptr->type;
1121
oss << *(uint64_t*) value;
1122
return_value= oss.str();
1127
if (return_value.length())
1139
1047
} /* namespace drizzle_plugin */
1141
1049
DRIZZLE_DECLARE_PLUGIN