Giter Club home page Giter Club logo

check_mysql_slavestatus's Introduction

check_mysql_slavestatus's People

Contributors

alexisreyes avatar napsty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

check_mysql_slavestatus's Issues

Strange CRITICAL output when Slave_SQL_Running No

When the plugin detects that the slave process is not running, the plugin output looks strange:

# /usr/lib/nagios/plugins/check_mysql_slavestatus.sh -H mysqlserver -u monitoring -p secret
CRITICAL: -h mysqlserver:-P 3306 Slave_SQL_Running: No

The parameters here should not show up.

Error connecting when use socket

To success conection i had to add "passoword" variable in "ConnectionResult"; in the socket section. Like this:

ConnectionResult=$(mysql ${optfile} ${socket} ${user} -p"${password}" -e "SHOW SLAVE ${connection} STATUS ${channel}\G" 2>&1)

Unable to connect to server

Hello,

Apologies in advance if this is not the right place to submit a request for help. This is not an issue but rather a plea for some further guidance beyond your documentation. Please do not hesitate to redirect me.

Unable to get ./check_mysql_slavestatus.sh working even from the command line where I receive the following error:
$ ./check_mysql_slavestatus.sh -H 127.0.0.1 -u nagios -p <password> CRITICAL: Unable to connect to server

The replication rights were granted to the user nagios as confirmed below:
MariaDB [(none)]> SHOW GRANTS FOR nagios; +--------------------------------------------------------------------------------------------------------------------+ | Grants for nagios@% | +--------------------------------------------------------------------------------------------------------------------+ | GRANT REPLICATION CLIENT ON *.* TO nagios@% IDENTIFIED BY PASSWORD '*BA3BD6712CF1AE71D3969D83CDA598A2D9191CBD' | +--------------------------------------------------------------------------------------------------------------------+

Indeed I can confirm command line access to the db server locally and remotely.

The NRPE.cfg entry on the remote client (db server) is as follows:
command[check_mysql_slavestatus]=/usr/local/nagios/libexec/check_mysql_slavestatus -H localhost -u nagios -p <password>
with the correct string for , of course.

In other words, I can confirm connection to the db server, locally or remotely, using the same credentials that I am using for the NRPE plugin. Can you please let me know how to troubleshoot this operator/user error for your script? Thanks.

Kind regards.

Specifying a socket in the connection settings file MariaDB still uses TCP as -P is used

When connection options are read from an options file (-o) a socket specified in there is ignored by MariaDB as check_mysql_slavestatus still sets -P 3306 which causes MariaDB to use TCP.
MariaDB warning: WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol.
We noticed that due to an error from check_mysql_slavestatus CRITICAL: Unable to connect to server as we had only allowed "localhost" but at the same time disabled name resolution (reverse dns) by setting skip-name-resolve=on. That way the tcp connect from 127.0.0.1 no longer matched the permitted host "localhost".

Workaround:
Specify socket again on the command line, a valid user and a dummy password; the password will be overwritten with the value read from the options file. This will cause check_mysql_slavestatus not to use -P towards MariaDB.
Only specifying the socket file doesn't work as user/password are required parameters in that case.
Example:
check_mysql_slavestatus.sh -o mysql.credentials -S /run/mysqld/mysqld.sock -u monitoring -p dummy ...

Tested with: MariaDB 10.6.11

Updated privileges for MariaDB 10.5+

Since MariaDB 10.5+ the REPLICA MONITOR privilege needs to be used to be able to fetch replication status; previously this was REPLICATION CLIENT. Additionally the suggested source-specification of "any" (%) in script and documentation seems a bit broad.

support for mysql 5.6+ login paths

Thank you very much for making this available. I have a small improvement request. Could support for the --login-path parameter for the mysql client be added to this script ?

For example if a new "-l" switch was added the affected lines of code might be something like these (plus relevant documentation changes):

...
while getopts "H:P:u:p:S:s:w:c:o:m:h:l" Input;
...
l) loginpath="--login-path=${OPTARG}";;
...
then for the case we receive the -l switch the invoke of the mysql client would be

ConnectionResult=$(mysql ${loginpath} ${optfile} ... -e "show slave ${connection} status\G" 2>&1)
...

Thank you again for considering this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.