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

pmp-check-mysql-status fails if a status variable contains a space #109

Open
mcgoldrickm opened this issue Feb 6, 2020 · 0 comments
Open

Comments

@mcgoldrickm
Copy link

mcgoldrickm commented Feb 6, 2020

To test, run pmp-check-mysql-status against a status variable containing a space:

Variable_name: wsrep_provider_vendor
        Value: Codership Oy `<[email protected]>
-bash-4.2$ /usr/lib64/nagios/plugins/pmp-check-mysql-status -x wsrep_provider_vendor -C '!=' -T str -w Synced
awk: cmd. line:8:             if ( Codership Oy <[email protected]> != 0 ) {
awk: cmd. line:8:                                     ^ syntax error
awk: cmd. line:19:             if ( Codership Oy <[email protected]> != Synced ) {
awk: cmd. line:19:                                     ^ syntax error

fix is to add escaped quotes around ${VAR} in awk sections:

-bash-4.2$ diff -u /usr/lib64/nagios/plugins/pmp-check-mysql-status ./pmp-check-mysql-status
--- /usr/lib64/nagios/plugins/pmp-check-mysql-status    2016-12-09 18:22:03.000000000 +0000
+++ ./pmp-check-mysql-status    2020-02-06 09:40:15.643168709 +0000
@@ -172,7 +172,7 @@
                exit $STATE_CRITICAL
             }
          } else {
-            if ( ${VAR} ${CMP} ${CRIT:-0} ) {
+            if ( \"${VAR}\" ${CMP} \"${CRIT:-0}\" ) {
                exit $STATE_CRITICAL
             }
          }
@@ -183,7 +183,7 @@
                exit $STATE_WARNING
             }
          } else {
-            if ( ${VAR} ${CMP} ${WARN:-0} ) {
+            if ( \"${VAR}\" ${CMP} \"${WARN:-0}\" ) {
                exit $STATE_WARNING
             }
          }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant