percona-monitoring-plugins
percona-monitoring-plugins copied to clipboard
Can't specify database with pmp-check-mysql-replication-delay
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
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;
Fix pending in #36