Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments for MySQL replication monitoring on Ubuntu 10.04 with Nagios and NRPE #545

Open
phinjensen opened this issue Nov 11, 2017 · 12 comments

Comments

@phinjensen
Copy link
Contributor

phinjensen commented Nov 11, 2017

Comments for https://www.endpointdev.com/blog/2012/01/mysql-replication-monitoring-on-ubuntu/
By Brian Buchalter

To enter a comment:

  1. Log in to GitHub
  2. Leave a comment on this issue.
@phinjensen
Copy link
Contributor Author

original author: Anonymous
date: 2012-08-09T08:51:17-04:00

I get errors:
Description: Checks master and slave log positions as well as slave status. Usage: ./check_mysql_replication.pl -H Script assumes:...

English locale More info at http://blog.endpoint.com/2012/01/mysql-replication-monitoring-on-ubuntu.html

Can you help me?

@phinjensen
Copy link
Contributor Author

original author: Brian Buchalter
date: 2012-08-09T08:57:53-04:00

Can you provide the command you are issuing? I looks like a syntax error.

@phinjensen
Copy link
Contributor Author

original author: Anonymous
date: 2012-08-13T03:55:00-04:00

./check_mysql_replication.sh -H 192.168.1.100 -P 5432 -u username -p password

and I get:
Unknown argument: -P
Description: Checks master and slave log positions as well as slave status. Usage: ./check_mysql_replication.sh -H Script assumes: 0 ... the names of all Nagios plugins

@phinjensen
Copy link
Contributor Author

original author: Justin Edmands
date: 2012-11-27T11:22:41-05:00

Part 1 - any possible reason this would come up? I understand it want's a number. I can dig into it further, just wondering what you think:

[root@mysql1 plugins]# ./check_mysql_replication -H localhost
expr: syntax error
./check_mysql_replication: line 87: [: -gt: unary operator expected

Part 2 - Is this even checking to see if the master has anything? Or do I definitely have to run this on the Master only. It is specified in your posting to do so...just checking.
OK - log positions match ( = 64753901), slave status = 'Waiting for master to send event'

@phinjensen
Copy link
Contributor Author

original author: Anonymous
date: 2012-12-04T12:55:05-05:00

Great stuff.. only problem is, the command fails when run via check_nrpe.

When run as nagios on the server:

su - nagios

-bash-4.1$ /bin/bash /usr/local/nagios/libexec/check_mysql_replication.sh -H 127.0.0.1
OK - log positions match (5159234 = 5159234), slave status = 'Waiting for master to send event'

When run via check_nrpe on the Nagios server:

/usr/local/nagios/libexec/check_nrpe -H -t 30 -c check_mysql_replication
Error reading slave: ERROR 1227 (42000) at line 1: Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation

Any ideas? Thanks!

@phinjensen
Copy link
Contributor Author

original author: Anonymous
date: 2012-12-04T13:01:52-05:00

Never mind, I fixed it. Turns out it needed to run sudo before it. No idea why.. nagios user has a .my.cnf in its home directory so it shouldn't need sudo privs. Very strange.

@phinjensen
Copy link
Contributor Author

original author: Brian Buchalter
date: 2012-12-04T13:08:26-05:00

Please verify your nrpe.conf command is formed as specified in the article:
command[check_mysql_replication]=sudo /usr/lib/nagios/plugins/check_mysql_replication.sh

@phinjensen
Copy link
Contributor Author

original author: Anonymous
date: 2013-11-23T21:17:44-05:00

Thanks Brian for the fine contribution to the Nagios (and MySQL) community!

I struggled to make this work as described above under Ubuntu 12.04. Using 'sudo' as specified made the command run as the root user, which, made the file /home/nagios/.my.cnf useless.

However, by changing the declaration in my nrpe.cfg file, it works as intended:

command[check_mysql_replication]=sudo -u nagios /usr/lib/nagios/plugins/check_mysql_replication -H

This causes the command to run as the user 'nagios'.

It isn't clear to me why this is even required as I would have thought that the nagios commands would naturally run as nagios, but nothing works at all without the sudo stuff. Perhaps this is because Nagios doesn't have an environment normally, but by using sudo -u nagios, we're operating as the user nagios with the associated environment which may be required for mysql to reference the .my.cnf file?

Anyway, I hope this helps someone and thanks again Brian.

@phinjensen
Copy link
Contributor Author

original author: Ashish Karpe
date: 2015-06-05T06:15:37-04:00

I ran this on Master db

check_nrpe -H slave-ip -t 30 -c check_mysql_replication -uroot -ppassowrd

got error :
check_nrpe: command not found

@phinjensen
Copy link
Contributor Author

original author: Ashish Karpe
date: 2015-06-05T08:17:14-04:00

On Nagios Server

/usr/local/nagios/libexec/check_nrpe -H master-ip -t 30 -c check_mysql_replication

NRPE: Unable to read output

@phinjensen
Copy link
Contributor Author

original author: Ashish Karpe
date: 2015-06-05T09:28:45-04:00

I am not able to understand what are arguments required to run this on Master server !

root@Inksedge-DB-01:/usr/lib/nagios/plugins# ./check_mysql_replication -H 172.31.10.159
./check_mysql_replication: line 1: syntax error near unexpected token newline' ./check_mysql_replication: line 1: '
root@Inksedge-DB-01:/usr/lib/nagios/plugins# ./check_mysql_replication
./check_mysql_replication: line 1: syntax error near unexpected token newline' ./check_mysql_replication: line 1: '

@phinjensen
Copy link
Contributor Author

original author: Ashish Karpe
date: 2015-06-05T09:30:39-04:00

Hi I am also facing same error Unable to read output

On Nagios Server :

/usr/local/nagios/libexec/check_nrpe -H Master-ip -t 30 -c check_mysql_replication

NRPE: Unable to read output

On Master DB Server :

cat /etc/nagios/nrpe.cfg

command[check_mysql_replication]=sudo /usr/lib/nagios/plugins/check_mysql_replication

cat /etc/sudoers

nagios ALL= NOPASSWD: /usr/lib/nagios/plugins/check_mysql_replication

please help what is wrong here !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant