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

Commit 98cbf4c

Browse files
committed
Fixed --login-path option in Nagios scripts when using it along with other credential options.
1 parent 6b39f92 commit 98cbf4c

10 files changed

+60
-40
lines changed

nagios/bin/pmp-check-mysql-deleted-files

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ _pidof() {
108108
# Execute a MySQL command.
109109
# ########################################################################
110110
mysql_exec() {
111-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
112-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
113-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
111+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
112+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
113+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
114+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
115+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
114116
}
115117

116118
# ########################################################################

nagios/bin/pmp-check-mysql-file-privs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ main() {
124124
# Execute a MySQL command.
125125
# ########################################################################
126126
mysql_exec() {
127-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
128-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
129-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
127+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
128+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
129+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
130+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
131+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
130132
}
131133

132134
# ########################################################################
@@ -226,7 +228,7 @@ plugin to skip examining the Unix processlist, log into MySQL, and examine the
226228
datadir variable from SHOW VARIABLES to find the location of the data directory.
227229
228230
In case an user you are calling this plugin from has no permissions to examine
229-
the datadir the plugin raises an unknown with the explanation.
231+
the datadir the plugin raises an unknown with the explanation.
230232
231233
=head1 PRIVILEGES
232234

nagios/bin/pmp-check-mysql-innodb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,11 @@ main() {
163163
# Execute a MySQL command.
164164
# ########################################################################
165165
mysql_exec() {
166-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
167-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
168-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
166+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
167+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
168+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
169+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
170+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
169171
}
170172

171173
# ########################################################################
@@ -339,7 +341,7 @@ C<SELECT> against the C<INFORMATION_SCHEMA> InnoDB transaction and lock tables.
339341
340342
=back
341343
342-
This plugin executes no UNIX commands that may need special privileges.
344+
This plugin executes no UNIX commands that may need special privileges.
343345
344346
=head1 COPYRIGHT, LICENSE, AND WARRANTY
345347

nagios/bin/pmp-check-mysql-pidfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ main() {
119119
# Execute a MySQL command.
120120
# ########################################################################
121121
mysql_exec() {
122-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
123-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
124-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
122+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
123+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
124+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
125+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
126+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
125127
}
126128

127129
# ########################################################################

nagios/bin/pmp-check-mysql-processlist

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ max() {
171171
# Execute a MySQL command.
172172
# ########################################################################
173173
mysql_exec() {
174-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
175-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
176-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
174+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
175+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
176+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
177+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
178+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
177179
}
178180

179181
# ########################################################################
@@ -295,7 +297,7 @@ C<SELECT @@max_user_connections;>
295297
296298
=back
297299
298-
This plugin executes no UNIX commands that may need special privileges.
300+
This plugin executes no UNIX commands that may need special privileges.
299301
300302
=head1 COPYRIGHT, LICENSE, AND WARRANTY
301303

nagios/bin/pmp-check-mysql-replication-delay

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ main() {
115115
# Execute a MySQL command.
116116
# ########################################################################
117117
mysql_exec() {
118-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
119-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
120-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
118+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
119+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
120+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
121+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
122+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
121123
}
122124

123125
# ########################################################################

nagios/bin/pmp-check-mysql-replication-running

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ main() {
113113
# Execute a MySQL command.
114114
# ########################################################################
115115
mysql_exec() {
116-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
117-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
118-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
116+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
117+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
118+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
119+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
120+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
119121
}
120122

121123
# ########################################################################

nagios/bin/pmp-check-mysql-status

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ main() {
148148
# Execute a MySQL command.
149149
# ########################################################################
150150
mysql_exec() {
151-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
152-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
153-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
151+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
152+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
153+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
154+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
155+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
154156
}
155157

156158
# ########################################################################
@@ -454,7 +456,7 @@ C<SHOW VARIABLES>.
454456
455457
=back
456458
457-
This plugin executes no UNIX commands that may need special privileges.
459+
This plugin executes no UNIX commands that may need special privileges.
458460
459461
=head1 COPYRIGHT, LICENSE, AND WARRANTY
460462

nagios/bin/pmp-check-mysql-ts-count

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ main() {
6161
exit 1
6262
fi
6363
fi
64-
if [ "${OPT_TARGET}" == "kills" ]; then
64+
if [ "${OPT_TARGET}" == "kills" ]; then
6565
OPT_TABLE="${OPT_TABLE:-percona.kill_log}"
6666
OPT_TIMESTAMP="${OPT_TIMESTAMP:-timestamp}"
6767
elif [ "${OPT_TARGET}" == "fkerrors" ]; then
@@ -96,9 +96,11 @@ main() {
9696
# Execute a MySQL command.
9797
# ########################################################################
9898
mysql_exec() {
99-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
100-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
101-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
99+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
100+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
101+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
102+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
103+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
102104
}
103105

104106
# ########################################################################
@@ -162,9 +164,9 @@ pmp-check-mysql-ts-count - Generic alert based on pmp-check-mysql-deadlocks to c
162164
163165
=head1 DESCRIPTION
164166
165-
This Nagios plugin looks at a table and counts the number of rows since the
166-
last interval, and alerts if this exceeds the threshold. This could be the
167-
table referenced by pt-deadlock-logger, pt-kill, pt-fk-error-logger, or a
167+
This Nagios plugin looks at a table and counts the number of rows since the
168+
last interval, and alerts if this exceeds the threshold. This could be the
169+
table referenced by pt-deadlock-logger, pt-kill, pt-fk-error-logger, or a
168170
custom table supplied.
169171
Default behaviour is the same as pmp-check-mysql-deadlocks, can also specify
170172
target to be C<kills> or C<fkerrors> to monitor default tables created by pt-kill
@@ -182,7 +184,7 @@ C<SELECT> from the supplied table.
182184
183185
=back
184186
185-
This plugin executes no UNIX commands that may need special privileges.
187+
This plugin executes no UNIX commands that may need special privileges.
186188
187189
=head1 COPYRIGHT, LICENSE, AND WARRANTY
188190

nagios/bin/pmp-check-pt-table-checksum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ main() {
9999
# Execute a MySQL command.
100100
# ########################################################################
101101
mysql_exec() {
102-
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} ${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_USER:+-u"${OPT_USER}"} \
103-
${OPT_PASS:+-p"${OPT_PASS}"} ${OPT_SOCK:+-S"${OPT_SOCK}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
104-
${OPT_LOPA:+--login-path="${OPT_LOPA}"} -ss -e "$1"
102+
mysql ${OPT_DEFT:+--defaults-file="${OPT_DEFT}"} \
103+
${OPT_LOPA:+--login-path="${OPT_LOPA}"} \
104+
${OPT_HOST:+-h"${OPT_HOST}"} ${OPT_PORT:+-P"${OPT_PORT}"} \
105+
${OPT_USER:+-u"${OPT_USER}"} ${OPT_PASS:+-p"${OPT_PASS}"} \
106+
${OPT_SOCK:+-S"${OPT_SOCK}"} -ss -e "$1"
105107
}
106108

107109
# ########################################################################
@@ -211,7 +213,7 @@ C<SELECT> against the specified table.
211213
212214
=back
213215
214-
This plugin executes no UNIX commands that may need special privileges.
216+
This plugin executes no UNIX commands that may need special privileges.
215217
216218
=head1 COPYRIGHT, LICENSE, AND WARRANTY
217219

0 commit comments

Comments
 (0)