TOP LEVEL CATEGORIES
EXPLORE
Description:
# check_mariadb_slaves A Nagios plugin written in Python to monitor MariaDB slave metrics. Specifically: – Replication Lag – Slave IO running – Slave SQL running
## Assumptions – You’re familiar with MariaDB – You’re familiar with Nagios – You’re running a MariaDB server that is slaving data
## Requirements – Python (2.7, 3.4, 3.5, 3.6) – [mysqlclient](https://pypi.org/project/mysqlclient/)
## Why? MariaDB’s “multiple master” slaving support is unique and thus, has a slightly different syntax to check on slave status than the traditional “single master” implementation offered by MySQL. MariaDB allows you to check on the status of ALL slave connections or individual slave connections. This plugin leverages the “`SHOW SLAVE [“connection_name”] STATUS“` syntax to check on the slave status(es) of a particular connection. For more information about MariaDB slave status, see https://mariadb.com/kb/en/mariadb/show-slave-status/
Most database metrics you may want to monitor on MariaDB actually parallel MySQL. We use the *check_mysql_health* plugin: – https://exchange.nagios.org/directory/MySQL/check_mysql_health/details
## Installation – Download [the tarball of your preferred version](https://github.com/ordergroove/check_mariadb_slaves/releases) – Expand the archive – Double check `check_mariadb_slaves.py` is executable – Install package requirements, if not globally, at least in the context of the user running the plugin – Create a link to `check_mariadb_slaves.py` from your Nagios plugins directory (i.e. */usr/local/nagios/libexec*)
You may have different paths, but here’s an example of the above:
$ wget https://github.com/ordergroove/check_mariadb_slaves/archive/v2.0.tar.gz $ tar xzvf v2.0.tar.gz $ cd check_mariadb_slaves-2.0 $ chmod u+x check_mariadb_slaves.py $ pip install –user -rrequirements.txt $ ln -s /path/to/archive/check_mariadb_slaves-2.0/check_mariadb_slaves.py /usr/local/nagios/libexec/check_mariadb_slaves.py
## Command Line Parameters – –hostname – [*optional*] – hostname of the MariaDB slave – –username – [*optional*] – user to login to the MariaDB slave as – –password – [*optional*] – password of said user – –connection – __[required]__ – the “`”connection_name”“` to use in the “`SHOW SLAVE [“connection_name”] STATUS“` command – –mode – __[required]__ – the slave status to check. Current available options are – replication_lag – slave_io – slave_sql – -w or –warning – warning threshold; currently only required for “`replication_lag“` mode – -c or –critical – critical threshold; currently only required for “`replication_lag“` mode – –verbose – [*optional*] – for testing purposes; currently prints out the result of the slave status query when used
## Example Usage Here’s an example of Nagios command and service definitions that implement this plugin:
### commands.cfg “` define command { command_name check_mariadb_slave command_line $USER1$/check_mariadb_slave.py –hostname $HOSTADDRESS$ –username $USER3$ –password ‘$USER4$’ –connection $ARG1$ –mode $ARG2$ -w $ARG3$ -c $ARG4$ } “`
### services.cfg “` define service { use generic-service hostgroup_name mariadb_slaves service_description MariaDB SlaveSQL Running – config connection check_command check_mariadb_slave!config!slave_sql!0!0 }
define service { use generic-service hostgroup_name mariadb_slaves service_description MariaDB SlaveIO Running – config connection check_command check_mariadb_slave!config!slave_io!0!0 }
define service { use generic-service hostgroup_name mariadb_slaves service_description MariaDB Replication Lag – config connection check_command check_mariadb_slave!config!replication_lag!125!300 } “`
Current Version
v2.0
Last Release Date
2016-01-01
Compatible With
Owner
Juan Gutierrez
Website
https://github.com/ordergroove/check_mariadb_slaves
Download URL
https://github.com/ordergroove/check_mariadb_slaves/archive/v2.0.tar.gz
License
MIT
You must be logged in to submit a review.
Your review has been submitted and is pending approval.
To:
From:
Your recommendation has been sent.