git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t
diff options
context:
space:
mode:
authormail_redacted_for_web 2019-04-17 19:07:19 +0200
committermail_redacted_for_web 2019-04-17 19:07:19 +0200
commit1e2387474a449452b78520b9ad96a8b4b5e99722 (patch)
tree836889471eec7d2aac177405068e2a8f1e2b1978 /nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t
downloadnagios-plugins-contrib-1e2387474a449452b78520b9ad96a8b4b5e99722.tar.bz2
initial commit of source fetch
Diffstat (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t')
-rwxr-xr-xnagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.am21
-rw-r--r--nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.in412
-rwxr-xr-xnagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/check_mysql_health.t159
3 files changed, 592 insertions, 0 deletions
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.am b/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.am
new file mode 100755
index 0000000..07ee9c9
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.am
@@ -0,0 +1,21 @@
+##
+## Process this file with automake to produce Makefile.in
+##
+
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+#all: tests
+
+TEST_VERBOSE=0
+TEST_TYPE=test_$(LINKTYPE)
+TEST_FILE = test.pl
+TEST_FILES = *.t
+TESTDB_SW = -d
+
+#EXTRA_DIST = *.t bin var etc
+EXTRA_DIST = *.t
+
+tests:
+ $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE))" $(TEST_FILES)
+# PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
+
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.in b/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.in
new file mode 100644
index 0000000..f8d6f4e
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/Makefile.in
@@ -0,0 +1,412 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = t
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+depcomp =
+am__depfiles_maybe =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CAT = @CAT@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+GREP = @GREP@
+GZIP = @GZIP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_OPTS = @INSTALL_OPTS@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MYMODULES_DIR = @MYMODULES_DIR@
+MYMODULES_DYN_DIR = @MYMODULES_DYN_DIR@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+RELEASE = @RELEASE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SH = @SH@
+SHELL = @SHELL@
+STATEFILES_DIR = @STATEFILES_DIR@
+STRIP = @STRIP@
+SUPPORT = @SUPPORT@
+VERSION = @VERSION@
+WARRANTY = @WARRANTY@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+with_nagios_group = @with_nagios_group@
+with_nagios_user = @with_nagios_user@
+AUTOMAKE_OPTIONS = 1.3 no-dependencies
+
+#all: tests
+TEST_VERBOSE = 0
+TEST_TYPE = test_$(LINKTYPE)
+TEST_FILE = test.pl
+TEST_FILES = *.t
+TESTDB_SW = -d
+
+#EXTRA_DIST = *.t bin var etc
+EXTRA_DIST = *.t
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu t/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu t/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
+ ctags-am distclean distclean-generic distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags-am uninstall uninstall-am
+
+
+tests:
+ $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE))" $(TEST_FILES)
+# PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/check_mysql_health.t b/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/check_mysql_health.t
new file mode 100755
index 0000000..0a5286f
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_mysql_health/check_mysql_health-2.2.2/t/check_mysql_health.t
@@ -0,0 +1,159 @@
+#! /usr/bin/perl -w -I ..
+#
+# MySQL Database Server Tests via check_mysql_healthdb
+#
+#
+# These are the database permissions required for this test:
+# GRANT SELECT ON $db.* TO $user@$host INDENTIFIED BY '$password';
+# GRANT SUPER, REPLICATION CLIENT ON *.* TO $user@$host;
+# Check with:
+# mysql -u$user -p$password -h$host $db
+
+use strict;
+use Test::More;
+use NPTest;
+
+use vars qw($tests);
+
+plan skip_all => "check_mysql_health not compiled" unless (-x "./check_mysql_health");
+
+plan tests => 51;
+
+my $bad_login_output = '/Access denied for user /';
+my $mysqlserver = getTestParameter(
+ "NP_MYSQL_SERVER",
+ "A MySQL Server with no slaves setup"
+ );
+my $mysql_login_details = getTestParameter(
+ "MYSQL_LOGIN_DETAILS",
+ "Command line parameters to specify login access",
+ "-u user -ppw -d db",
+ );
+my $with_slave = getTestParameter(
+ "NP_MYSQL_WITH_SLAVE",
+ "MySQL server with slaves setup"
+ );
+my $with_slave_login = getTestParameter(
+ "NP_MYSQL_WITH_SLAVE_LOGIN",
+ "Login details for server with slave",
+ "-uroot -ppw"
+ );
+
+my $result;
+SKIP: {
+ $result = NPTest->testCmd("./check_mysql_health -V");
+ cmp_ok( $result->return_code, '==', 0, "expected result");
+ like( $result->output, "/check_mysql_health \\(\\d+\\.\\d+\\)/", "Expected message");
+
+ $result = NPTest->testCmd("./check_mysql_health --help");
+ cmp_ok( $result->return_code, '==', 0, "expected result");
+ like( $result->output, "/slave-lag/", "Expected message");
+ like( $result->output, "/slave-io-running/", "Expected message");
+ like( $result->output, "/slave-sql-running/", "Expected message");
+ like( $result->output, "/threads-connected/", "Expected message");
+ like( $result->output, "/threadcache-hitrate/", "Expected message");
+ like( $result->output, "/querycache-hitrate/", "Expected message");
+ like( $result->output, "/keycache-hitrate/", "Expected message");
+ like( $result->output, "/bufferpool-hitrate/", "Expected message");
+ like( $result->output, "/tablecache-hitrate/", "Expected message");
+ like( $result->output, "/table-lock-contention/", "Expected message");
+ like( $result->output, "/temp-disk-tables/", "Expected message");
+ like( $result->output, "/connection-time/", "Expected message");
+ like( $result->output, "/slow-queries/", "Expected message");
+ like( $result->output, "/qcache-lowmem-prunes/", "Expected message");
+ like( $result->output, "/bufferpool-wait-free/", "Expected message");
+ like( $result->output, "/log-waits/", "Expected message");
+
+}
+
+SKIP: {
+ $result = NPTest->testCmd("./check_mysql_health -H $mysqlserver -m connection-time -u dummy -pdummy");
+ cmp_ok( $result->return_code, '==', 2, "Login failure");
+ like( $result->output, "/CRITICAL - Cannot connect to database: Error: Access denied/", "Expected login failure message");
+
+ $result = NPTest->testCmd("./check_mysql_health");
+ cmp_ok( $result->return_code, "==", 3, "No mode defined" );
+ like( $result->output, "/Must specify a mode/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m connection-time -w 10 -c 30");
+ cmp_ok( $result->return_code, "==", 0, "Connected" );
+ like( $result->output, "/OK - Connection Time ([0-9\.]+) usecs|connection_time=([0-9\.]+);10;30/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m keycache-hitrate -w :10 -c 2");
+ cmp_ok( $result->return_code, "==", 2, "Connected" );
+ like( $result->output, "/CRITICAL - Key Cache Hitrate at ([0-9\.]+)%|keycache_hitrate=([0-9\.]+)%;:10;2/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m qcache-hitrate -w :10 -c 2");
+ cmp_ok( $result->return_code, "==", 2, "Connected" );
+ like( $result->output, "/CRITICAL - Query Cache Hitrate at ([0-9\.]+)%|qcache_hitrate=([0-9\.]+)%;:10;2/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m qcache-hitrate -w :10 -c 2 -v 2>&1");
+ cmp_ok( $result->return_code, "==", 2, "Connected" );
+ like( $result->output, "/NOTICE: we have results/", "Verbose output");
+ like( $result->output, "/CRITICAL - Query Cache Hitrate at ([0-9\.]+)%|qcache_hitrate=([0-9\.]+)%;:10;2/", "Correct error message");
+
+}
+
+SKIP: {
+ my $slow_queries_last = 0;
+ my $slow_queries = 0;
+ my $delta = 0;
+ $result = NPTest->testCmd("./check_mysql_health -m slow-queries -w :10 -c 2");
+ sleep 1;
+ $result = NPTest->testCmd("./check_mysql_health -m slow-queries -w :10 -c 2 -v 2>&1");
+ ok( $result->output =~ /Load variable Slow_queries \(([0-9]+)\) /);
+ $slow_queries_last = $1;
+ ok( $result->output =~ /Result column 1 returns value ([0-9]+) /);
+ $slow_queries = $1;
+ $delta = $slow_queries - $slow_queries_last;
+ ok( $result->output =~ /OK - ([0-9]+) slow queries/);
+ cmp_ok($1, "==", $delta);
+}
+
+SKIP: {
+ # performance data
+ $result = NPTest->testCmd("./check_mysql_health -m slow-queries -w :11 -c :22 -v 2>&1");
+ like( $result->output, "/slow_queries_rate=[0-9\.]+;:11;:22 slow_queries=[0-9]+;:11;:22/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m qcache-lowmem-prunes -w :11 -c :22 -v 2>&1");
+ like( $result->output, "/lowmem_prunes_rate=[0-9\.]+;:11;:22 lowmem_prunes=[0-9]+;:11;:22/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m bufferpool-wait-free -w :11 -c :22 -v 2>&1");
+ like( $result->output, "/bufferpool_free_waits_rate=[0-9\.]+;:11;:22 bufferpool_free_waits=[0-9]+;:11;:22/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m log-waits -w :11 -c :22 -v 2>&1");
+ like( $result->output, "/log_waits_rate=[0-9\.]+;:11;:22 log_waits=[0-9]+;:11;:22/", "Correct error message");
+}
+
+SKIP: {
+ skip "Has a slave server", 6 if $with_slave;
+
+ $result = NPTest->testCmd("./check_mysql_health -m slave-lag");
+ cmp_ok( $result->return_code, "==", 2, "No slave" );
+ like( $result->output, "/CRITICAL - Slave lag NULL|slave_lag=0;10;20/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m slave-io-running");
+ cmp_ok( $result->return_code, "==", 2, "No slave" );
+ like( $result->output, "/CRITICAL - Slave io not running|slave_io_running=0/", "Correct error message");
+
+ $result = NPTest->testCmd("./check_mysql_health -m slave-sql-running");
+ cmp_ok( $result->return_code, "==", 2, "No slave" );
+ like( $result->output, "/CRITICAL - Slave sql not running|slave_io_running=0/", "Correct error message");
+
+}
+
+SKIP: {
+ skip "No mysql server with slaves defined", 5 unless $with_slave;
+ $result = NPTest->testCmd("./check_mysql_health -H $with_slave $with_slave_login");
+ cmp_ok( $result->return_code, '==', 0, "Login okay");
+
+ $result = NPTest->testCmd("./check_mysql_health -S -H $with_slave $with_slave_login");
+ cmp_ok( $result->return_code, "==", 0, "Slaves okay" );
+
+ $result = NPTest->testCmd("./check_mysql_health -S -H $with_slave $with_slave_login -w 60");
+ cmp_ok( $result->return_code, '==', 0, 'Slaves are not > 60 seconds behind');
+
+ $result = NPTest->testCmd("./check_mysql_health -S -H $with_slave $with_slave_login -w 60:");
+ cmp_ok( $result->return_code, '==', 1, 'Alert warning if < 60 seconds behind');
+ like( $result->output, "/^SLOW_SLAVE WARNING:/", "Output okay");
+}