Merge pull request #18 from tcpcloud/stacklight
Stacklight
diff --git a/galera/files/collectd_mysql.conf b/galera/files/collectd_mysql.conf
new file mode 100644
index 0000000..ce5bf55
--- /dev/null
+++ b/galera/files/collectd_mysql.conf
@@ -0,0 +1,14 @@
+<LoadPlugin mysql>
+ Globals false
+</LoadPlugin>
+
+<Plugin mysql>
+ <Database "mysql">
+ Host "localhost"
+ Socket "{{ plugin.socket }}"
+ User "{{ plugin.username }}"
+ Password "{{ plugin.password }}"
+ MasterStats false
+ SlaveStats false
+ </Database>
+</Plugin>
diff --git a/galera/files/collectd_mysql_check.conf b/galera/files/collectd_mysql_check.conf
new file mode 100644
index 0000000..d772c84
--- /dev/null
+++ b/galera/files/collectd_mysql_check.conf
@@ -0,0 +1,9 @@
+Import "collectd_mysql_check"
+
+<Module "collectd_mysql_check">
+ Host "localhost"
+ Socket "{{ plugin.socket }}"
+ Username "{{ plugin.username }}"
+ Password "{{ plugin.password }}"
+</Module>
+
diff --git a/galera/files/collectd_mysql_status.conf b/galera/files/collectd_mysql_status.conf
new file mode 100644
index 0000000..2a32845
--- /dev/null
+++ b/galera/files/collectd_mysql_status.conf
@@ -0,0 +1,44 @@
+<LoadPlugin dbi>
+ Globals false
+</LoadPlugin>
+
+<Plugin dbi>
+ <Query "wsrep_ready">
+ Statement "select replace(lower(VARIABLE_NAME), 'wsrep_', 'cluster.') as metric, replace(replace(VARIABLE_VALUE, 'ON', 1), 'OFF', 0) as value from information_schema.GLOBAL_STATUS where VARIABLE_NAME IN ('wsrep_ready', 'wsrep_connected');"
+ MinVersion 50000
+ <Result>
+ Type "gauge"
+ InstancesFrom "metric"
+ ValuesFrom "value"
+ </Result>
+ </Query>
+ <Query "wsrep_cluster_status">
+ Statement "select replace(replace(lower(VARIABLE_NAME), 'wsrep_', ''), '_', '.') as metric, replace(replace(replace(VARIABLE_VALUE, 'Primary', 1), 'Non-Primary', 2), 'Disconnected', 3) as value from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'wsrep_cluster_status';"
+ MinVersion 50000
+ <Result>
+ Type "gauge"
+ InstancesFrom "metric"
+ ValuesFrom "value"
+ </Result>
+ </Query>
+ <Query "wsrep_cluster">
+ Statement "select replace(replace(lower(VARIABLE_NAME), 'wsrep_', 'cluster.'), 'cluster_size', 'size') as metric, VARIABLE_VALUE as value from information_schema.GLOBAL_STATUS where VARIABLE_NAME IN ('wsrep_cluster_size', 'wsrep_replicated', 'wsrep_replicated_bytes', 'wsrep_received_bytes', 'wsrep_received', 'wsrep_local_commits', 'wsrep_local_cert_failures', 'wsrep_local_send_queue', 'Slow_queries');"
+ MinVersion 50000
+ <Result>
+ Type "gauge"
+ InstancesFrom "metric"
+ ValuesFrom "value"
+ </Result>
+ </Query>
+ <Database "mysql_status">
+ Driver "mysql"
+ DriverOption "mysql_unix_socket" "{{ plugin.socket }}"
+ DriverOption "username" "{{ plugin.username }}"
+ DriverOption "password" "{{ plugin.password }}"
+ DriverOption "dbname" "mysql"
+ SelectDB "mysql"
+ Query "wsrep_ready"
+ Query "wsrep_cluster_status"
+ Query "wsrep_cluster"
+ </Database>
+</Plugin>
diff --git a/galera/files/grafana_dashboards/mysql_influxdb.json b/galera/files/grafana_dashboards/mysql_influxdb.json
new file mode 100644
index 0000000..86031f7
--- /dev/null
+++ b/galera/files/grafana_dashboards/mysql_influxdb.json
@@ -0,0 +1,1289 @@
+{
+ "annotations": {
+ "enable": false,
+ "list": [
+ {
+ "datasource": "lma",
+ "enable": true,
+ "iconColor": "#C0C6BE",
+ "iconSize": 13,
+ "lineColor": "rgba(255, 96, 96, 0.592157)",
+ "name": "Status",
+ "query": "select title,tags,text from annotations where $timeFilter and cluster = 'mysql'",
+ "showLine": true,
+ "tagsColumn": "tags",
+ "textColumn": "text",
+ "titleColumn": "title"
+ }
+ ]
+ },
+ "editable": true,
+ "hideControls": false,
+ "id": null,
+ "links": [],
+ "originalTitle": "MySQL",
+ "refresh": "1m",
+ "rows": [
+ {
+ "collapse": false,
+ "editable": true,
+ "height": "250px",
+ "panels": [
+ {
+ "cacheTimeout": null,
+ "colorBackground": true,
+ "colorValue": false,
+ "colors": [
+ "rgba(71, 212, 59, 0.4)",
+ "rgba(241, 181, 37, 0.73)",
+ "rgba(225, 40, 40, 0.59)"
+ ],
+ "datasource": null,
+ "editable": true,
+ "error": false,
+ "format": "none",
+ "gauge": {
+ "maxValue": 100,
+ "minValue": 0,
+ "show": false,
+ "thresholdLabels": false,
+ "thresholdMarkers": true
+ },
+ "id": 26,
+ "interval": "> 60s",
+ "links": [],
+ "maxDataPoints": 100,
+ "nullPointMode": "connected",
+ "nullText": null,
+ "postfix": "",
+ "postfixFontSize": "50%",
+ "prefix": "",
+ "prefixFontSize": "50%",
+ "span": 3,
+ "sparkline": {
+ "fillColor": "rgba(31, 118, 189, 0.18)",
+ "full": false,
+ "lineColor": "rgb(31, 120, 193)",
+ "show": false
+ },
+ "targets": [
+ {
+ "column": "value",
+ "condition": "",
+ "dsType": "influxdb",
+ "fill": "",
+ "function": "last",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "null"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "groupby_field": "",
+ "interval": "",
+ "measurement": "cluster_status",
+ "policy": "default",
+ "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'mysql' AND $timeFilter GROUP BY time($interval) fill(null)",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "last"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "environment_label",
+ "operator": "=",
+ "value": "$environment"
+ },
+ {
+ "key": "cluster_name",
+ "operator": "=",
+ "value": "mysql"
+ }
+ ]
+ }
+ ],
+ "thresholds": "1,3",
+ "title": "",
+ "type": "singlestat",
+ "valueFontSize": "80%",
+ "valueMaps": [
+ {
+ "op": "=",
+ "text": "no data",
+ "value": "null"
+ },
+ {
+ "op": "=",
+ "text": "OKAY",
+ "value": "0"
+ },
+ {
+ "op": "=",
+ "text": "WARN",
+ "value": "1"
+ },
+ {
+ "op": "=",
+ "text": "UNKN",
+ "value": "2"
+ },
+ {
+ "op": "=",
+ "text": "CRIT",
+ "value": "3"
+ },
+ {
+ "op": "=",
+ "text": "DOWN",
+ "value": "4"
+ }
+ ],
+ "valueName": "current"
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": null,
+ "editable": true,
+ "error": false,
+ "fill": 0,
+ "grid": {
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 23,
+ "interval": ">60s",
+ "legend": {
+ "avg": false,
+ "current": false,
+ "max": false,
+ "min": false,
+ "show": true,
+ "total": false,
+ "values": false
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "connected",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 3,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "rx",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_octets_rx",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_octets_rx\" WHERE \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ }
+ ]
+ },
+ {
+ "alias": "tx",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_octets_tx",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_octets_tx\" WHERE \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ }
+ ]
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Network I/O",
+ "tooltip": {
+ "msResolution": false,
+ "shared": true,
+ "value_type": "cumulative"
+ },
+ "type": "graph",
+ "xaxis": {
+ "show": true
+ },
+ "yaxes": [
+ {
+ "format": "Bps",
+ "label": "",
+ "logBase": 1,
+ "max": null,
+ "min": 0,
+ "show": true
+ },
+ {
+ "format": "short",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": null,
+ "editable": true,
+ "error": false,
+ "fill": 0,
+ "grid": {
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 24,
+ "interval": ">60s",
+ "legend": {
+ "avg": false,
+ "current": false,
+ "max": false,
+ "min": false,
+ "show": true,
+ "total": false,
+ "values": false
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "connected",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 3,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "immediate",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_locks_immediate",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_locks_immediate\" WHERE \"environment_label\" =~ /^$environment$/ AND \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "environment_label",
+ "operator": "=",
+ "value": "$environment"
+ },
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ }
+ ]
+ },
+ {
+ "alias": "waited",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_locks_waited",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_locks_waited\" WHERE \"environment_label\" =~ /^$environment$/ AND \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "environment_label",
+ "operator": "=",
+ "value": "$environment"
+ },
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ }
+ ]
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Locks",
+ "tooltip": {
+ "msResolution": false,
+ "shared": true,
+ "value_type": "cumulative"
+ },
+ "type": "graph",
+ "xaxis": {
+ "show": true
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "per second",
+ "logBase": 1,
+ "max": null,
+ "min": 0,
+ "show": true
+ },
+ {
+ "format": "short",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": null,
+ "editable": true,
+ "error": false,
+ "fill": 0,
+ "grid": {
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 22,
+ "interval": ">60s",
+ "legend": {
+ "avg": false,
+ "current": false,
+ "max": false,
+ "min": false,
+ "show": true,
+ "total": false,
+ "values": false
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "connected",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 3,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "cached",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_threads_cached",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_threads_cached\" WHERE \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ }
+ ]
+ },
+ {
+ "alias": "connected",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_threads_connected",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_threads_connected\" WHERE \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ }
+ ]
+ },
+ {
+ "alias": "running",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_threads_running",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_threads_running\" WHERE \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ }
+ ]
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Threads",
+ "tooltip": {
+ "msResolution": false,
+ "shared": true,
+ "value_type": "cumulative"
+ },
+ "type": "graph",
+ "xaxis": {
+ "show": true
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "Thread Count",
+ "logBase": 1,
+ "max": null,
+ "min": 0,
+ "show": true
+ },
+ {
+ "format": "short",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": null,
+ "editable": true,
+ "error": false,
+ "fill": 0,
+ "grid": {
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 21,
+ "interval": ">60s",
+ "legend": {
+ "avg": false,
+ "current": false,
+ "max": false,
+ "min": false,
+ "show": true,
+ "total": false,
+ "values": false
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "connected",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 6,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "commit",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_commands",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_commands\" WHERE \"hostname\" =~ /$server/ AND \"statement\" = 'commit' AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ },
+ {
+ "condition": "AND",
+ "key": "statement",
+ "value": "commit"
+ }
+ ]
+ },
+ {
+ "alias": "delete",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_commands",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_commands\" WHERE \"hostname\" =~ /$server/ AND \"statement\" = 'delete' AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "B",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ },
+ {
+ "condition": "AND",
+ "key": "statement",
+ "value": "delete"
+ }
+ ]
+ },
+ {
+ "alias": "insert",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_commands",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_commands\" WHERE \"hostname\" =~ /$server/ AND \"statement\" = 'insert' AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "C",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ },
+ {
+ "condition": "AND",
+ "key": "statement",
+ "value": "insert"
+ }
+ ]
+ },
+ {
+ "alias": "select",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_commands",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_commands\" WHERE \"hostname\" =~ /$server/ AND \"statement\" = 'select' AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "D",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ },
+ {
+ "condition": "AND",
+ "key": "statement",
+ "value": "select"
+ }
+ ]
+ },
+ {
+ "alias": "rollback",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_commands",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_commands\" WHERE \"hostname\" =~ /$server/ AND \"statement\" = 'rollback' AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "E",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ },
+ {
+ "condition": "AND",
+ "key": "statement",
+ "value": "rollback"
+ }
+ ]
+ },
+ {
+ "alias": "update",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "params": [
+ "$interval"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "0"
+ ],
+ "type": "fill"
+ }
+ ],
+ "groupByTags": [],
+ "measurement": "mysql_commands",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_commands\" WHERE \"hostname\" =~ /$server/ AND \"statement\" = 'update' AND $timeFilter GROUP BY time($interval) fill(0)",
+ "rawQuery": false,
+ "refId": "F",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "value": "/$server/"
+ },
+ {
+ "condition": "AND",
+ "key": "statement",
+ "value": "update"
+ }
+ ]
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Commands",
+ "tooltip": {
+ "msResolution": false,
+ "shared": true,
+ "value_type": "cumulative"
+ },
+ "type": "graph",
+ "xaxis": {
+ "show": true
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "per second",
+ "logBase": 1,
+ "max": null,
+ "min": 0,
+ "show": true
+ },
+ {
+ "format": "short",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "datasource": null,
+ "editable": true,
+ "error": false,
+ "fill": 0,
+ "grid": {
+ "threshold1": null,
+ "threshold1Color": "rgba(216, 200, 27, 0.27)",
+ "threshold2": null,
+ "threshold2Color": "rgba(234, 112, 112, 0.22)"
+ },
+ "id": 25,
+ "interval": "> 60s",
+ "legend": {
+ "avg": false,
+ "current": false,
+ "max": false,
+ "min": false,
+ "show": true,
+ "total": false,
+ "values": false
+ },
+ "lines": true,
+ "linewidth": 1,
+ "links": [],
+ "nullPointMode": "connected",
+ "percentage": false,
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "span": 6,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "alias": "$tag_handler",
+ "column": "value",
+ "dsType": "influxdb",
+ "function": "mean",
+ "groupBy": [
+ {
+ "interval": "auto",
+ "params": [
+ "auto"
+ ],
+ "type": "time"
+ },
+ {
+ "params": [
+ "handler"
+ ],
+ "type": "tag"
+ },
+ {
+ "params": [
+ "previous"
+ ],
+ "type": "fill"
+ }
+ ],
+ "measurement": "mysql_handler",
+ "policy": "default",
+ "query": "SELECT mean(\"value\") FROM \"mysql_handler\" WHERE \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval), \"handler\" fill(previous)",
+ "rawQuery": false,
+ "refId": "A",
+ "resultFormat": "time_series",
+ "select": [
+ [
+ {
+ "params": [
+ "value"
+ ],
+ "type": "field"
+ },
+ {
+ "params": [],
+ "type": "mean"
+ }
+ ]
+ ],
+ "tags": [
+ {
+ "key": "hostname",
+ "operator": "=~",
+ "value": "/$server/"
+ }
+ ]
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Handlers",
+ "tooltip": {
+ "msResolution": false,
+ "shared": true,
+ "value_type": "cumulative"
+ },
+ "type": "graph",
+ "xaxis": {
+ "show": true
+ },
+ "yaxes": [
+ {
+ "format": "short",
+ "label": "per second",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ },
+ {
+ "format": "short",
+ "logBase": 1,
+ "max": null,
+ "min": null,
+ "show": true
+ }
+ ]
+ }
+ ],
+ "title": "MySQL"
+ }
+ ],
+ "schemaVersion": 12,
+ "sharedCrosshair": true,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "enable": true,
+ "list": [
+ {
+ "allFormat": "regex values",
+ "current": {},
+ "datasource": null,
+ "hide": 0,
+ "includeAll": false,
+ "name": "environment",
+ "options": [],
+ "query": "show tag values from cpu_idle with key = environment_label",
+ "refresh": 1,
+ "refresh_on_load": true,
+ "regex": "",
+ "type": "query"
+ },
+ {
+ "allFormat": "glob",
+ "current": {},
+ "datasource": null,
+ "hide": 0,
+ "includeAll": false,
+ "name": "server",
+ "options": [],
+ "query": "show tag values from mysql_commands with key = hostname where environment_label =~ /^$environment$/ ",
+ "refresh": 1,
+ "refresh_on_load": true,
+ "regex": "",
+ "type": "query"
+ }
+ ]
+ },
+ "time": {
+ "from": "now-1h",
+ "to": "now"
+ },
+ "timepicker": {
+ "collapse": false,
+ "enable": true,
+ "notice": false,
+ "now": true,
+ "refresh_intervals": [
+ "5s",
+ "10s",
+ "30s",
+ "1m",
+ "5m",
+ "15m",
+ "30m",
+ "1h",
+ "2h",
+ "1d"
+ ],
+ "status": "Stable",
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ],
+ "type": "timepicker"
+ },
+ "timezone": "browser",
+ "title": "MySQL",
+ "version": 2
+}
diff --git a/galera/map.jinja b/galera/map.jinja
index bed74ad..cf9c66d 100644
--- a/galera/map.jinja
+++ b/galera/map.jinja
@@ -1,7 +1,7 @@
{%- set master = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['mysql-server-wsrep-5.6', 'galera-3', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat'],
+ 'pkgs': ['mysql-server-wsrep-5.6', 'galera-3', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat', 'libdbd-mysql', 'python-pymysql'],
'service': 'mysql',
'wsrep_provider': '/usr/lib/galera/libgalera_smm.so',
'log_file': '/var/log/mysql.log',
@@ -21,7 +21,7 @@
{%- set slave = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat'],
+ 'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat', 'libdbd-mysql', 'python-pymysql'],
'service': 'mysql',
'wsrep_provider': '/usr/lib/galera/libgalera_smm.so',
'log_file': '/var/log/mysql.log',
diff --git a/galera/meta/collectd.yml b/galera/meta/collectd.yml
new file mode 100644
index 0000000..4533ad0
--- /dev/null
+++ b/galera/meta/collectd.yml
@@ -0,0 +1,29 @@
+{%- if pillar.galera is defined %}
+{%- if pillar.galera.master is defined %}
+{%- from "galera/map.jinja" import master with context %}
+{%- set server = master %}
+{%- elif pillar.galera.slave is defined %}
+{%- from "galera/map.jinja" import slave with context %}
+{%- set server = slave %}
+{%- endif %}
+{%- endif %}
+
+{%- if server is defined %}
+local_plugin:
+ mysql:
+ template: galera/files/collectd_mysql.conf
+ socket: {{ server.socket }}
+ password: {{ server.admin.password }}
+ username: {{ server.admin.user }}
+ mysql_status:
+ template: galera/files/collectd_mysql_status.conf
+ socket: {{ server.socket }}
+ password: {{ server.admin.password }}
+ username: {{ server.admin.user }}
+ mysql_check:
+ plugin: python
+ template: galera/files/collectd_mysql_check.conf
+ socket: {{ server.socket }}
+ password: {{ server.admin.password }}
+ username: {{ server.admin.user }}
+{%- endif %}
diff --git a/galera/meta/grafana.yml b/galera/meta/grafana.yml
new file mode 100644
index 0000000..378cf5d
--- /dev/null
+++ b/galera/meta/grafana.yml
@@ -0,0 +1,4 @@
+dashboard:
+ galera:
+ format: json
+ template: galera/files/grafana_dashboards/mysql_influxdb.json
diff --git a/galera/meta/heka.yml b/galera/meta/heka.yml
new file mode 100644
index 0000000..7694e12
--- /dev/null
+++ b/galera/meta/heka.yml
@@ -0,0 +1,80 @@
+log_collector:
+ decoder:
+ galera:
+ engine: sandbox
+ module_file: /usr/share/lma_collector/decoders/galera.lua
+ module_dir: /usr/share/lma_collector/common;/usr/share/heka/lua_modules
+ adjust_timezone: true
+ input:
+ galera:
+ engine: logstreamer
+ log_directory: "/var/log"
+ file_match: 'mysql/error.log$'
+ differentiator: ["galera"]
+ decoder: "galera_decoder"
+ splitter: "galera_splitter"
+ splitter:
+ galera:
+ engine: regex
+ delimiter: '\n([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})'
+ delimiter_eol: false
+metric_collector:
+ trigger:
+ mysql_check:
+ description: 'MySQL cannot be checked'
+ severity: down
+ rules:
+ - metric: mysql_check
+ relational_operator: '=='
+ threshold: 0
+ window: 60
+ periods: 0
+ function: last
+ mysql_node_connected:
+ description: 'The MySQL service has lost connectivity with the other nodes'
+ severity: critical
+ rules:
+ - metric: mysql_cluster_connected
+ relational_operator: '=='
+ threshold: 0
+ window: 30
+ periods: 1
+ function: min
+ mysql_node_ready:
+ description: "The MySQL service isn't ready to serve queries"
+ severity: critical
+ rules:
+ - metric: mysql_cluster_ready
+ relational_operator: '=='
+ threshold: 0
+ window: 30
+ periods: 1
+ function: min
+ alarm:
+ mysql_check:
+ alerting: enabled
+ triggers:
+ - mysql_check
+ dimension:
+ service: mysql
+ mysql_node_status:
+ alerting: enabled
+ triggers:
+ - mysql_node_connected
+ - mysql_node_ready
+ dimension:
+ service: mysql
+aggregator:
+ alarm_cluster:
+ mysql:
+ policy: majority_of_members
+ alerting: enabled_with_notification
+ match:
+ service: mysql
+ group_by: hostname
+ members:
+ - mysql_check
+ - mysql_node_status
+ dimension:
+ cluster_name: mysql
+ nagios_host: 00-top-clusters
diff --git a/metadata/service/master/cluster.yml b/metadata/service/master/cluster.yml
index db45e54..7705f6b 100644
--- a/metadata/service/master/cluster.yml
+++ b/metadata/service/master/cluster.yml
@@ -1,5 +1,7 @@
applications:
- galera
+classes:
+- service.galera.support
parameters:
_param:
galera_server_cluster_name: galeracluster
@@ -32,4 +34,4 @@
- name: haproxy
host: '%'
- name: haproxy
- host: ${_param:cluster_local_address}
\ No newline at end of file
+ host: ${_param:cluster_local_address}
diff --git a/metadata/service/slave/cluster.yml b/metadata/service/slave/cluster.yml
index 8f829b2..2432da6 100644
--- a/metadata/service/slave/cluster.yml
+++ b/metadata/service/slave/cluster.yml
@@ -1,5 +1,7 @@
applications:
- galera
+classes:
+- service.galera.support
parameters:
_param:
galera_server_cluster_name: galeracluster
@@ -32,4 +34,4 @@
- name: haproxy
host: '%'
- name: haproxy
- host: ${_param:cluster_local_address}
\ No newline at end of file
+ host: ${_param:cluster_local_address}
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 61b87bd..937f8d0 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -2,12 +2,14 @@
galera:
_support:
collectd:
- enabled: false
+ enabled: true
heka:
- enabled: false
+ enabled: true
sensu:
enabled: true
sphinx:
enabled: true
config:
- enabled: true
\ No newline at end of file
+ enabled: true
+ grafana:
+ enabled: true