Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7b8c060
Improve slave_running check
May 21, 2018
f8f035b
Merge pull request #1 from criteo-forks/patch_slave_io_running
pdumontcriteo May 22, 2018
581b03d
Add database size metric
Oct 23, 2018
1786027
Merge pull request #2 from criteo-forks/database_size
pdumontcriteo Oct 25, 2018
fff2b2e
Modify metric type for db_size metric
Oct 31, 2018
9bc79c0
Merge pull request #3 from criteo-forks/database_size
RemiLar Nov 2, 2018
6abeec1
Changed 'Innodb_row_lock_waits' from 'counter' to 'gauge'
pdumontcriteo Jan 21, 2019
5d8cfd0
Revert "Changed 'Innodb_row_lock_waits' from 'counter' to 'gauge'"
khodin Apr 29, 2019
2f6fa41
Collect os_log_bytes_written from information schema.
Aug 21, 2019
18828b8
Improve os_log_bytes_written implementation
Aug 22, 2019
c48050e
Add number proccess locked by an other one
Feb 14, 2020
c32f189
Changed index from lock to innodb for nb_lock (METADATA_LOCK_INFO)
Feb 19, 2020
fffd257
Merge pull request #7 from Esysteme/master
khodin Feb 20, 2020
dedeca1
Update README.md to handle the metadata lock
Feb 21, 2020
784a154
Merge pull request #8 from criteo-forks/metadatalock
khodin Feb 21, 2020
270796f
Add read_only metric
Apr 14, 2020
abf1cad
Add metric type to make it work with the previous change (#10)
CharlesJUDITH Apr 15, 2020
ff673a8
Revamp indentation (replace 8 by for for tab space) (#11)
CharlesJUDITH Apr 16, 2020
755a991
Fix tab/space mix
Apr 16, 2020
277896b
[lint] Fix coding style
Apr 16, 2020
466d195
[lint] Cleanup whitespaces
Apr 17, 2020
5e260ac
Replace MySQLdb by pymysql (#13)
CharlesJUDITH Apr 17, 2020
80a4ea7
Improve management of the on/off values in mysql vars (#14)
CharlesJUDITH Apr 17, 2020
33b4443
Add number of current connections per user (#15)
CharlesJUDITH Apr 22, 2020
0edcad8
Small changes to prepare the code for the tests
Apr 27, 2020
7045b1e
Add python tests with Github Actions
CharlesJUDITH Apr 27, 2020
dbed681
Remove unexisting python 3.4
CharlesJUDITH Apr 27, 2020
76635e0
Change metric name for user connections
Aug 14, 2020
0450e50
Fix for MariaDB 10.5
pdumontcriteo Aug 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# TODO: Add requirements.txt instead
pip install PyMySQL
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=19 --max-line-length=127 --statistics
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.vscode
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Pulls most of the same metrics as the Percona Monitoring Plugins for Cacti. Coll

Most MySQL monitoring plugins fetch a lot of information by parsing the output of `SHOW ENGINE INNODB STATUS`. This plugin prefers InnoDB statistics from `SHOW GLOBAL STATUS`. Percona Server and MariaDB provide most of these InnoDB metrics on `SHOW GLOBAL STATUS`.

Requires the Python MySQLdb package. (`python-mysqldb` on Debian)
Requires the Python `pymysql` package.

## Installation
1. Place mysql.py in your CollectD python plugins directory
Expand Down Expand Up @@ -187,6 +187,7 @@ Collected from `SHOW VARIABLES`:
variables.thread_cache_size
variables.thread_concurrency
variables.tmp_table_size
variables.read_only

### MySQL Processes

Expand Down Expand Up @@ -296,6 +297,30 @@ TBD:
hash_index_cells_used
additional_pool_alloc

### InnoDB metrics from information_schema

**Warning: This is only available in MariaDB >= 10.x and MySQL >= 5.6.**

Collected by parsing the output of `SELECT COUNT from INFORMATION_SCHEMA.INNODB_METRICS where name ='os_log_bytes_written';`:

mysql plugin: Sending value: innodb/os_log_bytes_written=263167952896

To get the metadata lock information:

mysql plugin: Sending value: innodb/lock=0

- MariaDB: https://mariadb.com/kb/en/metadata-lock-info-plugin/
- MySQL: https://dev.mysql.com/doc/refman/5.7/en/metadata-locks-table.html


### Database size

Collected by parsing the output of `SELECT table_schema 'db_name', Round(Sum(data_length + index_length) / 1024 / 1024, 0) 'db_size_mb' FROM information_schema.tables WHERE table_schema not in ('mysql', 'information_schema', 'performance_schema', 'heartbeat') GROUP BY table_schema;`:

db_size/databasename=14907

The Database size is in MB.


### Master/Slave Status

Expand All @@ -310,6 +335,13 @@ From `SHOW SLAVE STATUS`:
slave.slave_stopped - 1 when the slave is stopped, 0 when it's running
slave.slave_running - 1 when the slave is running, 0 when it's stopped

### Current connections for users

This is using performance_schema. If performance_schema is not enabled, it won't work.

user_connection.root
user_connection.user-repl

### Query Response Times

For versions of MySQL with support for it and where enabled, `INFORMATION_SCHEMA.QUERY_RESPONSE_TIME` will be queried for metrics to generate a histogram of query response times.
Expand Down
Loading