Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Can't specify database with pmp-check-mysql-replication-delay #17

Open
muffl0n opened this issue Apr 25, 2016 · 2 comments · May be fixed by #84
Open

Can't specify database with pmp-check-mysql-replication-delay #17

muffl0n opened this issue Apr 25, 2016 · 2 comments · May be fixed by #84

Comments

@muffl0n
Copy link

muffl0n commented Apr 25, 2016

With pt-heartbeat I am writing entries to the table "heartbeat" in the database "heartbeat" on our master server:

pt-heartbeat -D heartbeat -h mysql-master -u root -pbar --update --create-table

When trying to use pmp-check-mysql-replication-delay on the slave to check the delay I have trouble reading those values:

# /usr/lib64/nagios/plugins/pmp-check-mysql-replication-delay -H mysql-slave -l root -p bar -T heartbeat.heartbeat
/usr/lib64/nagios/plugins/pmp-check-mysql-replication-delay: 71: [: unexpected operator
Warning: Using a password on the command line interface can be insecure.
CRIT 4286 seconds of replication delay | replication_delay=4286;300;600;0;

The value I get is correct, but the error message confuses me.

Snippet from pmp-check-mysql-replication-delay:

     64    # Get replication delay from a heartbeat table or from SHOW SLAVE STATUS.
     65    if [ "${OPT_TABLE}" ]; then
     66       if [ -z "${OPT_UTC}" ]; then
     67          NOW_FUNC='UNIX_TIMESTAMP()'
     68       else
     69          NOW_FUNC='UNIX_TIMESTAMP(UTC_TIMESTAMP)'
     70       fi
     71       if [ "${OPT_SRVID}" == "MASTER" ]; then

Only specifying the table does not work either:

# /usr/lib64/nagios/plugins/pmp-check-mysql-replication-delay -H mysql-slave -l root -p bar -T heartbeat
/usr/lib64/nagios/plugins/pmp-check-mysql-replication-delay: 71: [: unexpected operator
Warning: Using a password on the command line interface can be insecure.
ERROR 1046 (3D000) at line 1: No database selected
UNK could not determine replication delay

I'm using the latest version:

# /usr/lib64/nagios/plugins/pmp-check-mysql-replication-delay --version
Percona Monitoring Plugins pmp-check-mysql-replication-delay 1.1.6
@muffl0n
Copy link
Author

muffl0n commented May 30, 2016

I found that when I run "pmp-check-mysql-replication-delay" with "bash" instead of "sh" (like the shebang defines) everything works just fine:

# /bin/bash /usr/lib64/nagios/plugins/pmp-check-mysql-replication-delay -H mysql-slave -l root -p bar -T heartbeat.heartbeat
Warning: Using a password on the command line interface can be insecure.
CRIT 2371 seconds of replication delay | replication_delay=2371;300;600;0;

@grypyrg
Copy link

grypyrg commented Jul 6, 2017

Fix pending in #36

@meineerde meineerde linked a pull request Feb 14, 2018 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants