Skip to content

Commit

Permalink
add proxysql service monitoring plugin (netdata#703)
Browse files Browse the repository at this point in the history
  • Loading branch information
yasharne authored Sep 14, 2022
1 parent 8750aae commit 2ba3668
Show file tree
Hide file tree
Showing 20 changed files with 2,561 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Go.d.plugin is shipped with Netdata.
| [postgres](https://github.com/netdata/go.d.plugin/tree/master/modules/postgres) | PostgreSQL |
| [powerdns](https://github.com/netdata/go.d.plugin/tree/master/modules/powerdns) | PowerDNS Authoritative Server |
| [powerdns_recursor](https://github.com/netdata/go.d.plugin/tree/master/modules/powerdns_recursor) | PowerDNS Recursor |
| [proxysql](https://github.com/netdata/go.d.plugin/tree/master/modules/proxysql) | ProxySQL |
| [pulsar](https://github.com/netdata/go.d.plugin/tree/master/modules/portcheck) | Apache Pulsar |
| [rabbitmq](https://github.com/netdata/go.d.plugin/tree/master/modules/rabbitmq) | RabbitMQ |
| [redis](https://github.com/netdata/go.d.plugin/tree/master/modules/redis) | Redis |
Expand Down
102 changes: 102 additions & 0 deletions config/go.d/proxysql.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# netdata go.d.plugin configuration for proxysql
#
# This file is in YAML format. Generally the format is:
#
# name: value
#
# There are 2 sections:
# - GLOBAL
# - JOBS
#
#
# [ GLOBAL ]
# These variables set the defaults for all JOBs, however each JOB may define its own, overriding the defaults.
#
# The GLOBAL section format:
# param1: value1
# param2: value2
#
# Currently supported global parameters:
# - update_every
# Data collection frequency in seconds. Default: 1.
#
# - autodetection_retry
# Re-check interval in seconds. Attempts to start the job are made once every interval.
# Zero means not to schedule re-check. Default: 0.
#
# - priority
# Priority is the relative priority of the charts as rendered on the web page,
# lower numbers make the charts appear before the ones with higher numbers. Default: 70000.
#
#
# [ JOBS ]
# JOBS allow you to collect values from multiple sources.
# Each source will have its own set of charts.
#
# IMPORTANT:
# - Parameter 'name' is mandatory.
# - Jobs with the same name are mutually exclusive. Only one of them will be allowed running at any time.
#
# This allows autodetection to try several alternatives and pick the one that works.
# Any number of jobs is supported.
#
# The JOBS section format:
#
# jobs:
# - name: job1
# param1: value1
# param2: value2
#
# - name: job2
# param1: value1
# param2: value2
#
# - name: job2
# param1: value1
#
#
# [ List of JOB specific parameters ]:
# - dsn
# Data Source Name.
# Format: [username[:password]@][protocol[(address)]]/
# Full description: https://github.com/go-sql-driver/mysql#dsn-data-source-name
# Syntax:
# dsn: stats:stats@tcp(127.0.0.1:6032)/
#
# - my.cnf
# Specifies my.cnf file to read connection parameters from under the [client] section
# Syntax:
# my.cnf: '/etc/my.cnf'
#
# - timeout
# Query timeout in seconds. Default 1 second.
# Syntax:
# timeout: 1
#
#
# [ JOB defaults ]:
# No parameters
#
#
# [ JOB mandatory parameters ]:
# - name
# - dsn
# ------------------------------------------------MODULE-CONFIGURATION--------------------------------------------------

# update_every: 1
# autodetection_retry: 0
# priority: 70000
# timeout: 1

jobs:
# my.cnf
- name: local
my.cnf: '/etc/my.cnf'

# stats
- name: local
dsn: stats:stats@tcp(127.0.0.1:6032)/

- name: local
dsn: stats:stats@tcp([::1]:6032)/

1 change: 1 addition & 0 deletions modules/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import (
_ "github.com/netdata/go.d.plugin/modules/powerdns"
_ "github.com/netdata/go.d.plugin/modules/powerdns_recursor"
_ "github.com/netdata/go.d.plugin/modules/prometheus"
_ "github.com/netdata/go.d.plugin/modules/proxysql"
_ "github.com/netdata/go.d.plugin/modules/pulsar"
_ "github.com/netdata/go.d.plugin/modules/rabbitmq"
_ "github.com/netdata/go.d.plugin/modules/redis"
Expand Down
105 changes: 105 additions & 0 deletions modules/proxysql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!--
title: "ProxySQL monitoring with Netdata"
description: "Monitor connections, slow queries, lagging, backends status and more with zero configuration and per-second metric granularity."
custom_edit_url: https://github.com/netdata/go.d.plugin/edit/master/modules/proxysql/README.md
sidebar_label: "ProxySQL"
-->

# ProxySQL monitoring with Netdata

[`ProxySQL`](https://www.proxysql.com/) is an open-source proxy for mySQL.

This module monitors one or more `ProxySQL` servers, depending on your configuration.

## Requirements

Executed queries:

- `SELECT Variable_Name, Variable_Value FROM global_variables;`
- `SELECT Variable_Name, Variable_Value FROM stats_memory_metrics;`
- `SELECT * FROM stats_mysql_commands_counters;`
- `SELECT Variable_Name, Variable_Value FROM stats_mysql_global;`
- `SELECT * FROM stats_mysql_users;`


Netdata uses `stats` username and password which is enabled by default

## Charts

It produces the following charts:

- Uptime in `seconds`
- Questions in `questions`
- Active transactions in `transanctions`
- Slow queries in `queries`
- Backend lagging during query in `backends`
- Backend offline during query in `backends`
- Generated error packets in `packets/s`
- Max connection timeouts in `connections`
- Client connections in `connections`
- Server connections in `connections`
- Query time in `nanoseconds`
- ProxySQL commands in `commands`
- Connection pool requests in `connections`
- Connection pool connections in `connections`
- Mysql monitor threads in `threads`
- Mysql thread workers in `workers`
- Network in `bytes/s`
- Query cache in `number of entries`
- Prepared statements in `prepared statements`
- MySQL max allowed packet in `bytes`
- Memory in `bytes`
- Jemalloc memory in `bytes`
- MySQL command counts in `commands`
- MySQL user connections in `connections`


## Configuration

Edit the `go.d/proxysql.conf` configuration file using `edit-config` from the
Netdata [config directory](https://learn.netdata.cloud/docs/configure/nodes), which is typically at `/etc/netdata`.

```bash
cd /etc/netdata # Replace this path with your Netdata config directory
sudo ./edit-config go.d/proxysql.conf
```

[DSN syntax in details](https://github.com/go-sql-driver/mysql#dsn-data-source-name).

```yaml
jobs:
- name: local
dsn: '[username[:password]@][protocol[(address)]]/'
# username:password@protocol(address)/
# Examples:
# - name: remote
# dsn: stats:stats@localhost/
```

For all available options see
module [configuration file](https://github.com/netdata/go.d.plugin/blob/master/config/go.d/proxysql.conf).

## Troubleshooting

To troubleshoot issues with the `proxysql` collector, run the `go.d.plugin` with the debug option enabled. The output
should give you clues as to why the collector isn't working.

- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.

```bash
cd /usr/libexec/netdata/plugins.d/
```

- Switch to the `netdata` user.

```bash
sudo -u netdata -s
```

- Run the `go.d.plugin` to debug the collector:

```bash
./go.d.plugin -d -m proxysql
```

Loading

0 comments on commit 2ba3668

Please sign in to comment.