Moved default file search paths to gwdirs.h which is configured by CMake from gwdirs.h.in.

This commit is contained in:
Markus Makela
2015-04-27 04:48:50 +03:00
parent a11bc4c345
commit 256452f285
15 changed files with 120 additions and 122 deletions

View File

@ -11,48 +11,59 @@ The service entry needs to define the service name, the type as service and the
The specified user, with the password (plain or encrypted via maxpassword utility) is allowed to connect via MySQL protocol.
Currently the user can connect to maxinfo from any remote IP and to localhost as well.
```
[MaxInfo]
type=service
router=maxinfo
user=monitor
passwd=EBD2F49C3B375812A8CDEBA632ED8BBC
```
The listener section defines the protocol, port and other information needed to create a listener for the service. To listen on a port using the MySQL protocol a section as shown below should be added to the configuration file.
```
[MaxInfo Listener]
type=listener
service=MaxInfo
protocol=MySQLClient
port=9003
```
To listen with the HTTP protocol and hence return JSON documents a section as should below is required.
```
[MaxInfo JSON Listener]
type=listener
service=MaxInfo
protocol=HTTPD
port=8003
```
If both the MySQL and JSON responses are required then a single service can be configured with both types of listener.
As with any other listeners within MaxScale the listeners can be bound to a particular interface by use of the address= parameter. This allows the access to the maxinfo data to be limited to the localhost by adding an address=localhost parameter in the configuration file.
```
[MaxInfo Listener]
type=listener
service=MaxInfo
protocol=MySQLClient
address=localhost
port=9003
```
# MySQL Interface to maxinfo
The maxinfo supports a small subset of SQL statements in addition to the MySQL status and ping requests. These may be used for simple monitoring of MaxScale.
```
% mysqladmin -hmaxscale.mariadb.com -P9003 -umonitor -pxyz ping
mysqld is alive
% mysqladmin -hmaxscale.mariadb.com -P9003 -umonitor -pxyz status
Uptime: 72 Threads: 1 Sessions: 11
%
```
The SQL command used to interact with maxinfo is the show command, a variety of show commands are available and will be described in the following sections.
@ -60,6 +71,7 @@ The SQL command used to interact with maxinfo is the show command, a variety of
The show variables command will display a set of name and value pairs for a number of MaxScale system variables.
```
mysql> show variables;
+--------------------+-------------------------+
| Variable_name | Value |
@ -77,9 +89,11 @@ The show variables command will display a set of name and value pairs for a numb
9 rows in set (0.02 sec)
mysql>
```
The show variables command can also accept a limited like clause. This like clause must either be a literal string to match, a pattern starting with a %, a pattern ending with a % or a string with a % at both the start and the end.
```
mysql> show variables like 'version';
+---------------+----------------+
| Variable_name | Value |
@ -116,11 +130,13 @@ The show variables command can also accept a limited like clause. This like clau
3 rows in set (0.02 sec)
mysql>
```
## Show status
The show status command displays a set of status counters, as with show variables the show status command can be passed a simplified like clause to limit the values returned.
```
mysql> show status;
+---------------------------+-------+
| Variable_name | Value |
@ -151,11 +167,13 @@ The show status command displays a set of status counters, as with show variable
22 rows in set (0.02 sec)
mysql>
```
## Show services
The show services command will return a set of basic statistics regarding each of the configured services within MaxScale.
```
mysql> show services;
+----------------+----------------+--------------+----------------+
| Service Name | Router Module | No. Sessions | Total Sessions |
@ -172,6 +190,7 @@ The show services command will return a set of basic statistics regarding each o
8 rows in set (0.02 sec)
mysql>
```
The show services command does not accept a like clause and will ignore any like clause that is given.
@ -179,6 +198,7 @@ The show services command does not accept a like clause and will ignore any like
The show listeners command will return a set of status information for every listener defined within the MaxScale configuration file.
```
mysql> show listeners;
+----------------+-----------------+-----------+------+---------+
| Service Name | Protocol Module | Address | Port | State |
@ -196,6 +216,7 @@ The show listeners command will return a set of status information for every lis
9 rows in set (0.02 sec)
mysql>
```
The show listeners command will ignore any like clause passed to it.
@ -203,6 +224,7 @@ The show listeners command will ignore any like clause passed to it.
The show sessions command returns information on every active session within MaxScale. It will ignore any like clause passed to it.
```
mysql> show sessions;
+-----------+---------------+----------------+---------------------------+
| Session | Client | Service | State |
@ -222,11 +244,13 @@ The show sessions command returns information on every active session within Max
11 rows in set (0.02 sec)
mysql>
```
## Show clients
The show clients command reports a row for every client application connected to MaxScale. Like clauses are not available of the show clients command.
```
mysql> show clients;
+-----------+---------------+---------+---------------------------+
| Session | Client | Service | State |
@ -237,11 +261,13 @@ The show clients command reports a row for every client application connected to
2 rows in set (0.02 sec)
mysql>
```
## Show servers
The show servers command returns data for each backend server configured within the MaxScale configuration file. This data includes the current number of connections MaxScale has to that server and the state of that server as monitored by MaxScale.
```
mysql> show servers;
+---------+-----------+------+-------------+---------+
| Server | Address | Port | Connections | Status |
@ -254,11 +280,13 @@ The show servers command returns data for each backend server configured within
4 rows in set (0.02 sec)
mysql>
```
## Show modules
The show modules command reports the information on the modules currently loaded into MaxScale. This includes the name type and version of each module. It also includes the API version the module has been written against and the current release status of the module.
```
mysql> show modules;
+----------------+-------------+---------+-------------+----------------+
| Module Name | Module Type | Version | API Version | Status |
@ -277,12 +305,13 @@ The show modules command reports the information on the modules currently loaded
10 rows in set (0.02 sec)
mysql>
```
## Show monitors
The show monitors command reports each monitor configured within the system and the state of that monitor.
```
mysql> show monitors;
+---------------+---------+
| Monitor | Status |
@ -292,12 +321,13 @@ The show monitors command reports each monitor configured within the system and
1 row in set (0.02 sec)
mysql>
```
## Show eventTimes
The show eventTimes command returns a table of statistics that reflect the performance of the event queuing and execution portion of the MaxScale core.
```
mysql> show eventTimes;
+---------------+-------------------+---------------------+
| Duration | No. Events Queued | No. Events Executed |
@ -336,6 +366,7 @@ The show eventTimes command returns a table of statistics that reflect the perfo
30 rows in set (0.02 sec)
mysql>
```
Each row represents a time interval, in 100ms increments, with the counts representing the number of events that were in the event queue for the length of time that row represents and the number of events that were executing of the time indicated by the row.
@ -347,6 +378,7 @@ The simplified JSON interface takes the URL of the request made to maxinfo and m
The /variables URL will return the MaxScale variables, these variables can not be filtered via this interface.
```
$ curl http://maxscale.mariadb.com:8003/variables
[ { "Variable_name" : "version", "Value" : "1.0.6-unstable"},
{ "Variable_name" : "version_comment", "Value" : "MariaDB MaxScale"},
@ -358,11 +390,13 @@ The /variables URL will return the MaxScale variables, these variables can not b
{ "Variable_name" : "MAXSCALE_UPTIME", "Value" : 3948},
{ "Variable_name" : "MAXSCALE_SESSIONS", "Value" : 12}]
$
```
## Status
Use of the /status URI will return the status information that would normally be returned by the show status command. No filtering of the status information is available via this interface
```
$ curl http://maxscale.mariadb.com:8003/status
[ { "Variable_name" : "Uptime", "Value" : 3831},
{ "Variable_name" : "Uptime_since_flush_status", "Value" : 3831},
@ -387,11 +421,13 @@ Use of the /status URI will return the status information that would normally be
{ "Variable_name" : "Max_event_queue_time", "Value" : 0},
{ "Variable_name" : "Max_event_execution_time", "Value" : 1}]
$
```
## Services
The /services URI returns the data regarding the services defined within the configuration of MaxScale. Two counters are returned, the current number of sessions attached to this service and the total number connected since the service started.
```
$ curl http://maxscale.mariadb.com:8003/services
[ { "Service Name" : "Test Service", "Router Module" : "readconnroute", "No. Sessions" : 1, "Total Sessions" : 1},
{ "Service Name" : "Split Service", "Router Module" : "readwritesplit", "No. Sessions" : 1, "Total Sessions" : 1},
@ -402,11 +438,13 @@ The /services URI returns the data regarding the services defined within the con
{ "Service Name" : "CLI", "Router Module" : "cli", "No. Sessions" : 1, "Total Sessions" : 1},
{ "Service Name" : "MaxInfo", "Router Module" : "maxinfo", "No. Sessions" : 5, "Total Sessions" : 20}]
$
```
## Listeners
The /listeners URI will return a JSON array with one entry per listener, each entry is a JSON object that describes the configuration and state of that listener.
```
$ curl http://maxscale.mariadb.com:8003/listeners
[ { "Service Name" : "Test Service", "Protocol Module" : "MySQLClient", "Address" : "*", "Port" : 4006, "State" : "Running"},
{ "Service Name" : "Split Service", "Protocol Module" : "MySQLClient", "Address" : "*", "Port" : 4007, "State" : "Running"},
@ -418,11 +456,13 @@ The /listeners URI will return a JSON array with one entry per listener, each en
{ "Service Name" : "MaxInfo", "Protocol Module" : "MySQLClient", "Address" : "*", "Port" : 9003, "State" : "Running"},
{ "Service Name" : "MaxInfo", "Protocol Module" : "HTTPD", "Address" : "*", "Port" : 8003, "State" : "Running"}]
$
```
## Modules
The /modules URI returns data for each plugin that has been loaded into MaxScale. The plugin name, type and version are returned as is the version of the plugin API that the plugin was built against and the release status of the plugin.
```
$ curl http://maxscale.mariadb.com:8003/modules
[ { "Module Name" : "HTTPD", "Module Type" : "Protocol", "Version" : "V1.0.1", "API Version" : "1.0.0", "Status" : "In Development"},
{ "Module Name" : "maxscaled", "Module Type" : "Protocol", "Version" : "V1.0.0", "API Version" : "1.0.0", "Status" : "GA"},
@ -435,11 +475,13 @@ The /modules URI returns data for each plugin that has been loaded into MaxScale
{ "Module Name" : "cli", "Module Type" : "Router", "Version" : "V1.0.0", "API Version" : "1.0.0", "Status" : "GA"},
{ "Module Name" : "maxinfo", "Module Type" : "Router", "Version" : "V1.0.0", "API Version" : "1.0.0", "Status" : "Alpha"}]
$
```
## Sessions
The /sessions URI returns a JSON array with an object for each active session within MaxScale.
```
$ curl http://maxscale.mariadb.com:8003/sessions
[ { "Session" : "0x1a8e9a0", "Client" : "80.176.79.245", "Service" : "MaxInfo", "State" : "Session ready for routing"},
{ "Session" : "0x1a8e6d0", "Client" : "80.240.130.35", "Service" : "MaxInfo", "State" : "Session ready for routing"},
@ -453,32 +495,38 @@ The /sessions URI returns a JSON array with an object for each active session wi
{ "Session" : "0x1a5c530", "Client" : , "Service" : "Split Service", "State" : "Listener Session"},
{ "Session" : "0x19ac1c0", "Client" : , "Service" : "Test Service", "State" : "Listener Session"}]
$
```
## Clients
The /clients URI is a limited version of the /sessions, in this case it only returns an entry for a session that represents a client connection.
```
$ curl http://maxscale.mariadb.com:8003/clients
[ { "Session" : "0x1a90be0", "Client" : "80.176.79.245", "Service" : "MaxInfo", "State" : "Session ready for routing"},
{ "Session" : "0x1a8e9a0", "Client" : "127.0.0.1", "Service" : "MaxInfo", "State" : "Session ready for routing"},
{ "Session" : "0x1a8e6d0", "Client" : "80.240.130.35", "Service" : "MaxInfo", "State" : "Session ready for routing"}]
$
```
## Servers
The /servers URI is used to retrieve information for each of the servers defined within the MaxScale configuration. This information includes the connection count and the current status as monitored by MaxScale. The connection count is only those connections made by MaxScale to those servers.
```
$ curl http://maxscale.mariadb.com:8003/servers
[ { "Server" : "server1", "Address" : "127.0.0.1", "Port" : 3306, "Connections" : 0, "Status" : "Running"},
{ "Server" : "server2", "Address" : "127.0.0.1", "Port" : 3307, "Connections" : 0, "Status" : "Down"},
{ "Server" : "server3", "Address" : "127.0.0.1", "Port" : 3308, "Connections" : 0, "Status" : "Down"},
{ "Server" : "server4", "Address" : "127.0.0.1", "Port" : 3309, "Connections" : 0, "Status" : "Down"}]
$
```
## Event Times
The /event/times URI returns an array of statistics that reflect the performance of the event queuing and execution portion of the MaxScale core. Each element is an object that represents a time bucket, in 100ms increments, with the counts representing the number of events that were in the event queue for the length of time that row represents and the number of events that were executing of the time indicated by the object.
```
$ curl http://maxscale.mariadb.com:8003/event/times
[ { "Duration" : "< 100ms", "No. Events Queued" : 64, "No. Events Executed" : 63},
{ "Duration" : " 100 - 200ms", "No. Events Queued" : 0, "No. Events Executed" : 0},
@ -510,3 +558,4 @@ The /event/times URI returns an array of statistics that reflect the performance
{ "Duration" : "2700 - 2800ms", "No. Events Queued" : 0, "No. Events Executed" : 0},
{ "Duration" : "2800 - 2900ms", "No. Events Queued" : 0, "No. Events Executed" : 0},
{ "Duration" : "> 3000ms", "No. Events Queued" : 0, "No. Events Executed" : 0}]
```