From 7677e97c7d20a4ecc64bb007a574fc2ded6e619b Mon Sep 17 00:00:00 2001 From: "Bjarni R. Einarsson" Date: Tue, 27 Sep 2011 15:17:46 +0000 Subject: [PATCH] Cleanup --- .../src/check_mssql_health-1.5.8.2/Makefile | 575 --- .../src/check_mssql_health-1.5.8.2/config.log | 244 -- .../check_mssql_health-1.5.8.2/config.status | 753 ---- .../plugins-scripts/Makefile | 358 -- .../plugins-scripts/check_mssql_health | 3664 ----------------- .../plugins-scripts/subst | 61 - .../src/check_mssql_health-1.5.8.2/t/Makefile | 297 -- 7 files changed, 5952 deletions(-) delete mode 100644 check_mssql_health/src/check_mssql_health-1.5.8.2/Makefile delete mode 100644 check_mssql_health/src/check_mssql_health-1.5.8.2/config.log delete mode 100755 check_mssql_health/src/check_mssql_health-1.5.8.2/config.status delete mode 100644 check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/Makefile delete mode 100755 check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/check_mssql_health delete mode 100644 check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/subst delete mode 100644 check_mssql_health/src/check_mssql_health-1.5.8.2/t/Makefile diff --git a/check_mssql_health/src/check_mssql_health-1.5.8.2/Makefile b/check_mssql_health/src/check_mssql_health-1.5.8.2/Makefile deleted file mode 100644 index 1fb2570..0000000 --- a/check_mssql_health/src/check_mssql_health-1.5.8.2/Makefile +++ /dev/null @@ -1,575 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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. - - - -# find . \( -type d -and -name .svn -and -prune \) -or -type f -exec fromdos -v {} \; -srcdir = . -top_srcdir = . - -pkgdatadir = $(datadir)/check_mssql_health -pkglibdir = $(libdir)/check_mssql_health -pkgincludedir = $(includedir)/check_mssql_health -top_builddir = . -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 = x86_64-unknown-linux-gnu -host_triplet = x86_64-unknown-linux-gnu -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ - ChangeLog INSTALL NEWS TODO config.guess config.sub install-sh \ - missing -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -INSTALL = /usr/bin/install -c -ACLOCAL = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run aclocal-1.9 -AMTAR = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run tar -AUTOCONF = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoconf -AUTOHEADER = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoheader -AUTOMAKE = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run automake-1.9 -AWK = /usr/bin/gawk -CAT = /bin/cat -CYGPATH_W = echo -DEFS = -DPACKAGE_NAME=\"check_mssql_health\" -DPACKAGE_TARNAME=\"check_mssql_health\" -DPACKAGE_VERSION=\"1.5.8.2\" -DPACKAGE_STRING=\"check_mssql_health\ 1.5.8.2\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"check_mssql_health\" -DVERSION=\"1.5.8.2\" -ECHO = /bin/echo -ECHO_C = -ECHO_N = -n -ECHO_T = -GREP = /bin/grep -GZIP = /bin/gzip -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_OPTS = -o nagios -g nagios -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -LIBOBJS = -LIBS = -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run makeinfo -MYMODULES_DIR = /usr/local/nagios/libexec -MYMODULES_DYN_DIR = /usr/local/nagios/libexec -PACKAGE = check_mssql_health -PACKAGE_BUGREPORT = -PACKAGE_NAME = check_mssql_health -PACKAGE_STRING = check_mssql_health 1.5.8.2 -PACKAGE_TARNAME = check_mssql_health -PACKAGE_VERSION = 1.5.8.2 -PATH_SEPARATOR = : -PERL = /usr/bin/perl -RELEASE = 1 -SED = /bin/sed -SET_MAKE = -SH = /bin/sh -SHELL = /bin/bash -STATEFILES_DIR = /var/tmp/check_mssql_health -STRIP = -SUPPORT = Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n -VERSION = 1.5.8.2 -WARRANTY = This plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugin under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n -ac_ct_STRIP = -am__leading_dot = . -am__tar = tar --format=posix -chf - "$$tardir" -am__untar = tar -xf - -bindir = ${exec_prefix}/bin -build = x86_64-unknown-linux-gnu -build_alias = -build_cpu = x86_64 -build_os = linux-gnu -build_vendor = unknown -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = x86_64-unknown-linux-gnu -host_alias = -host_cpu = x86_64 -host_os = linux-gnu -host_vendor = unknown -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /usr/local/nagios -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -with_nagios_group = nagios -with_nagios_user = nagios -SUBDIRS = plugins-scripts t -EXTRA_DIST = contrib -all: all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ - cd $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/plugins-scripts - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -find $(distdir) -type d ! -perm -755 -exec chmod a+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-recursive distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-info-am - - -dist-hook: - rm -f t/var/tmp/* - rm -f t/var/adm/* - find $(distdir) -depth -name .svn -exec rm -rf {} \; - find $(distdir) -type f -exec fromdos -v {} \; - make -# 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/check_mssql_health/src/check_mssql_health-1.5.8.2/config.log b/check_mssql_health/src/check_mssql_health-1.5.8.2/config.log deleted file mode 100644 index 99a7472..0000000 --- a/check_mssql_health/src/check_mssql_health-1.5.8.2/config.log +++ /dev/null @@ -1,244 +0,0 @@ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by check_mssql_health configure 1.5.8.2, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ ./configure - -## --------- ## -## Platform. ## -## --------- ## - -hostname = darkstar -uname -m = x86_64 -uname -r = 2.6.38-8-generic -uname -s = Linux -uname -v = #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 - -/usr/bin/uname -p = unknown -/bin/uname -X = unknown - -/bin/arch = unknown -/usr/bin/arch -k = unknown -/usr/convex/getsysinfo = unknown -hostinfo = unknown -/bin/machine = unknown -/usr/bin/oslevel = unknown -/bin/universe = unknown - -PATH: /usr/local/sbin -PATH: /usr/local/bin -PATH: /usr/sbin -PATH: /usr/bin -PATH: /sbin -PATH: /bin -PATH: /usr/games - - -## ----------- ## -## Core tests. ## -## ----------- ## - -configure:1289: checking for a BSD-compatible install -configure:1344: result: /usr/bin/install -c -configure:1355: checking whether build environment is sane -configure:1398: result: yes -configure:1463: checking for gawk -configure:1479: found /usr/bin/gawk -configure:1489: result: gawk -configure:1499: checking whether make sets $(MAKE) -configure:1519: result: yes -configure:1682: checking how to create a pax tar archive -configure:1695: tar --version -tar (GNU tar) 1.25 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+: GNU GPL version 3 or later . -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by John Gilmore and Jay Fenlason. -configure:1698: $? = 0 -configure:1738: tardir=conftest.dir && eval tar --format=posix -chf - "$tardir" >conftest.tar -configure:1741: $? = 0 -configure:1745: tar -xf - /dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by check_mssql_health $as_me 1.5.8.2, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -config_files=" Makefile plugins-scripts/Makefile plugins-scripts/subst t/Makefile" - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to ." -ac_cs_version="\ -check_mssql_health config.status 1.5.8.2 -configured by ./configure, generated by GNU Autoconf 2.59, - with options \"\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=. -INSTALL="/usr/bin/install -c" -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -if $ac_cs_recheck; then - echo "running /bin/bash ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 - exec /bin/bash ./configure $ac_configure_extra_args --no-create --no-recursion -fi - -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "plugins-scripts/Makefile" ) CONFIG_FILES="$CONFIG_FILES plugins-scripts/Makefile" ;; - "plugins-scripts/subst" ) CONFIG_FILES="$CONFIG_FILES plugins-scripts/subst" ;; - "t/Makefile" ) CONFIG_FILES="$CONFIG_FILES t/Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF -s,@SHELL@,/bin/bash,;t t -s,@PATH_SEPARATOR@,:,;t t -s,@PACKAGE_NAME@,check_mssql_health,;t t -s,@PACKAGE_TARNAME@,check_mssql_health,;t t -s,@PACKAGE_VERSION@,1.5.8.2,;t t -s,@PACKAGE_STRING@,check_mssql_health 1.5.8.2,;t t -s,@PACKAGE_BUGREPORT@,,;t t -s,@exec_prefix@,${prefix},;t t -s,@prefix@,/usr/local/nagios,;t t -s,@program_transform_name@,s,x,x,,;t t -s,@bindir@,${exec_prefix}/bin,;t t -s,@sbindir@,${exec_prefix}/sbin,;t t -s,@libexecdir@,${exec_prefix}/libexec,;t t -s,@datadir@,${prefix}/share,;t t -s,@sysconfdir@,${prefix}/etc,;t t -s,@sharedstatedir@,${prefix}/com,;t t -s,@localstatedir@,${prefix}/var,;t t -s,@libdir@,${exec_prefix}/lib,;t t -s,@includedir@,${prefix}/include,;t t -s,@oldincludedir@,/usr/include,;t t -s,@infodir@,${prefix}/info,;t t -s,@mandir@,${prefix}/man,;t t -s,@build_alias@,,;t t -s,@host_alias@,,;t t -s,@target_alias@,,;t t -s,@DEFS@,-DPACKAGE_NAME=\"check_mssql_health\" -DPACKAGE_TARNAME=\"check_mssql_health\" -DPACKAGE_VERSION=\"1.5.8.2\" -DPACKAGE_STRING=\"check_mssql_health\ 1.5.8.2\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"check_mssql_health\" -DVERSION=\"1.5.8.2\" ,;t t -s,@ECHO_C@,,;t t -s,@ECHO_N@,-n,;t t -s,@ECHO_T@,,;t t -s,@LIBS@,,;t t -s,@INSTALL_PROGRAM@,${INSTALL},;t t -s,@INSTALL_SCRIPT@,${INSTALL},;t t -s,@INSTALL_DATA@,${INSTALL} -m 644,;t t -s,@CYGPATH_W@,echo,;t t -s,@PACKAGE@,check_mssql_health,;t t -s,@VERSION@,1.5.8.2,;t t -s,@ACLOCAL@,${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run aclocal-1.9,;t t -s,@AUTOCONF@,${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoconf,;t t -s,@AUTOMAKE@,${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run automake-1.9,;t t -s,@AUTOHEADER@,${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoheader,;t t -s,@MAKEINFO@,${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run makeinfo,;t t -s,@install_sh@,/home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/install-sh,;t t -s,@STRIP@,,;t t -s,@ac_ct_STRIP@,,;t t -s,@INSTALL_STRIP_PROGRAM@,${SHELL} $(install_sh) -c -s,;t t -s,@mkdir_p@,mkdir -p --,;t t -s,@AWK@,/usr/bin/gawk,;t t -s,@SET_MAKE@,,;t t -s,@am__leading_dot@,.,;t t -s,@AMTAR@,${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run tar,;t t -s,@am__tar@,tar --format=posix -chf - "$$tardir",;t t -s,@am__untar@,tar -xf -,;t t -s,@build@,x86_64-unknown-linux-gnu,;t t -s,@build_cpu@,x86_64,;t t -s,@build_vendor@,unknown,;t t -s,@build_os@,linux-gnu,;t t -s,@host@,x86_64-unknown-linux-gnu,;t t -s,@host_cpu@,x86_64,;t t -s,@host_vendor@,unknown,;t t -s,@host_os@,linux-gnu,;t t -s,@RELEASE@,1,;t t -s,@INSTALL@,/usr/bin/install -c,;t t -s,@WARRANTY@,This plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugin under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n,;t t -s,@SUPPORT@,Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n,;t t -s,@with_nagios_user@,nagios,;t t -s,@with_nagios_group@,nagios,;t t -s,@INSTALL_OPTS@,-o nagios -g nagios,;t t -s,@STATEFILES_DIR@,/var/tmp/check_mssql_health,;t t -s,@MYMODULES_DIR@,/usr/local/nagios/libexec,;t t -s,@MYMODULES_DYN_DIR@,/usr/local/nagios/libexec,;t t -s,@SH@,/bin/sh,;t t -s,@PERL@,/usr/bin/perl,;t t -s,@GZIP@,/bin/gzip,;t t -s,@GREP@,/bin/grep,;t t -s,@ECHO@,/bin/echo,;t t -s,@SED@,/bin/sed,;t t -s,@CAT@,/bin/cat,;t t -s,@LIBOBJS@,,;t t -s,@LTLIBOBJS@,,;t t -CEOF - - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - sed "/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -} - -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done - -{ (exit 0); exit 0; } diff --git a/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/Makefile b/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/Makefile deleted file mode 100644 index 21d99f7..0000000 --- a/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/Makefile +++ /dev/null @@ -1,358 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# plugins-scripts/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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. - - - -srcdir = . -top_srcdir = .. -pkgdatadir = $(datadir)/check_mssql_health -pkglibdir = $(libdir)/check_mssql_health -pkgincludedir = $(includedir)/check_mssql_health -top_builddir = .. -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 = x86_64-unknown-linux-gnu -host_triplet = x86_64-unknown-linux-gnu -subdir = plugins-scripts -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/subst.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = subst -am__installdirs = "$(DESTDIR)$(libexecdir)" -libexecSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(libexec_SCRIPTS) -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -VPATH = $(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t -INSTALL = /usr/bin/install -c -ACLOCAL = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run aclocal-1.9 -AMTAR = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run tar -AUTOCONF = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoconf -AUTOHEADER = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoheader -AUTOMAKE = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run automake-1.9 -AWK = /usr/bin/gawk -CAT = /bin/cat -CYGPATH_W = echo -DEFS = -DPACKAGE_NAME=\"check_mssql_health\" -DPACKAGE_TARNAME=\"check_mssql_health\" -DPACKAGE_VERSION=\"1.5.8.2\" -DPACKAGE_STRING=\"check_mssql_health\ 1.5.8.2\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"check_mssql_health\" -DVERSION=\"1.5.8.2\" -ECHO = /bin/echo -ECHO_C = -ECHO_N = -n -ECHO_T = -GREP = /bin/grep -GZIP = /bin/gzip -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_OPTS = -o nagios -g nagios -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -LIBOBJS = -LIBS = -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run makeinfo -MYMODULES_DIR = /usr/local/nagios/libexec -MYMODULES_DYN_DIR = /usr/local/nagios/libexec -PACKAGE = check_mssql_health -PACKAGE_BUGREPORT = -PACKAGE_NAME = check_mssql_health -PACKAGE_STRING = check_mssql_health 1.5.8.2 -PACKAGE_TARNAME = check_mssql_health -PACKAGE_VERSION = 1.5.8.2 -PATH_SEPARATOR = : -PERL = /usr/bin/perl -RELEASE = 1 -SED = /bin/sed -SET_MAKE = -SH = /bin/sh -SHELL = /bin/bash -STATEFILES_DIR = /var/tmp/check_mssql_health -STRIP = -SUPPORT = Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n -VERSION = 1.5.8.2 -WARRANTY = This plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugin under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n -ac_ct_STRIP = -am__leading_dot = . -am__tar = tar --format=posix -chf - "$$tardir" -am__untar = tar -xf - -bindir = ${exec_prefix}/bin -build = x86_64-unknown-linux-gnu -build_alias = -build_cpu = x86_64 -build_os = linux-gnu -build_vendor = unknown -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = x86_64-unknown-linux-gnu -host_alias = -host_cpu = x86_64 -host_os = linux-gnu -host_vendor = unknown -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /usr/local/nagios -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -with_nagios_group = nagios -with_nagios_user = nagios -SUFFIXES = .pl .pm .sh -libexec_SCRIPTS = check_mssql_health -MY_MODULES = -EXTRA_MODULES = \ - Nagios/DBD/MSSQL/Server/Memorypool.pm \ - Nagios/DBD/MSSQL/Server/Database/Datafile.pm \ - Nagios/DBD/MSSQL/Server/Database.pm \ - Nagios/DBD/MSSQL/Server.pm \ - Nagios/Extraopts.pm - -EXTRA_DIST = check_mssql_health.pl $(EXTRA_MODULES) -CLEANFILES = $(libexec_SCRIPTS) -AM_INSTALL_PROGRAM_FLAGS = -o nagios -g nagios -all: all-am - -.SUFFIXES: -.SUFFIXES: .pl .pm .sh -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins-scripts/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu plugins-scripts/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: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -subst: $(top_builddir)/config.status $(srcdir)/subst.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libexecSCRIPTS: $(libexec_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(libexecdir)" || $(mkdir_p) "$(DESTDIR)$(libexecdir)" - @list='$(libexec_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(libexecSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(libexecdir)/$$f'"; \ - $(libexecSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(libexecdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libexecSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(libexec_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(libexecdir)/$$f'"; \ - rm -f "$(DESTDIR)$(libexecdir)/$$f"; \ - done -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/Nagios $(distdir)/Nagios/DBD/MSSQL $(distdir)/Nagios/DBD/MSSQL/Server $(distdir)/Nagios/DBD/MSSQL/Server/Database - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$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 $(SCRIPTS) -installdirs: - for dir in "$(DESTDIR)$(libexecdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -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: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-libexecSCRIPTS - -install-info: install-info-am - -install-man: - -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: uninstall-info-am uninstall-libexecSCRIPTS - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am \ - install-libexecSCRIPTS install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \ - uninstall-libexecSCRIPTS - - -.pm : - $(AWK) -f ./subst $< > $@ - chmod +x $@ - -.pl : - $(AWK) -f ./subst $< > $@ - chmod +x $@ - -.sh : - $(AWK) -f ./subst $< > $@ - chmod +x $@ - -$(libexec_SCRIPTS) : $(EXTRA_DIST) - $(ECHO) "#! #PERL# -w" | $(AWK) -f ./subst > $@ -#since 1.5.1 $(ECHO) "# nagios: -epn" >> $@ - $(ECHO) >> $@ - $(ECHO) "my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );" >> $@ - $(ECHO) "my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );" >> $@ - for m in ${EXTRA_MODULES}; do \ - $(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \ - done - if [ -d "${MYMODULES_DIR}" ]; then \ - for m in ${MYMODULES_DIR}/CheckMSSQLHealthExt*.pm; do \ - if [ -f $$m ]; then \ - $(ECHO) found $$m; \ - $(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \ - fi \ - done \ - fi - $(CAT) check_mssql_health.pl | $(GREP) -v "^use Nagios" | $(GREP) -v "^my %ERROR" | $(AWK) -f ./subst >> $@ - chmod +x $@ -# 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/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/check_mssql_health b/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/check_mssql_health deleted file mode 100755 index a38442e..0000000 --- a/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/check_mssql_health +++ /dev/null @@ -1,3664 +0,0 @@ -#! /usr/bin/perl -w - -my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 ); -my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' ); -package DBD::MSSQL::Server::Memorypool; - -use strict; - -our @ISA = qw(DBD::MSSQL::Server); - - -sub new { - my $class = shift; - my %params = @_; - my $self = { - handle => $params{handle}, - buffercache => undef, - procedurecache => undef, - locks => [], - }; - bless $self, $class; - $self->init(%params); - return $self; -} - -sub init { - my $self = shift; - my %params = @_; - $self->init_nagios(); - if ($params{mode} =~ /server::memorypool::buffercache/) { - $self->{buffercache} = DBD::MSSQL::Server::Memorypool::BufferCache->new( - %params); - } elsif ($params{mode} =~ /server::memorypool::procedurecache/) { - $self->{procedurecache} = DBD::MSSQL::Server::Memorypool::ProcedureCache->new( - %params); - } elsif ($params{mode} =~ /server::memorypool::lock/) { - DBD::MSSQL::Server::Memorypool::Lock::init_locks(%params); - if (my @locks = DBD::MSSQL::Server::Memorypool::Lock::return_locks()) { - $self->{locks} = \@locks; - } else { - $self->add_nagios_critical("unable to aquire lock info"); - } - } -} - -sub nagios { - my $self = shift; - my %params = @_; - if ($params{mode} =~ /server::memorypool::buffercache/) { - $self->{buffercache}->nagios(%params); - $self->merge_nagios($self->{buffercache}); - } elsif ($params{mode} =~ /^server::memorypool::lock::listlocks/) { - foreach (sort { $a->{name} cmp $b->{name}; } @{$self->{locks}}) { - printf "%s\n", $_->{name}; - } - $self->add_nagios_ok("have fun"); - } elsif ($params{mode} =~ /^server::memorypool::lock/) { - foreach (@{$self->{locks}}) { - $_->nagios(%params); - $self->merge_nagios($_); - } - } -} - - -package DBD::MSSQL::Server::Memorypool::BufferCache; - -use strict; - -our @ISA = qw(DBD::MSSQL::Server::Memorypool); - - -sub new { - my $class = shift; - my %params = @_; - my $self = { - handle => $params{handle}, - hitratio => undef, - warningrange => $params{warningrange}, - criticalrange => $params{criticalrange}, - }; - bless $self, $class; - $self->init(%params); - return $self; -} - -sub init { - my $self = shift; - my %params = @_; - $self->init_nagios(); - if ($params{mode} =~ /server::memorypool::buffercache::hitratio/) { - # -- (a.cntr_value * 1.0 / b.cntr_value) * 100.0 [BufferCacheHitRatio] - $self->{cnt_hitratio} = $self->{handle}->get_perf_counter( - "SQLServer:Buffer Manager", "Buffer cache hit ratio"); - $self->{cnt_hitratio_base} = $self->{handle}->get_perf_counter( - "SQLServer:Buffer Manager", "Buffer cache hit ratio base"); - if (! defined $self->{cnt_hitratio}) { - $self->add_nagios_unknown("unable to aquire buffer cache data"); - } else { - # das kracht weil teilweise negativ - #$self->valdiff(\%params, qw(cnt_hitratio cnt_hitratio_base)); - $self->{hitratio} = ($self->{cnt_hitratio_base} == 0) ? - 100 : $self->{cnt_hitratio} / $self->{cnt_hitratio_base} * 100.0; - # soll vorkommen..... - $self->{hitratio} = 100 if ($self->{hitratio} > 100); - } - } elsif ($params{mode} =~ /server::memorypool::buffercache::lazywrites/) { - $self->{lazy_writes_s} = $self->{handle}->get_perf_counter( - "SQLServer:Buffer Manager", "Lazy writes/sec"); - if (! defined $self->{lazy_writes_s}) { - $self->add_nagios_unknown("unable to aquire buffer manager data"); - } else { - $self->valdiff(\%params, qw(lazy_writes_s)); - $self->{lazy_writes_per_sec} = $self->{delta_lazy_writes_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /server::memorypool::buffercache::pagelifeexpectancy/) { - $self->{pagelifeexpectancy} = $self->{handle}->get_perf_counter( - "SQLServer:Buffer Manager", "Page life expectancy"); - if (! defined $self->{pagelifeexpectancy}) { - $self->add_nagios_unknown("unable to aquire buffer manager data"); - } - } elsif ($params{mode} =~ /server::memorypool::buffercache::freeliststalls/) { - $self->{freeliststalls_s} = $self->{handle}->get_perf_counter( - "SQLServer:Buffer Manager", "Free list stalls/sec"); - if (! defined $self->{freeliststalls_s}) { - $self->add_nagios_unknown("unable to aquire buffer manager data"); - } else { - $self->valdiff(\%params, qw(freeliststalls_s)); - $self->{freeliststalls_per_sec} = $self->{delta_freeliststalls_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /server::memorypool::buffercache::checkpointpages/) { - $self->{checkpointpages_s} = $self->{handle}->get_perf_counter( - "SQLServer:Buffer Manager", "Checkpoint pages/sec"); - if (! defined $self->{checkpointpages_s}) { - $self->add_nagios_unknown("unable to aquire buffer manager data"); - } else { - $self->valdiff(\%params, qw(checkpointpages_s)); - $self->{checkpointpages_per_sec} = $self->{delta_checkpointpages_s} / $self->{delta_timestamp}; - } - } -} - -sub nagios { - my $self = shift; - my %params = @_; - if (! $self->{nagios_level}) { - if ($params{mode} =~ /server::memorypool::buffercache::hitratio/) { - $self->add_nagios( - $self->check_thresholds($self->{hitratio}, '90:', '80:'), - sprintf "buffer cache hit ratio is %.2f%%", $self->{hitratio}); - $self->add_perfdata(sprintf "buffer_cache_hit_ratio=%.2f%%;%s;%s", - $self->{hitratio}, - $self->{warningrange}, $self->{criticalrange}); - #$self->add_perfdata(sprintf "buffer_cache_hit_ratio_now=%.2f%%", - # $self->{hitratio_now}); - } elsif ($params{mode} =~ /server::memorypool::buffercache::lazywrites/) { - $self->add_nagios( - $self->check_thresholds($self->{lazy_writes_per_sec}, '20', '40'), - sprintf "%.2f lazy writes per second", $self->{lazy_writes_per_sec}); - $self->add_perfdata(sprintf "lazy_writes_per_sec=%.2f;%s;%s", - $self->{lazy_writes_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /server::memorypool::buffercache::pagelifeexpectancy/) { - $self->add_nagios( - $self->check_thresholds($self->{pagelifeexpectancy}, '300:', '180:'), - sprintf "page life expectancy is %d seconds", $self->{pagelifeexpectancy}); - $self->add_perfdata(sprintf "page_life_expectancy=%d;%s;%s", - $self->{pagelifeexpectancy}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /server::memorypool::buffercache::freeliststalls/) { - $self->add_nagios( - $self->check_thresholds($self->{freeliststalls_per_sec}, '4', '10'), - sprintf "%.2f free list stalls per second", $self->{freeliststalls_per_sec}); - $self->add_perfdata(sprintf "free_list_stalls_per_sec=%.2f;%s;%s", - $self->{freeliststalls_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /server::memorypool::buffercache::checkpointpages/) { - $self->add_nagios( - $self->check_thresholds($self->{checkpointpages_per_sec}, '100', '500'), - sprintf "%.2f pages flushed per second", $self->{checkpointpages_per_sec}); - $self->add_perfdata(sprintf "checkpoint_pages_per_sec=%.2f;%s;%s", - $self->{checkpointpages_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } - } -} - - - - - -package DBD::MSSQL::Server::Memorypool::Lock; - -use strict; - -our @ISA = qw(DBD::MSSQL::Server::Memorypool); - - -{ - my @locks = (); - my $initerrors = undef; - - sub add_lock { - push(@locks, shift); - } - - sub return_locks { - return reverse - sort { $a->{name} cmp $b->{name} } @locks; - } - - sub init_locks { - my %params = @_; - my $num_locks = 0; - if (($params{mode} =~ /server::memorypool::lock::listlocks/) || - ($params{mode} =~ /server::memorypool::lock::waits/) || - ($params{mode} =~ /server::memorypool::lock::deadlocks/) || - ($params{mode} =~ /server::memorypool::lock::timeouts/)) { - my @lockresult = $params{handle}->get_instance_names( - 'SQLServer:Locks'); - foreach (@lockresult) { - my ($name) = @{$_}; - $name =~ s/\s*$//; - if ($params{regexp}) { - next if $params{selectname} && $name !~ /$params{selectname}/; - } else { - next if $params{selectname} && lc $params{selectname} ne lc $name; - } - my %thisparams = %params; - $thisparams{name} = $name; - my $lock = DBD::MSSQL::Server::Memorypool::Lock->new( - %thisparams); - add_lock($lock); - $num_locks++; - } - if (! $num_locks) { - $initerrors = 1; - return undef; - } - } - } - -} - -sub new { - my $class = shift; - my %params = @_; - my $self = { - handle => $params{handle}, - warningrange => $params{warningrange}, - criticalrange => $params{criticalrange}, - name => $params{name}, - }; - bless $self, $class; - $self->init(%params); - return $self; -} - -sub init { - my $self = shift; - my %params = @_; - $self->init_nagios(); - if ($params{mode} =~ /server::memorypool::lock::listlocks/) { - # name reicht - } elsif ($params{mode} =~ /server::memorypool::lock::waits/) { - $self->{lock_waits_s} = $self->{handle}->get_perf_counter_instance( - "SQLServer:Locks", "Lock Waits/sec", $self->{name}); - if (! defined $self->{lock_waits_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(lock_waits_s)); - $self->{lock_waits_per_sec} = $self->{delta_lock_waits_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /^server::memorypool::lock::timeouts/) { - $self->{lock_timeouts_s} = $self->{handle}->get_perf_counter_instance( - "SQLServer:Locks", "Lock Timeouts/sec", $self->{name}); - if (! defined $self->{lock_timeouts_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(lock_timeouts_s)); - $self->{lock_timeouts_per_sec} = $self->{delta_lock_timeouts_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /^server::memorypool::lock::deadlocks/) { - $self->{lock_deadlocks_s} = $self->{handle}->get_perf_counter_instance( - "SQLServer:Locks", "Number of Deadlocks/sec", $self->{name}); - if (! defined $self->{lock_deadlocks_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(lock_deadlocks_s)); - $self->{lock_deadlocks_per_sec} = $self->{delta_lock_deadlocks_s} / $self->{delta_timestamp}; - } - } -} - -sub nagios { - my $self = shift; - my %params = @_; - if (! $self->{nagios_level}) { - if ($params{mode} =~ /server::memorypool::lock::waits/) { - $self->add_nagios( - $self->check_thresholds($self->{lock_waits_per_sec}, 100, 500), - sprintf "%.4f lock waits / sec for %s", - $self->{lock_waits_per_sec}, $self->{name}); - $self->add_perfdata(sprintf "%s_lock_waits_per_sec=%.4f;%s;%s", - $self->{name}, $self->{lock_waits_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::memorypool::lock::timeouts/) { - $self->add_nagios( - $self->check_thresholds($self->{lock_timeouts_per_sec}, 1, 5), - sprintf "%.4f lock timeouts / sec for %s", - $self->{lock_timeouts_per_sec}, $self->{name}); - $self->add_perfdata(sprintf "%s_lock_timeouts_per_sec=%.4f;%s;%s", - $self->{name}, $self->{lock_timeouts_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::memorypool::lock::deadlocks/) { - $self->add_nagios( - $self->check_thresholds($self->{lock_deadlocks_per_sec}, 1, 5), - sprintf "%.4f deadlocks / sec for %s", - $self->{lock_deadlocks_per_sec}, $self->{name}); - $self->add_perfdata(sprintf "%s_deadlocks_per_sec=%.4f;%s;%s", - $self->{name}, $self->{lock_deadlocks_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } - } -} - - -package DBD::MSSQL::Server::Memorypool::SystemLevelDataStructures::LockTable; -package DBD::MSSQL::Server::Memorypool::ProcedureCache; -package DBD::MSSQL::Server::Memorypool::LogCache; -package DBD::MSSQL::Server::Memorypool::SystemLevelDataStructures; -package DBD::MSSQL::Server::Database::Datafile; - -use strict; -use File::Basename; - -our @ISA = qw(DBD::MSSQL::Server::Database); - - -{ - my @datafiles = (); - my $initerrors = undef; - - sub add_datafile { - push(@datafiles, shift); - } - - sub return_datafiles { - return reverse - sort { $a->{logicalfilename} cmp $b->{logicalfilename} } @datafiles; - } - - sub clear_datafiles { - @datafiles = (); - } - - sub init_datafiles { - my %params = @_; - my $num_datafiles = 0; - if ($params{mode} =~ /server::database::datafile::listdatafiles/) { - my @datafileresults = $params{handle}->fetchall_array(q{ -DECLARE @DBInfo TABLE -( ServerName VARCHAR(100), -DatabaseName VARCHAR(100), -FileSizeMB INT, -LogicalFileName sysname, -PhysicalFileName NVARCHAR(520), -Status sysname, -Updateability sysname, -RecoveryMode sysname, -FreeSpaceMB INT, -FreeSpacePct VARCHAR(7), -FreeSpacePages INT, -PollDate datetime) - -DECLARE @command VARCHAR(5000) - -SELECT @command = 'Use [' + '?' + '] SELECT -@@servername as ServerName, -' + '''' + '?' + '''' + ' AS DatabaseName, -CAST(sysfiles.size/128.0 AS int) AS FileSize, -sysfiles.name AS LogicalFileName, sysfiles.filename AS PhysicalFileName, -CONVERT(sysname,DatabasePropertyEx(''?'',''Status'')) AS Status, -CONVERT(sysname,DatabasePropertyEx(''?'',''Updateability'')) AS Updateability, -CONVERT(sysname,DatabasePropertyEx(''?'',''Recovery'')) AS RecoveryMode, -CAST(sysfiles.size/128.0 - CAST(FILEPROPERTY(sysfiles.name, ' + '''' + - 'SpaceUsed' + '''' + ' ) AS int)/128.0 AS int) AS FreeSpaceMB, -CAST(100 * (CAST (((sysfiles.size/128.0 -CAST(FILEPROPERTY(sysfiles.name, -' + '''' + 'SpaceUsed' + '''' + ' ) AS int)/128.0)/(sysfiles.size/128.0)) -AS decimal(4,2))) AS varchar(8)) + ' + '''' + '%' + '''' + ' AS FreeSpacePct, -GETDATE() as PollDate FROM dbo.sysfiles' -INSERT INTO @DBInfo - (ServerName, - DatabaseName, - FileSizeMB, - LogicalFileName, - PhysicalFileName, - Status, - Updateability, - RecoveryMode, - FreeSpaceMB, - FreeSpacePct, - PollDate) -EXEC sp_MSForEachDB @command - -SELECT - ServerName, - DatabaseName, - FileSizeMB, - LogicalFileName, - PhysicalFileName, - Status, - Updateability, - RecoveryMode, - FreeSpaceMB, - FreeSpacePct, - PollDate -FROM @DBInfo -ORDER BY - ServerName, - DatabaseName - }); - if (DBD::MSSQL::Server::return_first_server()->windows_server()) { - fileparse_set_fstype("MSWin32"); - } - foreach (@datafileresults) { - my ($servername, $databasename, $filesizemb, $logicalfilename, - $physicalfilename, $status, $updateability, $recoverymode, - $freespacemb, $freespacepct, $polldate) = @{$_}; - next if $databasename ne $params{database}; - if ($params{regexp}) { - #next if $params{selectname} && - # (($name !~ /$params{selectname}/) && - # (basename($name) !~ /$params{selectname}/)); - next if $params{selectname} && - ($logicalfilename !~ /$params{selectname}/); - } else { - #next if $params{selectname} && - # ((lc $params{selectname} ne lc $name) && - # (lc $params{selectname} ne lc basename($name))); - next if $params{selectname} && - (lc $params{selectname} ne lc $logicalfilename); - } - my %thisparams = %params; - $thisparams{servername} = $servername; - $thisparams{databasename} = $databasename; - $thisparams{filesizemb} = $filesizemb; - $thisparams{logicalfilename} = $logicalfilename; - $thisparams{servername} = $servername; - $thisparams{status} = $status; - $thisparams{updateability} = $updateability; - $thisparams{recoverymode} = $recoverymode; - $thisparams{freespacemb} = $freespacemb; - $thisparams{freespacepct} = $freespacepct; - $thisparams{polldate} = $polldate; - my $datafile = - DBD::MSSQL::Server::Database::Datafile->new( - %thisparams); - add_datafile($datafile); - $num_datafiles++; - } - } - } - -} - -sub new { - my $class = shift; - my %params = @_; - my $self = { - handle => $params{handle}, - databasename => $params{databasename}, - filesizemb => $params{filesizemb}, - logicalfilename => $params{logicalfilename}, - physicalfilename => $params{physicalfilename}, - status => $params{status}, - updateability => $params{updateability}, - recoverymode => $params{recoverymode}, - freespacemb => $params{freespacemb}, - freespacepct => $params{freespacepct}, - freespacepages => $params{freespacepages}, - polldate => $params{polldate}, - warningrange => $params{warningrange}, - criticalrange => $params{criticalrange}, - }; - bless $self, $class; - $self->init(%params); - return $self; -} - -sub init { - my $self = shift; - my %params = @_; - $self->init_nagios(); - if ($params{mode} =~ /server::database::iobalance/) { - if (! defined $self->{phyrds}) { - $self->add_nagios_critical(sprintf "unable to read datafile io %s", $@); - } else { - $params{differenciator} = $self->{path}; - $self->valdiff(\%params, qw(phyrds phywrts)); - $self->{io_total} = $self->{delta_phyrds} + $self->{delta_phywrts}; - } - } elsif ($params{mode} =~ /server::database::datafile::iotraffic/) { - if (! defined $self->{phyrds}) { - $self->add_nagios_critical(sprintf "unable to read datafile io %s", $@); - } else { - $params{differenciator} = $self->{path}; - $self->valdiff(\%params, qw(phyrds phywrts)); - $self->{io_total_per_sec} = ($self->{delta_phyrds} + $self->{delta_phywrts}) / - $self->{delta_timestamp}; - } - } -} - - -sub nagios { - my $self = shift; - my %params = @_; - if (! $self->{nagios_level}) { - if ($params{mode} =~ /server::database::datafile::iotraffic/) { - $self->add_nagios( - $self->check_thresholds($self->{io_total_per_sec}, "1000", "5000"), - sprintf ("%s: %.2f IO Operations per Second", - $self->{name}, $self->{io_total_per_sec})); - $self->add_perfdata(sprintf "'dbf_%s_io_total_per_sec'=%.2f;%d;%d", - $self->{name}, $self->{io_total_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } - } -} - -package DBD::MSSQL::Server::Database; - -use strict; - -our @ISA = qw(DBD::MSSQL::Server); - - -{ - my @databases = (); - my $initerrors = undef; - - sub add_database { - push(@databases, shift); - } - - sub return_databases { - return reverse - sort { $a->{name} cmp $b->{name} } @databases; - } - - sub init_databases { - my %params = @_; - my $num_databases = 0; - if (($params{mode} =~ /server::database::listdatabases/) || - ($params{mode} =~ /server::database::databasefree/) || - ($params{mode} =~ /server::database::lastbackup/) || - ($params{mode} =~ /server::database::transactions/) || - ($params{mode} =~ /server::database::datafile/)) { - my @databaseresult = (); - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - @databaseresult = $params{handle}->fetchall_array(q{ - SELECT name, database_id FROM master.sys.databases - }); - } else { - #@databaseresult = map { - # [ $_->[0], $_->[3] ] # only name, dbid - #} $params{handle}->fetchall_array(q{exec sp_helpdb}); - @databaseresult = $params{handle}->fetchall_array(q{ - SELECT name, dbid FROM master.dbo.sysdatabases - }); - } - if ($params{mode} =~ /server::database::transactions/) { - push(@databaseresult, [ '_Total', 0 ]); - } - foreach (@databaseresult) { - my ($name, $id) = @{$_}; - next if $params{database} && $name ne $params{database}; - if ($params{regexp}) { - next if $params{selectname} && $name !~ /$params{selectname}/; - } else { - next if $params{selectname} && lc $params{selectname} ne lc $name; - } - my %thisparams = %params; - $thisparams{name} = $name; - $thisparams{id} = $id; - my $database = DBD::MSSQL::Server::Database->new( - %thisparams); - add_database($database); - $num_databases++; - } - if (! $num_databases) { - $initerrors = 1; - return undef; - } - } elsif ($params{mode} =~ /server::database::backupage/) { - my @databaseresult = (); - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - @databaseresult = $params{handle}->fetchall_array(q{ - SELECT - a.name, - DATEDIFF(HH, MAX(b.backup_finish_date), GETDATE()), - DATEDIFF(MI, MAX(b.backup_start_date), MAX(b.backup_finish_date)) - FROM sys.sysdatabases a LEFT OUTER JOIN msdb.dbo.backupset b - ON b.database_name = a.name - GROUP BY a.name - ORDER BY a.name - }); - } else { - @databaseresult = $params{handle}->fetchall_array(q{ - SELECT - a.name, - DATEDIFF(HH, MAX(b.backup_finish_date), GETDATE()), - DATEDIFF(MI, MAX(b.backup_start_date), MAX(b.backup_finish_date)) - FROM master.dbo.sysdatabases a LEFT OUTER JOIN msdb.dbo.backupset b - ON b.database_name = a.name - GROUP BY a.name - ORDER BY a.name - }); - } - foreach (sort { - if (! defined $b->[1]) { - return 1; - } elsif (! defined $a->[1]) { - return -1; - } else { - return $a->[1] <=> $b->[1]; - } - } @databaseresult) { - my ($name, $age, $duration) = @{$_}; - next if $params{database} && $name ne $params{database}; - if ($params{regexp}) { - next if $params{selectname} && $name !~ /$params{selectname}/; - } else { - next if $params{selectname} && lc $params{selectname} ne lc $name; - } - my %thisparams = %params; - $thisparams{name} = $name; - $thisparams{backup_age} = $age; - $thisparams{backup_duration} = $duration; - my $database = DBD::MSSQL::Server::Database->new( - %thisparams); - add_database($database); - $num_databases++; - } - } - - } - -} - -sub new { - my $class = shift; - my %params = @_; - my $self = { - handle => $params{handle}, - warningrange => $params{warningrange}, - criticalrange => $params{criticalrange}, - name => $params{name}, - id => $params{id}, - datafiles => [], - backup_age => $params{backup_age}, - backup_duration => $params{backup_duration}, - }; - bless $self, $class; - $self->init(%params); - return $self; -} - -sub init { - my $self = shift; - my %params = @_; - $self->init_nagios(); - $self->set_local_db_thresholds(%params); - if ($params{mode} =~ /server::database::datafile/) { - $params{database} = $self->{name}; - DBD::MSSQL::Server::Database::Datafile::init_datafiles(%params); - if (my @datafiles = - DBD::MSSQL::Server::Database::Datafile::return_datafiles()) { - $self->{datafiles} = \@datafiles; - } else { - $self->add_nagios_critical("unable to aquire datafile info"); - } - } elsif ($params{mode} =~ /server::database::databasefree/) { - ################################################################################### - # fuer's museum - # 1> sp_spaceused - # 2> go - # database_name database_size unallocated space - # master 4.50 MB 1.32 MB - # reserved data index_size unused - # 2744 KB 1056 KB 1064 KB 624 KB - # (return status = 0) - #my($database_name, $database_size, $unallocated_space, - # $reserved, $data, $index_size, $unused) = - # $params{handle}->fetchrow_array( - # "USE ".$self->{name}."\nEXEC SP_SPACEUSED" - #); - # server mgmt studio sp_spaceused - # Currently Allocated Space database_size 641.94MB - # Available Free Space unallocated space 457.09MB - #$database_size =~ s/MB//g; - #$unallocated_space =~ s/MB//g; - #$self->{size} = $database_size * 1024 * 1024; - #$self->{free} = $unallocated_space * 1024 * 1024; - #$self->{percent_free} = $unallocated_space / $database_size * 100; - #$self->{used} = $self->{size} - $self->{free}; - #$self->{maxsize} = "99999999999999999"; - ################################################################################### - my $calc = {}; - if ($params{method} eq 'sqlcmd' || $params{method} eq 'sqsh') { - foreach($self->{handle}->fetchall_array(q{ - if object_id('tempdb..#FreeSpace') is null - create table #FreeSpace( - Drive varchar(10), - MB_Free bigint - ) - go - DELETE FROM tempdb..#FreeSpace - INSERT INTO tempdb..#FreeSpace exec master.dbo.xp_fixeddrives - go - SELECT * FROM tempdb..#FreeSpace - })) { - $calc->{drive_mb}->{lc $_->[0]} = $_->[1]; - } - } else { - $self->{handle}->execute(q{ - if object_id('tempdb..#FreeSpace') is null - create table #FreeSpace( - Drive varchar(10), - MB_Free bigint - ) - }); - $self->{handle}->execute(q{ - DELETE FROM #FreeSpace - }); - $self->{handle}->execute(q{ - INSERT INTO #FreeSpace exec master.dbo.xp_fixeddrives - }); - foreach($self->{handle}->fetchall_array(q{ - SELECT * FROM #FreeSpace - })) { - $calc->{drive_mb}->{lc $_->[0]} = $_->[1]; - } - } - #$self->{handle}->execute(q{ - # DROP TABLE #FreeSpace - #}); - # Page = 8KB - # sysfiles ist sv2000, noch als kompatibilitaetsview vorhanden - # dbo.sysfiles kann 2008 durch sys.database_files ersetzt werden? - # omeiomeiomei in 2005 ist ein sys.sysindexes compatibility view - # fuer 2000.dbo.sysindexes - # besser ist sys.allocation_units - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - my $sql = q{ - SELECT - SUM(CAST(used AS BIGINT)) / 128 - FROM - [?].sys.sysindexes - WHERE - indid IN (0,1,255) - }; - #$sql =~ s/\[\?\]/$self->{name}/g; - $sql =~ s/\?/$self->{name}/g; - $self->{used_mb} = $self->{handle}->fetchrow_array($sql); - } else { - my $sql = q{ - SELECT - SUM(CAST(used AS BIGINT)) / 128 - FROM - [?].dbo.sysindexes - WHERE - indid IN (0,1,255) - }; - #$sql =~ s/\[\?\]/$self->{name}/g; - $sql =~ s/\?/$self->{name}/g; - $self->{used_mb} = $self->{handle}->fetchrow_array($sql); - } - my @fileresult = (); - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - my $sql = q{ - SELECT - RTRIM(a.name), RTRIM(a.filename), CAST(a.size AS BIGINT), - CAST(a.maxsize AS BIGINT), a.growth - FROM - [?].sys.sysfiles a - JOIN - [?].sys.sysfilegroups b - ON - a.groupid = b.groupid - }; - #$sql =~ s/\[\?\]/$self->{name}/g; - $sql =~ s/\?/$self->{name}/g; - @fileresult = $self->{handle}->fetchall_array($sql); - } else { - my $sql = q{ - SELECT - RTRIM(a.name), RTRIM(a.filename), CAST(a.size AS BIGINT), - CAST(a.maxsize AS BIGINT), a.growth - FROM - [?].dbo.sysfiles a - JOIN - [?].dbo.sysfilegroups b - ON - a.groupid = b.groupid - }; - #$sql =~ s/\[\?\]/$self->{name}/g; - $sql =~ s/\?/$self->{name}/g; - @fileresult = $self->{handle}->fetchall_array($sql); - } - foreach(@fileresult) { - my($name, $filename, $size, $maxsize, $growth) = @{$_}; - my $drive = lc substr($filename, 0, 1); - $calc->{datafile}->{$name}->{allocsize} = $size / 128; - if ($growth == 0) { - $calc->{datafile}->{$name}->{maxsize} = $size / 128; - } else { - if ($maxsize == -1) { - $calc->{datafile}->{$name}->{maxsize} = - exists $calc->{drive_mb}->{$drive} ? - ($calc->{datafile}->{$name}->{allocsize} + - $calc->{drive_mb}->{$drive}) : 4 * 1024; - # falls die platte nicht gefunden wurde, dann nimm halt 4GB - if (exists $calc->{drive_mb}->{$drive}) { - # davon kann ausgegangen werden. wenn die drives nicht zur - # vefuegung stehen, stimmt sowieso hinten und vorne nichts. - $calc->{drive_mb}->{$drive} = 0; - # damit ist der platz dieses laufwerks verbraten und in - # max_mb eingeflossen. es darf nicht sein, dass der freie platz - # mehrfach gezaehlt wird, wenn es mehrere datafiles auf diesem - # laufwerk gibt. - } - } else { - $calc->{datafile}->{$name}->{maxsize} = $maxsize / 128; - } - } - $self->{allocated_mb} += $calc->{datafile}->{$name}->{allocsize}; - $self->{max_mb} += $calc->{datafile}->{$name}->{maxsize}; - } - $self->{allocated_mb} = $self->{allocated_mb}; - if ($self->{used_mb} > $self->{allocated_mb}) { - # obige used-berechnung liefert manchmal (wenns knapp hergeht) mehr als - # den maximal verfuegbaren platz. vermutlich muessen dann - # zwecks ermittlung des tatsaechlichen platzverbrauchs - # irgendwelche dbcc updateusage laufen. - # egal, wird schon irgendwie stimmen. - $self->{used_mb} = $self->{allocated_mb}; - $self->{estimated} = 1; - } else { - $self->{estimated} = 0; - } - $self->{free_mb} = $self->{max_mb} - $self->{used_mb}; - $self->{free_percent} = 100 * $self->{free_mb} / $self->{max_mb}; - $self->{allocated_percent} = 100 * $self->{allocated_mb} / $self->{max_mb}; - } elsif ($params{mode} =~ /^server::database::transactions/) { - $self->{transactions_s} = $self->{handle}->get_perf_counter_instance( - 'SQLServer:Databases', 'Transactions/sec', $self->{name}); - if (! defined $self->{transactions_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(transactions_s)); - $self->{transactions_per_sec} = $self->{delta_transactions_s} / $self->{delta_timestamp}; - } - } -} - -sub nagios { - my $self = shift; - my %params = @_; - if (! $self->{nagios_level}) { - if ($params{mode} =~ /server::database::datafile::listdatafiles/) { - foreach (sort { $a->{logicalfilename} cmp $b->{logicalfilename}; } @{$self->{datafiles}}) { - printf "%s\n", $_->{logicalfilename}; - } - $self->add_nagios_ok("have fun"); - } elsif ($params{mode} =~ /^server::database::transactions/) { - $self->add_nagios( - $self->check_thresholds($self->{transactions_per_sec}, 10000, 50000), - sprintf "%s has %.4f transactions / sec", - $self->{name}, $self->{transactions_per_sec}); - $self->add_perfdata(sprintf "%s_transactions_per_sec=%.4f;%s;%s", - $self->{name}, $self->{transactions_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /server::database::databasefree/) { - # ->percent_free - # ->free - # - # ausgabe - # perfdata db__free_pct - # perfdata db__free (real_bytes_max - bytes) + bytes_free (with units) - # perfdata db__alloc_free bytes_free (with units) - # - # umrechnen der thresholds - # ()/% - # MB - # GB - # KB - if (($self->{warningrange} && $self->{warningrange} !~ /^\d+[\.\d]*:/) || - ($self->{criticalrange} && $self->{criticalrange} !~ /^\d+[\.\d]*:/)) { - $self->add_nagios_unknown("you want an alert if free space is _above_ a threshold????"); - return; - } - if (! $params{units}) { - $params{units} = "%"; - } - $self->{warning_bytes} = 0; - $self->{critical_bytes} = 0; - if ($params{units} eq "%") { - $self->add_nagios( - $self->check_thresholds($self->{free_percent}, "5:", "2:"), - sprintf("database %s has %.2f%% free space left", - $self->{name}, $self->{free_percent}, - ($self->{estimated} ? " (estim.)" : "")) - ); - $self->{warningrange} =~ s/://g; - $self->{criticalrange} =~ s/://g; - $self->add_perfdata(sprintf "\'db_%s_free_pct\'=%.2f%%;%d:;%d:", - lc $self->{name}, - $self->{free_percent}, - $self->{warningrange}, $self->{criticalrange}); - $self->add_perfdata(sprintf "\'db_%s_free\'=%dMB;%.2f:;%.2f:;0;%.2f", - lc $self->{name}, - $self->{free_mb}, - $self->{warningrange} * $self->{max_mb} / 100, - $self->{criticalrange} * $self->{max_mb} / 100, - $self->{max_mb}); - $self->add_perfdata(sprintf "\'db_%s_allocated_pct\'=%.2f%%", - lc $self->{name}, - $self->{allocated_percent}); - } else { - my $factor = 1; # default MB - if ($params{units} eq "GB") { - $factor = 1024; - } elsif ($params{units} eq "MB") { - $factor = 1; - } elsif ($params{units} eq "KB") { - $factor = 1 / 1024; - } - $self->{warningrange} ||= "5:"; - $self->{criticalrange} ||= "2:"; - my $saved_warningrange = $self->{warningrange}; - my $saved_criticalrange = $self->{criticalrange}; - # : entfernen weil gerechnet werden muss - $self->{warningrange} =~ s/://g; - $self->{criticalrange} =~ s/://g; - $self->{warningrange} = $self->{warningrange} ? - $self->{warningrange} * $factor : 5 * $factor; - $self->{criticalrange} = $self->{criticalrange} ? - $self->{criticalrange} * $factor : 2 * $factor; - $self->{percent_warning} = 100 * $self->{warningrange} / $self->{max_mb}; - $self->{percent_critical} = 100 * $self->{criticalrange} / $self->{max_mb}; - $self->{warningrange} .= ':'; - $self->{criticalrange} .= ':'; - $self->add_nagios( - $self->check_thresholds($self->{free_mb}, "5242880:", "1048576:"), - sprintf("database %s has %.2f%s free space left", $self->{name}, - $self->{free_mb} / $factor, $params{units}) - ); - $self->{warningrange} = $saved_warningrange; - $self->{criticalrange} = $saved_criticalrange; - $self->{warningrange} =~ s/://g; - $self->{criticalrange} =~ s/://g; - $self->add_perfdata(sprintf "\'db_%s_free_pct\'=%.2f%%;%.2f:;%.2f:", - lc $self->{name}, - $self->{free_percent}, $self->{percent_warning}, - $self->{percent_critical}); - $self->add_perfdata(sprintf "\'db_%s_free\'=%.2f%s;%.2f:;%.2f:;0;%.2f", - lc $self->{name}, - $self->{free_mb} / $factor, $params{units}, - $self->{warningrange}, - $self->{criticalrange}, - $self->{max_mb} / $factor); - $self->add_perfdata(sprintf "\'db_%s_allocated_pct\'=%.2f%%", - lc $self->{name}, - $self->{allocated_percent}); - } - } elsif ($params{mode} =~ /server::database::backupage/) { - if (! defined $self->{backup_age}) { - $self->add_nagios_critical(sprintf "%s was never backupped", - $self->{name}); - $self->{backup_age} = 0; - $self->{backup_duration} = 0; - $self->check_thresholds($self->{backup_age}, 48, 72); # init wg perfdata - } else { - $self->add_nagios( - $self->check_thresholds($self->{backup_age}, 48, 72), - sprintf "%s backupped %dh ago", $self->{name}, $self->{backup_age}); - } - $self->add_perfdata(sprintf "'%s_bck_age'=%d;%s;%s", - $self->{name}, $self->{backup_age}, - $self->{warningrange}, $self->{criticalrange}); - $self->add_perfdata(sprintf "'%s_bck_time'=%d", - $self->{name}, $self->{backup_duration}); - } - } -} - - - -package DBD::MSSQL::Server; - -use strict; -use Time::HiRes; -use IO::File; -use File::Copy 'cp'; -use Data::Dumper; - - -{ - our $verbose = 0; - our $scream = 0; # scream if something is not implemented - our $my_modules_dyn_dir = ""; # where we look for self-written extensions - - my @servers = (); - my $initerrors = undef; - - sub add_server { - push(@servers, shift); - } - - sub return_servers { - return @servers; - } - - sub return_first_server() { - return $servers[0]; - } - -} - -sub new { - my $class = shift; - my %params = @_; - my $self = { - method => $params{method} || "dbi", - hostname => $params{hostname}, - username => $params{username}, - password => $params{password}, - port => $params{port} || 1433, - server => $params{server}, - timeout => $params{timeout}, - warningrange => $params{warningrange}, - criticalrange => $params{criticalrange}, - verbose => $params{verbose}, - report => $params{report}, - version => 'unknown', - os => 'unknown', - servicename => 'unknown', - instance => undef, - memorypool => undef, - databases => [], - handle => undef, - }; - bless $self, $class; - $self->init_nagios(); - if ($self->dbconnect(%params)) { - #$self->{version} = $self->{handle}->fetchrow_array( - # q{ SELECT SERVERPROPERTY('productversion') }); - map { - $self->{os} = $1 if /Windows (.*)/; - $self->{version} = $1 if /SQL Server.*\-\s*([\d\.]+)/; - } $self->{handle}->fetchrow_array( - q{ SELECT @@VERSION }); - $self->{dbuser} = $self->{handle}->fetchrow_array( - q{ SELECT SYSTEM_USER }); # maybe SELECT SUSER_SNAME() - $self->{servicename} = $self->{handle}->fetchrow_array( - q{ SELECT @@SERVICENAME }); - if (lc $self->{servicename} ne 'mssqlserver') { - # braucht man fuer abfragen von dm_os_performance_counters - # object_name ist entweder "SQLServer:Buffer Node" oder z.b. "MSSQL$OASH: Buffer Node" - $self->{servicename} = 'MSSQL$'.$self->{servicename}; - } else { - $self->{servicename} = 'SQLServer'; - } - DBD::MSSQL::Server::add_server($self); - $self->init(%params); - } - return $self; -} - -sub init { - my $self = shift; - my %params = @_; - $params{handle} = $self->{handle}; - $self->set_global_db_thresholds(\%params); - if ($params{mode} =~ /^server::memorypool/) { - $self->{memorypool} = DBD::MSSQL::Server::Memorypool->new(%params); - } elsif ($params{mode} =~ /^server::database/) { - DBD::MSSQL::Server::Database::init_databases(%params); - if (my @databases = - DBD::MSSQL::Server::Database::return_databases()) { - $self->{databases} = \@databases; - } else { - $self->add_nagios_critical("unable to aquire database info"); - } - } elsif ($params{mode} =~ /^server::connectiontime/) { - $self->{connection_time} = $self->{tac} - $self->{tic}; - } elsif ($params{mode} =~ /^server::cpubusy/) { - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - ($self->{secs_busy}) = $self->{handle}->fetchrow_array(q{ - SELECT ((@@CPU_BUSY * CAST(@@TIMETICKS AS FLOAT)) / - (SELECT (CAST(CPU_COUNT AS FLOAT) / CAST(HYPERTHREAD_RATIO AS FLOAT)) FROM sys.dm_os_sys_info) / - 1000000) - }); - $self->valdiff(\%params, qw(secs_busy)); - if (defined $self->{secs_busy}) { - $self->{cpu_busy} = 100 * - $self->{delta_secs_busy} / $self->{delta_timestamp}; - } else { - $self->add_nagios_critical("got no cputime from dm_os_sys_info"); - } - } else { - #$self->requires_version('9'); - my @monitor = $params{handle}->exec_sp_1hash(q{exec sp_monitor}); - foreach (@monitor) { - if ($_->[0] eq 'cpu_busy') { - if ($_->[1] =~ /(\d+)%/) { - $self->{cpu_busy} = $1; - } - } - } - self->requires_version('9') unless defined $self->{cpu_busy}; - } - } elsif ($params{mode} =~ /^server::iobusy/) { - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - ($self->{secs_busy}) = $self->{handle}->fetchrow_array(q{ - SELECT ((@@IO_BUSY * CAST(@@TIMETICKS AS FLOAT)) / - (SELECT (CAST(CPU_COUNT AS FLOAT) / CAST(HYPERTHREAD_RATIO AS FLOAT)) FROM sys.dm_os_sys_info) / - 1000000) - }); - $self->valdiff(\%params, qw(secs_busy)); - if (defined $self->{secs_busy}) { - $self->{io_busy} = 100 * - $self->{delta_secs_busy} / $self->{delta_timestamp}; - } else { - $self->add_nagios_critical("got no iotime from dm_os_sys_info"); - } - } else { - #$self->requires_version('9'); - my @monitor = $params{handle}->exec_sp_1hash(q{exec sp_monitor}); - foreach (@monitor) { - if ($_->[0] eq 'io_busy') { - if ($_->[1] =~ /(\d+)%/) { - $self->{io_busy} = $1; - } - } - } - self->requires_version('9') unless defined $self->{io_busy}; - } - } elsif ($params{mode} =~ /^server::fullscans/) { - $self->{cnt_full_scans_s} = $self->{handle}->get_perf_counter( - 'SQLServer:Access Methods', 'Full Scans/sec'); - if (! defined $self->{cnt_full_scans_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(cnt_full_scans_s)); - $self->{full_scans_per_sec} = $self->{delta_cnt_full_scans_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /^server::latch::waittime/) { - $self->{latch_wait_time} = $self->{handle}->get_perf_counter( - "SQLServer:Latches", "Average Latch Wait Time (ms)"); - $self->{latch_wait_time_base} = $self->{handle}->get_perf_counter( - "SQLServer:Latches", "Average Latch Wait Time Base"); - if (! defined $self->{latch_wait_time}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } - $self->{latch_wait_time} = $self->{latch_wait_time} / $self->{latch_wait_time_base}; - } elsif ($params{mode} =~ /^server::latch::waits/) { - $self->{latch_waits_s} = $self->{handle}->get_perf_counter( - "SQLServer:Latches", "Latch Waits/sec"); - if (! defined $self->{latch_waits_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(latch_waits_s)); - $self->{latch_waits_per_sec} = $self->{delta_latch_waits_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /^server::sql::.*compilations/) { - $self->{recompilations_s} = $self->{handle}->get_perf_counter( - "SQLServer:SQL Statistics", "SQL Re-Compilations/sec"); - $self->{compilations_s} = $self->{handle}->get_perf_counter( - "SQLServer:SQL Statistics", "SQL Compilations/sec"); - if (! defined $self->{recompilations_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(recompilations_s compilations_s)); - # http://www.sqlmag.com/Articles/ArticleID/40925/pg/3/3.html - # http://www.grumpyolddba.co.uk/monitoring/Performance%20Counter%20Guidance%20-%20SQL%20Server.htm - $self->{delta_initial_compilations_s} = $self->{delta_compilations_s} - - $self->{delta_recompilations_s}; - $self->{initial_compilations_per_sec} = - $self->{delta_initial_compilations_s} / $self->{delta_timestamp}; - $self->{recompilations_per_sec} = - $self->{delta_recompilations_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /^server::batchrequests/) { - $self->{batch_requests_s} = $self->{handle}->get_perf_counter( - "SQLServer:SQL Statistics", "Batch requests/sec"); - if (! defined $self->{batch_requests_s}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } else { - $self->valdiff(\%params, qw(batch_requests_s)); - $self->{batch_requests_per_sec} = $self->{delta_batch_requests_s} / $self->{delta_timestamp}; - } - } elsif ($params{mode} =~ /^server::totalmemory/) { - $self->{total_memory} = $self->{handle}->get_perf_counter( - "SQLServer:Memory Manager", "Total Server Memory (KB)"); - if (! defined $self->{total_memory}) { - $self->add_nagios_unknown("unable to aquire counter data"); - } - } elsif ($params{mode} =~ /^server::connectedusers/) { - $self->{connectedusers} = $self->{handle}->fetchrow_array(q{ - SELECT - COUNT(*) - FROM - master..sysprocesses - WHERE - spid > ? - }, 51); - if (! defined $self->{connectedusers}) { - $self->add_nagios_unknown("unable to count connected users"); - } - } elsif ($params{mode} =~ /^server::sql/) { - $self->set_local_db_thresholds(%params); - if ($params{regexp}) { - # sql output is treated as text - if ($params{name2} eq $params{name}) { - $self->add_nagios_unknown(sprintf "where's the regexp????"); - } else { - $self->{genericsql} = - $self->{handle}->fetchrow_array($params{selectname}); - if (! defined $self->{genericsql}) { - $self->add_nagios_unknown(sprintf "got no valid response for %s", - $params{selectname}); - } - } - } else { - # sql output must be a number (or array of numbers) - @{$self->{genericsql}} = - $self->{handle}->fetchrow_array($params{selectname}); - if (! (defined $self->{genericsql} && - (scalar(grep { /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/ } @{$self->{genericsql}})) == - scalar(@{$self->{genericsql}}))) { - $self->add_nagios_unknown(sprintf "got no valid response for %s", - $params{selectname}); - } else { - # name2 in array - # units in array - } - } - } elsif ($params{mode} =~ /^my::([^:.]+)/) { - my $class = $1; - my $loaderror = undef; - substr($class, 0, 1) = uc substr($class, 0, 1); - foreach my $libpath (split(":", $DBD::MSSQL::Server::my_modules_dyn_dir)) { - foreach my $extmod (glob $libpath."/CheckMSSQLHealth*.pm") { - eval { - $self->trace(sprintf "loading module %s", $extmod); - require $extmod; - }; - if ($@) { - $loaderror = $extmod; - $self->trace(sprintf "failed loading module %s: %s", $extmod, $@); - } - } - } - my $obj = { - handle => $params{handle}, - warningrange => $params{warningrange}, - criticalrange => $params{criticalrange}, - }; - bless $obj, "My$class"; - $self->{my} = $obj; - if ($self->{my}->isa("DBD::MSSQL::Server")) { - my $dos_init = $self->can("init"); - my $dos_nagios = $self->can("nagios"); - my $my_init = $self->{my}->can("init"); - my $my_nagios = $self->{my}->can("nagios"); - if ($my_init == $dos_init) { - $self->add_nagios_unknown( - sprintf "Class %s needs an init() method", ref($self->{my})); - } elsif ($my_nagios == $dos_nagios) { - $self->add_nagios_unknown( - sprintf "Class %s needs a nagios() method", ref($self->{my})); - } else { - $self->{my}->init_nagios(%params); - $self->{my}->init(%params); - } - } else { - $self->add_nagios_unknown( - sprintf "Class %s is not a subclass of DBD::MSSQL::Server%s", - ref($self->{my}), - $loaderror ? sprintf " (syntax error in %s?)", $loaderror : "" ); - } - } else { - printf "broken mode %s\n", $params{mode}; - } -} - -sub dump { - my $self = shift; - my $message = shift || ""; - printf "%s %s\n", $message, Data::Dumper::Dumper($self); -} - -sub nagios { - my $self = shift; - my %params = @_; - if (! $self->{nagios_level}) { - if ($params{mode} =~ /^server::instance/) { - $self->{instance}->nagios(%params); - $self->merge_nagios($self->{instance}); - } elsif ($params{mode} =~ /server::database::listdatabases/) { - foreach (sort { $a->{name} cmp $b->{name}; } @{$self->{databases}}) { - printf "%s\n", $_->{name}; - } - $self->add_nagios_ok("have fun"); - } elsif ($params{mode} =~ /^server::database/) { - foreach (@{$self->{databases}}) { - $_->nagios(%params); - $self->merge_nagios($_); - } - } elsif ($params{mode} =~ /^server::database/) { - } elsif ($params{mode} =~ /^server::lock/) { - foreach (@{$self->{locks}}) { - $_->nagios(%params); - $self->merge_nagios($_); - } - } elsif ($params{mode} =~ /^server::memorypool/) { - $self->{memorypool}->nagios(%params); - $self->merge_nagios($self->{memorypool}); - } elsif ($params{mode} =~ /^server::connectiontime/) { - $self->add_nagios( - $self->check_thresholds($self->{connection_time}, 1, 5), - sprintf "%.2f seconds to connect as %s", - $self->{connection_time}, $self->{dbuser}); - $self->add_perfdata(sprintf "connection_time=%.2f;%d;%d", - $self->{connection_time}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::cpubusy/) { - $self->add_nagios( - $self->check_thresholds($self->{cpu_busy}, 80, 90), - sprintf "CPU busy %.2f%%", $self->{cpu_busy}); - $self->add_perfdata(sprintf "cpu_busy=%.2f;%s;%s", - $self->{cpu_busy}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::iobusy/) { - $self->add_nagios( - $self->check_thresholds($self->{io_busy}, 80, 90), - sprintf "IO busy %.2f%%", $self->{io_busy}); - $self->add_perfdata(sprintf "io_busy=%.2f;%s;%s", - $self->{io_busy}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::fullscans/) { - $self->add_nagios( - $self->check_thresholds($self->{full_scans_per_sec}, 100, 500), - sprintf "%.2f full table scans / sec", $self->{full_scans_per_sec}); - $self->add_perfdata(sprintf "full_scans_per_sec=%.2f;%s;%s", - $self->{full_scans_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::latch::waits/) { - $self->add_nagios( - $self->check_thresholds($self->{latch_waits_per_sec}, 10, 50), - sprintf "%.2f latches / sec have to wait", $self->{latch_waits_per_sec}); - $self->add_perfdata(sprintf "latch_waits_per_sec=%.2f;%s;%s", - $self->{latch_waits_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::latch::waittime/) { - $self->add_nagios( - $self->check_thresholds($self->{latch_wait_time}, 1, 5), - sprintf "latches have to wait %.2f ms avg", $self->{latch_wait_time}); - $self->add_perfdata(sprintf "latch_avg_wait_time=%.2fms;%s;%s", - $self->{latch_wait_time}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::sql::recompilations/) { - $self->add_nagios( - $self->check_thresholds($self->{recompilations_per_sec}, 1, 10), - sprintf "%.2f SQL recompilations / sec", $self->{recompilations_per_sec}); - $self->add_perfdata(sprintf "sql_recompilations_per_sec=%.2f;%s;%s", - $self->{recompilations_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::sql::initcompilations/) { - $self->add_nagios( - $self->check_thresholds($self->{initial_compilations_per_sec}, 100, 200), - sprintf "%.2f initial compilations / sec", $self->{initial_compilations_per_sec}); - $self->add_perfdata(sprintf "sql_initcompilations_per_sec=%.2f;%s;%s", - $self->{initial_compilations_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::batchrequests/) { - $self->add_nagios( - $self->check_thresholds($self->{batch_requests_per_sec}, 100, 200), - sprintf "%.2f batch requests / sec", $self->{batch_requests_per_sec}); - $self->add_perfdata(sprintf "batch_requests_per_sec=%.2f;%s;%s", - $self->{batch_requests_per_sec}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::totalmemory/) { - $self->add_nagios( - $self->check_thresholds($self->{total_memory}, 1000, 5000), - sprintf "total server memory %ld", $self->{total_memory}); - $self->add_perfdata(sprintf "total_server_memory=%ld;%s;%s", - $self->{total_memory}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::connectedusers/) { - $self->add_nagios( - $self->check_thresholds($self->{connectedusers}, 50, 80), - sprintf "%d connected users", $self->{connectedusers}); - $self->add_perfdata(sprintf "connected_users=%d;%s;%s", - $self->{connectedusers}, - $self->{warningrange}, $self->{criticalrange}); - } elsif ($params{mode} =~ /^server::sql/) { - if ($params{regexp}) { - if (substr($params{name2}, 0, 1) eq '!') { - $params{name2} =~ s/^!//; - if ($self->{genericsql} !~ /$params{name2}/) { - $self->add_nagios_ok( - sprintf "output %s does not match pattern %s", - $self->{genericsql}, $params{name2}); - } else { - $self->add_nagios_critical( - sprintf "output %s matches pattern %s", - $self->{genericsql}, $params{name2}); - } - } else { - if ($self->{genericsql} =~ /$params{name2}/) { - $self->add_nagios_ok( - sprintf "output %s matches pattern %s", - $self->{genericsql}, $params{name2}); - } else { - $self->add_nagios_critical( - sprintf "output %s does not match pattern %s", - $self->{genericsql}, $params{name2}); - } - } - } else { - $self->add_nagios( - # the first item in the list will trigger the threshold values - $self->check_thresholds($self->{genericsql}[0], 1, 5), - sprintf "%s: %s%s", - $params{name2} ? lc $params{name2} : lc $params{selectname}, - # float as float, integers as integers - join(" ", map { - (sprintf("%d", $_) eq $_) ? $_ : sprintf("%f", $_) - } @{$self->{genericsql}}), - $params{units} ? $params{units} : ""); - my $i = 0; - # workaround... getting the column names from the database would be nicer - my @names2_arr = split(/\s+/, $params{name2}); - foreach my $t (@{$self->{genericsql}}) { - $self->add_perfdata(sprintf "\'%s\'=%s%s;%s;%s", - $names2_arr[$i] ? lc $names2_arr[$i] : lc $params{selectname}, - # float as float, integers as integers - (sprintf("%d", $t) eq $t) ? $t : sprintf("%f", $t), - $params{units} ? $params{units} : "", - ($i == 0) ? $self->{warningrange} : "", - ($i == 0) ? $self->{criticalrange} : "" - ); - $i++; - } - } - } elsif ($params{mode} =~ /^my::([^:.]+)/) { - $self->{my}->nagios(%params); - $self->merge_nagios($self->{my}); - } - } -} - - -sub init_nagios { - my $self = shift; - no strict 'refs'; - if (! ref($self)) { - my $nagiosvar = $self."::nagios"; - my $nagioslevelvar = $self."::nagios_level"; - $$nagiosvar = { - messages => { - 0 => [], - 1 => [], - 2 => [], - 3 => [], - }, - perfdata => [], - }; - $$nagioslevelvar = $ERRORS{OK}, - } else { - $self->{nagios} = { - messages => { - 0 => [], - 1 => [], - 2 => [], - 3 => [], - }, - perfdata => [], - }; - $self->{nagios_level} = $ERRORS{OK}, - } -} - -sub check_thresholds { - my $self = shift; - my $value = shift; - my $defaultwarningrange = shift; - my $defaultcriticalrange = shift; - my $level = $ERRORS{OK}; - $self->{warningrange} = defined $self->{warningrange} ? - $self->{warningrange} : $defaultwarningrange; - $self->{criticalrange} = defined $self->{criticalrange} ? - $self->{criticalrange} : $defaultcriticalrange; - if ($self->{warningrange} !~ /:/ && $self->{criticalrange} !~ /:/) { - # warning = 10, critical = 20, warn if > 10, crit if > 20 - $level = $ERRORS{WARNING} if $value > $self->{warningrange}; - $level = $ERRORS{CRITICAL} if $value > $self->{criticalrange}; - } elsif ($self->{warningrange} =~ /(\d+):/ && - $self->{criticalrange} =~ /(\d+):/) { - # warning = 98:, critical = 95:, warn if < 98, crit if < 95 - $self->{warningrange} =~ /(\d+):/; - $level = $ERRORS{WARNING} if $value < $1; - $self->{criticalrange} =~ /(\d+):/; - $level = $ERRORS{CRITICAL} if $value < $1; - } - return $level; - # - # syntax error must be reported with returncode -1 - # -} - -sub add_nagios { - my $self = shift; - my $level = shift; - my $message = shift; - push(@{$self->{nagios}->{messages}->{$level}}, $message); - # recalc current level - foreach my $llevel qw(CRITICAL WARNING UNKNOWN OK) { - if (scalar(@{$self->{nagios}->{messages}->{$ERRORS{$llevel}}})) { - $self->{nagios_level} = $ERRORS{$llevel}; - } - } -} - -sub add_nagios_ok { - my $self = shift; - my $message = shift; - $self->add_nagios($ERRORS{OK}, $message); -} - -sub add_nagios_warning { - my $self = shift; - my $message = shift; - $self->add_nagios($ERRORS{WARNING}, $message); -} - -sub add_nagios_critical { - my $self = shift; - my $message = shift; - $self->add_nagios($ERRORS{CRITICAL}, $message); -} - -sub add_nagios_unknown { - my $self = shift; - my $message = shift; - $self->add_nagios($ERRORS{UNKNOWN}, $message); -} - -sub add_perfdata { - my $self = shift; - my $data = shift; - push(@{$self->{nagios}->{perfdata}}, $data); -} - -sub merge_nagios { - my $self = shift; - my $child = shift; - foreach my $level (0..3) { - foreach (@{$child->{nagios}->{messages}->{$level}}) { - $self->add_nagios($level, $_); - } - #push(@{$self->{nagios}->{messages}->{$level}}, - # @{$child->{nagios}->{messages}->{$level}}); - } - push(@{$self->{nagios}->{perfdata}}, @{$child->{nagios}->{perfdata}}); -} - -sub calculate_result { - my $self = shift; - my $multiline = 0; - map { - $self->{nagios_level} = $ERRORS{$_} if - (scalar(@{$self->{nagios}->{messages}->{$ERRORS{$_}}})); - } ("OK", "UNKNOWN", "WARNING", "CRITICAL"); - if ($ENV{NRPE_MULTILINESUPPORT} && - length join(" ", @{$self->{nagios}->{perfdata}}) > 200) { - $multiline = 1; - } - if ($multiline) { - my $num_ok = @{$self->{nagios}->{messages}->{ $ERRORS{"OK"} } }; - my $num_crit = @{$self->{nagios}->{messages}->{ $ERRORS{"WARNING"} }}; - my $num_warn = @{$self->{nagios}->{messages}->{ $ERRORS{"CRITICAL"} }}; - my $num_unk = @{$self->{nagios}->{messages}->{ $ERRORS{"UNKNOWN"} }}; - $self->{nagios_message} .= sprintf "%s ok, %s warnings, %s criticals and %s unknown\n", - $num_ok, $num_warn,$num_crit, $num_unk; - } - my $all_messages = join(($multiline ? "\n" : ", "), map { - join(($multiline ? "\n" : ", "), @{$self->{nagios}->{messages}->{$ERRORS{$_}}}) - } grep { - scalar(@{$self->{nagios}->{messages}->{$ERRORS{$_}}}) - } ("CRITICAL", "WARNING", "UNKNOWN", "OK")); - my $bad_messages = join(($multiline ? "\n" : ", "), map { - join(($multiline ? "\n" : ", "), @{$self->{nagios}->{messages}->{$ERRORS{$_}}}) - } grep { - scalar(@{$self->{nagios}->{messages}->{$ERRORS{$_}}}) - } ("CRITICAL", "WARNING", "UNKNOWN")); - my $all_messages_short = $bad_messages ? $bad_messages : 'no problems'; - my $all_messages_html = "". - join("", map { - my $level = $_; - join("", map { - sprintf "", - $level, $_; - } @{$self->{nagios}->{messages}->{$ERRORS{$_}}}); - } grep { - scalar(@{$self->{nagios}->{messages}->{$ERRORS{$_}}}) - } ("CRITICAL", "WARNING", "UNKNOWN", "OK")). - "
%s
"; - if (exists $self->{identstring}) { - $self->{nagios_message} .= $self->{identstring}; - } - if ($self->{report} eq "long") { - $self->{nagios_message} .= $all_messages; - } elsif ($self->{report} eq "short") { - $self->{nagios_message} .= $all_messages_short; - } elsif ($self->{report} eq "html") { - $self->{nagios_message} .= $all_messages_short."\n".$all_messages_html; - } - $self->{perfdata} = join(" ", @{$self->{nagios}->{perfdata}}); -} - -sub set_global_db_thresholds { - my $self = shift; - my $params = shift; - my $warning = undef; - my $critical = undef; - return unless defined $params->{dbthresholds}; - $params->{name0} = $params->{dbthresholds}; - # :pluginmode :name :warning :critical - # mode empty - # - eval { - my $find_sql = undef; - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - $find_sql = q{ - SELECT name FROM sys.objects - WHERE name = 'check_mssql_health_thresholds' - }; - } else { - $find_sql = q{ - SELECT name FROM sysobjects - WHERE name = 'check_mssql_health_thresholds' - }; - } - if ($self->{handle}->fetchrow_array($find_sql)) { - my @dbthresholds = $self->{handle}->fetchall_array(q{ - SELECT * FROM check_mssql_health_thresholds - }); - $params->{dbthresholds} = \@dbthresholds; - foreach (@dbthresholds) { - if (($_->[0] eq $params->{cmdlinemode}) && - (! defined $_->[1] || ! $_->[1])) { - ($warning, $critical) = ($_->[2], $_->[3]); - } - } - } - }; - if (! $@) { - if ($warning) { - $params->{warningrange} = $warning; - $self->trace("read warningthreshold %s from database", $warning); - } - if ($critical) { - $params->{criticalrange} = $critical; - $self->trace("read criticalthreshold %s from database", $critical); - } - } -} - -sub set_local_db_thresholds { - my $self = shift; - my %params = @_; - my $warning = undef; - my $critical = undef; - # :pluginmode :name :warning :critical - # mode name0 - # mode name2 - # mode name - # - # first: argument of --dbthresholds, it it exists - # second: --name2 - # third: --name - if (ref($params{dbthresholds}) eq 'ARRAY') { - my $marker; - foreach (@{$params{dbthresholds}}) { - if ($_->[0] eq $params{cmdlinemode}) { - if (defined $_->[1] && $params{name0} && $_->[1] eq $params{name0}) { - ($warning, $critical) = ($_->[2], $_->[3]); - $marker = $params{name0}; - last; - } elsif (defined $_->[1] && $params{name2} && $_->[1] eq $params{name2}) { - ($warning, $critical) = ($_->[2], $_->[3]); - $marker = $params{name2}; - last; - } elsif (defined $_->[1] && $params{name} && $_->[1] eq $params{name}) { - ($warning, $critical) = ($_->[2], $_->[3]); - $marker = $params{name}; - last; - } - } - } - if ($warning) { - $self->{warningrange} = $warning; - $self->trace("read warningthreshold %s for %s from database", - $marker, $warning); - } - if ($critical) { - $self->{criticalrange} = $critical; - $self->trace("read criticalthreshold %s for %s from database", - $marker, $critical); - } - } -} - -sub debug { - my $self = shift; - my $msg = shift; - if ($DBD::MSSQL::Server::verbose) { - printf "%s %s\n", $msg, ref($self); - } -} - -sub dbconnect { - my $self = shift; - my %params = @_; - my $retval = undef; - $self->{tic} = Time::HiRes::time(); - $self->{handle} = DBD::MSSQL::Server::Connection->new(%params); - if ($self->{handle}->{errstr}) { - if ($self->{handle}->{errstr} eq "alarm\n") { - $self->add_nagios($ERRORS{CRITICAL}, - sprintf "connection could not be established within %d seconds", - $self->{timeout}); - } else { - $self->add_nagios($ERRORS{CRITICAL}, - sprintf "cannot connect to %s. %s", - ($self->{server} ? $self->{server} : - ($self->{hostname} ? $self->{hostname} : "unknown host")), - $self->{handle}->{errstr}); - $retval = undef; - } - } else { - $retval = $self->{handle}; - } - $self->{tac} = Time::HiRes::time(); - return $retval; -} - -sub trace { - my $self = shift; - my $format = shift; - if (! @_) { - # falls im sql-statement % vorkommen. sonst krachts im printf - $format =~ s/%/%%/g; - } - $self->{trace} = -f "/tmp/check_mssql_health.trace" ? 1 : 0; - if ($DBD::MSSQL::Server::verbose) { - printf("%s: ", scalar localtime); - printf($format, @_); - } - if ($self->{trace}) { - my $logfh = new IO::File; - $logfh->autoflush(1); - if ($logfh->open("/tmp/check_mssql_health.trace", "a")) { - $logfh->printf("%s: ", scalar localtime); - $logfh->printf($format, @_); - $logfh->printf("\n"); - $logfh->close(); - } - } -} - -sub DESTROY { - my $self = shift; - my $handle1 = "null"; - my $handle2 = "null"; - if (defined $self->{handle}) { - $handle1 = ref($self->{handle}); - if (defined $self->{handle}->{handle}) { - $handle2 = ref($self->{handle}->{handle}); - } - } - #$self->trace(sprintf "DESTROY %s with handle %s %s", ref($self), $handle1, $handle2); - if (ref($self) eq "DBD::MSSQL::Server") { - } - #$self->trace(sprintf "DESTROY %s exit with handle %s %s", ref($self), $handle1, $handle2); - if (ref($self) eq "DBD::MSSQL::Server") { - #printf "humpftata\n"; - } -} - -sub save_state { - my $self = shift; - my %params = @_; - my $extension = ""; - my $mode = $params{mode}; - if ($^O =~ /MSWin/) { - $mode =~ s/::/_/g; - $params{statefilesdir} = $self->system_vartmpdir(); - } - mkdir $params{statefilesdir} unless -d $params{statefilesdir}; - my $statefile = sprintf "%s/%s_%s", - $params{statefilesdir}, ($params{hostname} || $params{server}), $mode; - $extension .= $params{differenciator} ? "_".$params{differenciator} : ""; - $extension .= $params{port} ? "_".$params{port} : ""; - $extension .= $params{database} ? "_".$params{database} : ""; - $extension .= $params{name} ? "_".$params{name} : ""; - $extension =~ s/\//_/g; - $extension =~ s/\(/_/g; - $extension =~ s/\)/_/g; - $extension =~ s/\*/_/g; - $extension =~ s/\s/_/g; - $statefile .= $extension; - $statefile = lc $statefile; - open(STATE, ">$statefile"); - if ((ref($params{save}) eq "HASH") && exists $params{save}->{timestamp}) { - $params{save}->{localtime} = scalar localtime $params{save}->{timestamp}; - } - printf STATE Data::Dumper::Dumper($params{save}); - close STATE; - $self->debug(sprintf "saved %s to %s", - Data::Dumper::Dumper($params{save}), $statefile); -} - -sub load_state { - my $self = shift; - my %params = @_; - my $extension = ""; - my $mode = $params{mode}; - if ($^O =~ /MSWin/) { - $mode =~ s/::/_/g; - $params{statefilesdir} = $self->system_vartmpdir(); - } - my $statefile = sprintf "%s/%s_%s", - $params{statefilesdir}, ($params{hostname} || $params{server}), $mode; - $extension .= $params{differenciator} ? "_".$params{differenciator} : ""; - $extension .= $params{port} ? "_".$params{port} : ""; - $extension .= $params{database} ? "_".$params{database} : ""; - $extension .= $params{name} ? "_".$params{name} : ""; - $extension =~ s/\//_/g; - $extension =~ s/\(/_/g; - $extension =~ s/\)/_/g; - $extension =~ s/\*/_/g; - $extension =~ s/\s/_/g; - $statefile .= $extension; - $statefile = lc $statefile; - if ( -f $statefile) { - our $VAR1; - eval { - require $statefile; - }; - if($@) { -printf "rumms\n"; - } - $self->debug(sprintf "load %s", Data::Dumper::Dumper($VAR1)); - return $VAR1; - } else { - return undef; - } -} - -sub valdiff { - my $self = shift; - my $pparams = shift; - my %params = %{$pparams}; - my @keys = @_; - my $last_values = $self->load_state(%params) || eval { - my $empty_events = {}; - foreach (@keys) { - $empty_events->{$_} = 0; - } - $empty_events->{timestamp} = 0; - $empty_events; - }; - foreach (@keys) { - $last_values->{$_} = 0 if ! exists $last_values->{$_}; - if ($self->{$_} >= $last_values->{$_}) { - $self->{'delta_'.$_} = $self->{$_} - $last_values->{$_}; - } else { - # vermutlich db restart und zaehler alle auf null - $self->{'delta_'.$_} = $self->{$_}; - } - $self->debug(sprintf "delta_%s %f", $_, $self->{'delta_'.$_}); - } - $self->{'delta_timestamp'} = time - $last_values->{timestamp}; - $params{save} = eval { - my $empty_events = {}; - foreach (@keys) { - $empty_events->{$_} = $self->{$_}; - } - $empty_events->{timestamp} = time; - $empty_events; - }; - $self->save_state(%params); -} - -sub requires_version { - my $self = shift; - my $version = shift; - my @instances = DBD::MSSQL::Server::return_servers(); - my $instversion = $instances[0]->{version}; - if (! $self->version_is_minimum($version)) { - $self->add_nagios($ERRORS{UNKNOWN}, - sprintf "not implemented/possible for MSSQL release %s", $instversion); - } -} - -sub version_is_minimum { - # the current version is newer or equal - my $self = shift; - my $version = shift; - my $newer = 1; - my @instances = DBD::MSSQL::Server::return_servers(); - my @v1 = map { $_ eq "x" ? 0 : $_ } split(/\./, $version); - my @v2 = split(/\./, $instances[0]->{version}); - if (scalar(@v1) > scalar(@v2)) { - push(@v2, (0) x (scalar(@v1) - scalar(@v2))); - } elsif (scalar(@v2) > scalar(@v1)) { - push(@v1, (0) x (scalar(@v2) - scalar(@v1))); - } - foreach my $pos (0..$#v1) { - if ($v2[$pos] > $v1[$pos]) { - $newer = 1; - last; - } elsif ($v2[$pos] < $v1[$pos]) { - $newer = 0; - last; - } - } - #printf STDERR "check if %s os minimum %s\n", join(".", @v2), join(".", @v1); - return $newer; -} - -sub instance_rac { - my $self = shift; - my @instances = DBD::MSSQL::Server::return_servers(); - return (lc $instances[0]->{parallel} eq "yes") ? 1 : 0; -} - -sub instance_thread { - my $self = shift; - my @instances = DBD::MSSQL::Server::return_servers(); - return $instances[0]->{thread}; -} - -sub windows_server { - my $self = shift; - my @instances = DBD::MSSQL::Server::return_servers(); - if ($instances[0]->{os} =~ /Win/i) { - return 1; - } else { - return 0; - } -} - -sub system_vartmpdir { - my $self = shift; - if ($^O =~ /MSWin/) { - return $self->system_tmpdir(); - } else { - return "/var/tmp/check_mssql_health"; - } -} - -sub system_oldvartmpdir { - my $self = shift; - return "/tmp"; -} - -sub system_tmpdir { - my $self = shift; - if ($^O =~ /MSWin/) { - return $ENV{TEMP} if defined $ENV{TEMP}; - return $ENV{TMP} if defined $ENV{TMP}; - return File::Spec->catfile($ENV{windir}, 'Temp') - if defined $ENV{windir}; - return 'C:\Temp'; - } else { - return "/tmp"; - } -} - - -package DBD::MSSQL::Server::Connection; - -use strict; - -our @ISA = qw(DBD::MSSQL::Server); - - -sub new { - my $class = shift; - my %params = @_; - my $self = { - mode => $params{mode}, - timeout => $params{timeout}, - method => $params{method} || "dbi", - hostname => $params{hostname}, - username => $params{username}, - password => $params{password}, - verbose => $params{verbose}, - port => $params{port} || 1433, - server => $params{server}, - currentdb => $params{currentdb}, - handle => undef, - }; - bless $self, $class; - if ($params{method} eq "dbi") { - bless $self, "DBD::MSSQL::Server::Connection::Dbi"; - } elsif ($params{method} eq "sqsh") { - bless $self, "DBD::MSSQL::Server::Connection::Sqsh"; - } elsif ($params{method} eq "sqlrelay") { - bless $self, "DBD::MSSQL::Server::Connection::Sqlrelay"; - } elsif ($params{method} eq "sqlcmd") { - bless $self, "DBD::MSSQL::Server::Connection::Sqlcmd"; - } - $self->init(%params); - return $self; -} - -sub get_instance_names { - my $self = shift; - my $object_name = shift; - my $servicename = DBD::MSSQL::Server::return_first_server()->{servicename}; - if ($object_name =~ /SQLServer:(.*)/) { - $object_name = $servicename.':'.$1; - } - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - return $self->fetchall_array(q{ - SELECT - DISTINCT instance_name - FROM - sys.dm_os_performance_counters - WHERE - object_name = ? - }, $object_name); - } else { - return $self->fetchall_array(q{ - SELECT - DISTINCT instance_name - FROM - master.dbo.sysperfinfo - WHERE - object_name = ? - }, $object_name); - } -} - -sub get_perf_counter { - my $self = shift; - my $object_name = shift; - my $counter_name = shift; - my $servicename = DBD::MSSQL::Server::return_first_server()->{servicename}; - if ($object_name =~ /SQLServer:(.*)/) { - $object_name = $servicename.':'.$1; - } - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - return $self->fetchrow_array(q{ - SELECT - cntr_value - FROM - sys.dm_os_performance_counters - WHERE - counter_name = ? AND - object_name = ? - }, $counter_name, $object_name); - } else { - return $self->fetchrow_array(q{ - SELECT - cntr_value - FROM - master.dbo.sysperfinfo - WHERE - counter_name = ? AND - object_name = ? - }, $counter_name, $object_name); - } -} - -sub get_perf_counter_instance { - my $self = shift; - my $object_name = shift; - my $counter_name = shift; - my $instance_name = shift; - my $servicename = DBD::MSSQL::Server::return_first_server()->{servicename}; - if ($object_name =~ /SQLServer:(.*)/) { - $object_name = $servicename.':'.$1; - } - if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) { - return $self->fetchrow_array(q{ - SELECT - cntr_value - FROM - sys.dm_os_performance_counters - WHERE - counter_name = ? AND - object_name = ? AND - instance_name = ? - }, $counter_name, $object_name, $instance_name); - } else { - return $self->fetchrow_array(q{ - SELECT - cntr_value - FROM - master.dbo.sysperfinfo - WHERE - counter_name = ? AND - object_name = ? AND - instance_name = ? - }, $counter_name, $object_name, $instance_name); - } -} - -package DBD::MSSQL::Server::Connection::Dbi; - -use strict; -use Net::Ping; - -our @ISA = qw(DBD::MSSQL::Server::Connection); - - -sub init { - my $self = shift; - my %params = @_; - my $retval = undef; - if ($self->{mode} =~ /^server::tnsping/) { - # erstmal reserviert fuer irgendeinen tcp-connect - if (! $self->{connect}) { - $self->{errstr} = "Please specify a database"; - } else { - $self->{sid} = $self->{connect}; - $self->{username} ||= time; # prefer an existing user - $self->{password} = time; - } - } else { - if ((! $self->{hostname} && ! $self->{server}) || - ! $self->{username} || ! $self->{password}) { - $self->{errstr} = "Please specify hostname or server, username and password"; - return undef; - } - $self->{dsn} = "DBI:Sybase:"; - if ($self->{hostname}) { - $self->{dsn} .= sprintf ";host=%s", $self->{hostname}; - $self->{dsn} .= sprintf ";port=%s", $self->{port}; - } else { - $self->{dsn} .= sprintf ";server=%s", $self->{server}; - } - if ($params{currentdb}) { - $self->{dsn} .= sprintf ";database=%s", $params{currentdb}; - } - } - if (! exists $self->{errstr}) { - my $stderrvar; - eval { - require DBI; - use POSIX ':signal_h'; - local $SIG{'ALRM'} = sub { - die "alarm\n"; - }; - my $mask = POSIX::SigSet->new( SIGALRM ); - my $action = POSIX::SigAction->new( - sub { die "alarm\n" ; }, $mask); - my $oldaction = POSIX::SigAction->new(); - sigaction(SIGALRM ,$action ,$oldaction ); - alarm($self->{timeout} - 1); # 1 second before the global unknown timeout - *SAVEERR = *STDERR; - open OUT ,'>',\$stderrvar; - *STDERR = *OUT; - if ($self->{handle} = DBI->connect( - $self->{dsn}, - $self->{username}, - $self->{password}, - { RaiseError => 1, AutoCommit => 0, PrintError => 1 })) { - $retval = $self; - } else { - # doesnt seem to work $self->{errstr} = DBI::errstr(); - $self->{errstr} = "connect failed"; - return undef; - } - *STDERR = *SAVEERR; - }; - if ($@) { - $self->{errstr} = $@; - $retval = undef; - } elsif ($stderrvar && $stderrvar =~ /can't change context to database/) { - $self->{errstr} = $stderrvar; - } - } - $self->{tac} = Time::HiRes::time(); - return $retval; -} - -sub fetchrow_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my @row = (); - eval { - $self->trace(sprintf "SQL:\n%s\nARGS:\n%s\n", - $sql, Data::Dumper::Dumper(\@arguments)); - $sth = $self->{handle}->prepare($sql); - if (scalar(@arguments)) { - $sth->execute(@arguments) || die DBI::errstr(); - } else { - $sth->execute() || die DBI::errstr(); - } - if (lc $sql =~ /^(exec |sp_)/) { - # flatten the result sets - do { - while (my $aref = $sth->fetchrow_arrayref()) { - push(@row, @{$aref}); - } - } while ($sth->{syb_more_results}); - } else { - @row = $sth->fetchrow_array(); - } - $self->trace(sprintf "RESULT:\n%s\n", - Data::Dumper::Dumper(\@row)); - }; - if ($@) { - $self->debug(sprintf "bumm %s", $@); - } - if (-f "/tmp/check_mssql_health_simulation/".$self->{mode}) { - my $simulation = do { local (@ARGV, $/) = - "/tmp/check_mssql_health_simulation/".$self->{mode}; <> }; - @row = split(/\s+/, (split(/\n/, $simulation))[0]); - } - return $row[0] unless wantarray; - return @row; -} - -sub fetchall_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my $rows = undef; - eval { - $self->trace(sprintf "SQL:\n%s\nARGS:\n%s\n", - $sql, Data::Dumper::Dumper(\@arguments)); - $sth = $self->{handle}->prepare($sql); - if (scalar(@arguments)) { - $sth->execute(@arguments); - } else { - $sth->execute(); - } - $rows = $sth->fetchall_arrayref(); - $self->trace(sprintf "RESULT:\n%s\n", - Data::Dumper::Dumper($rows)); - }; - if ($@) { - printf STDERR "bumm %s\n", $@; - } - if (-f "/tmp/check_mssql_health_simulation/".$self->{mode}) { - my $simulation = do { local (@ARGV, $/) = - "/tmp/check_mssql_health_simulation/".$self->{mode}; <> }; - @{$rows} = map { [ split(/\s+/, $_) ] } split(/\n/, $simulation); - } - return @{$rows}; -} - -sub exec_sp_1hash { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my $rows = undef; - eval { - $self->trace(sprintf "SQL:\n%s\nARGS:\n%s\n", - $sql, Data::Dumper::Dumper(\@arguments)); - $sth = $self->{handle}->prepare($sql); - if (scalar(@arguments)) { - $sth->execute(@arguments); - } else { - $sth->execute(); - } - do { - while (my $href = $sth->fetchrow_hashref()) { - foreach (keys %{$href}) { - push(@{$rows}, [ $_, $href->{$_} ]); - } - } - } while ($sth->{syb_more_results}); - $self->trace(sprintf "RESULT:\n%s\n", - Data::Dumper::Dumper($rows)); - }; - if ($@) { - printf STDERR "bumm %s\n", $@; - } - return @{$rows}; -} - - -sub execute { - my $self = shift; - my $sql = shift; - eval { - my $sth = $self->{handle}->prepare($sql); - $sth->execute(); - }; - if ($@) { - printf STDERR "bumm %s\n", $@; - } -} - -sub DESTROY { - my $self = shift; - $self->trace(sprintf "disconnecting DBD %s", - $self->{handle} ? "with handle" : "without handle"); - $self->{handle}->disconnect() if $self->{handle}; -} - -package DBD::MSSQL::Server::Connection::Sqlcmd; - -use strict; -use File::Temp qw/tempfile/; - -our @ISA = qw(DBD::MSSQL::Server::Connection); - - -sub init { - my $self = shift; - my %params = @_; - my $retval = undef; - $self->{loginstring} = "hostport"; - my $template = $self->{mode}.'XXXXX'; - if ($^O =~ /MSWin/) { - $template =~ s/::/_/g; - } - ($self->{sql_commandfile_handle}, $self->{sql_commandfile}) = - tempfile($template, SUFFIX => ".sql", - DIR => $self->system_tmpdir() ); - close $self->{sql_commandfile_handle}; - ($self->{sql_resultfile_handle}, $self->{sql_resultfile}) = - tempfile($template, SUFFIX => ".out", - DIR => $self->system_tmpdir() ); - close $self->{sql_resultfile_handle}; - ($self->{sql_outfile_handle}, $self->{sql_outfile}) = - tempfile($template, SUFFIX => ".out", - DIR => $self->system_tmpdir() ); - close $self->{sql_outfile_handle}; - - if ($self->{mode} =~ /^server::tnsping/) { - die "oracle leftover"; - } else { - # --server xy --username xy --password xy - # --hostname xy --username xy --password xy - # --hostname xy --port --username xy --password xy - if ($self->{server} && $self->{username} && $self->{password}) { - # --server bba --user nagios --password oradbmon - $self->{loginstring} = "server"; - } elsif ($self->{hostname} && $self->{username} && $self->{password}) { - # --hostname bba --user nagios --password oradbmon - $self->{loginstring} = "server"; - $self->{server} = sprintf 'tcp:%s,%s', $self->{hostname}, $self->{port}; - } else { - $self->{errstr} = "Please specify servername, username and password"; - return undef; - } - } - if (! exists $self->{errstr}) { - eval { - if (! exists $ENV{SQL_HOME}) { - foreach my $path (split(';', $ENV{PATH})) { - $self->trace(sprintf "try to find sqlcmd.exe in %s", $path); - if (-x $path.'/sqlcmd.exe') { - $ENV{SQL_HOME} = $path; - last; - } - } - $ENV{SQL_HOME} |= ''; - } else { - $ENV{PATH} = $ENV{SQL_HOME}. - (defined $ENV{PATH} ? ";".$ENV{PATH} : ""); - } - my $sqlcmd = undef; - if (-x $ENV{SQL_HOME}.'/'.'sqlcmd.exe') { - $sqlcmd = $ENV{SQL_HOME}.'/'.'sqlcmd.exe'; - } - if (! $sqlcmd) { - die "nosqlcmd\n"; - } else { - $self->trace(sprintf "found %s", $sqlcmd); - } - if ($self->{mode} =~ /^server::tnsping/) { - die "oracle leftover"; - } else { - if ($self->{loginstring} eq "server") { - $self->{sqlcmd} = sprintf '"%s" -S %s -U "%s" -P "%s" %s -i "%s" -o "%s"', - $sqlcmd, $self->{server}, $self->{username}, $self->{password}, - ($self->{currentdb} ? "-d ".$self->{currentdb} : ""), - $self->{sql_commandfile}, $self->{sql_resultfile}; - $self->{sqlcmd} .= ' -h-1 -s"|" -W'; - } - } - - use POSIX ':signal_h'; - local $SIG{'ALRM'} = sub { - die "timeout\n"; - }; - if ($^O !~ /MSWin/) { - my $mask = POSIX::SigSet->new( SIGALRM ); - my $action = POSIX::SigAction->new( - sub { die "alarm\n" ; }, $mask); - my $oldaction = POSIX::SigAction->new(); - sigaction(SIGALRM ,$action ,$oldaction ); - } - alarm($self->{timeout} - 1); # 1 second before the global unknown timeout - - my $answer = $self->fetchrow_array( - q{ SELECT 'schnorch' }); - die unless defined $answer and $answer eq 'schnorch'; - $retval = $self; - }; - if ($@) { - $self->{errstr} = $@; - $self->{errstr} =~ s/at $0 .*//g; - chomp $self->{errstr}; - $retval = undef; - } - } - $self->{tac} = Time::HiRes::time(); - return $retval; -} - - -sub fetchrow_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my @row = (); - foreach (@arguments) { - # replace the ? by the parameters - if (/^\d+$/) { - $sql =~ s/\?/$_/; - } else { - $sql =~ s/\?/'$_'/; - } - } - $self->trace(sprintf "SQL (? resolved):\n%s\nARGS:\n%s\n", - $sql, Data::Dumper::Dumper(\@arguments)); - $self->create_commandfile($sql); - my $exit_output = `$self->{sqlcmd}`; - if ($?) { - printf STDERR "fetchrow_array exit bumm \n"; - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - my @oerrs = map { - /(ORA\-\d+:.*)/ ? $1 : (); - } split(/\n/, $output); - $self->{errstr} = join(" ", @oerrs); - } else { - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - @row = map { convert($_) } - map { s/^\s+([\.\d]+)$/$1/g; $_ } # strip leading space from numbers - map { s/\s+$//g; $_ } # strip trailing space - split(/\|/, (split(/\n/, $output))[0]); - $self->trace(sprintf "RESULT:\n%s\n", - Data::Dumper::Dumper(\@row)); - } - if ($@) { - $self->debug(sprintf "bumm %s", $@); - } - unlink $self->{sql_commandfile}; - unlink $self->{sql_resultfile}; - return $row[0] unless wantarray; - return @row; -} - -sub fetchall_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my $rows = undef; - foreach (@arguments) { - # replace the ? by the parameters - if (/^\d+$/) { - $sql =~ s/\?/$_/; - } else { - $sql =~ s/\?/'$_'/; - } - } - $self->trace(sprintf "SQL (? resolved):\n%s\nARGS:\n%s\n", - $sql, Data::Dumper::Dumper(\@arguments)); - $self->create_commandfile($sql); - my $exit_output = `$self->{sqlcmd}`; - if ($?) { - printf STDERR "fetchrow_array exit bumm %s\n", $exit_output; - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - my @oerrs = map { - /(ORA\-\d+:.*)/ ? $1 : (); - } split(/\n/, $output); - $self->{errstr} = join(" ", @oerrs); - } else { - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - my @rows = map { [ - map { convert($_) } - map { s/^\s+([\.\d]+)$/$1/g; $_ } - map { s/\s+$//g; $_ } - split /\|/ - ] } grep { ! /^\(\d+ rows affected\)/ } - grep { ! /^\s*$/ } - grep { ! /^Database name .* ignored, referencing object in/ } split(/\n/, $output); - $rows = \@rows; - $self->trace(sprintf "RESULT:\n%s\n", - Data::Dumper::Dumper($rows)); - } - if ($@) { - $self->debug(sprintf "bumm %s", $@); - } - unlink $self->{sql_commandfile}; - unlink $self->{sql_resultfile}; - return @{$rows}; -} - -sub func { - my $self = shift; - my $function = shift; - $self->{handle}->func(@_); -} - -sub convert { - my $n = shift; - # mostly used to convert numbers in scientific notation - if ($n =~ /^\s*\d+\s*$/) { - return $n; - } elsif ($n =~ /^\s*([-+]?)(\d*[\.,]*\d*)[eE]{1}([-+]?)(\d+)\s*$/) { - my ($vor, $num, $sign, $exp) = ($1, $2, $3, $4); - $n =~ s/E/e/g; - $n =~ s/,/\./g; - $num =~ s/,/\./g; - my $sig = $sign eq '-' ? "." . ($exp - 1 + length $num) : ''; - my $dec = sprintf "%${sig}f", $n; - $dec =~ s/\.[0]+$//g; - return $dec; - } elsif ($n =~ /^\s*([-+]?)(\d+)[\.,]*(\d*)\s*$/) { - return $1.$2.".".$3; - } elsif ($n =~ /^\s*(.*?)\s*$/) { - return $1; - } else { - return $n; - } -} - - -sub execute { - my $self = shift; - my $sql = shift; - eval { - my $sth = $self->{handle}->prepare($sql); - $sth->execute(); - }; - if ($@) { - printf STDERR "bumm %s\n", $@; - } -} - -sub DESTROY { - my $self = shift; - $self->trace("try to clean up command and result files"); - unlink $self->{sql_commandfile} if -f $self->{sql_commandfile}; - unlink $self->{sql_resultfile} if -f $self->{sql_resultfile}; -} - -sub create_commandfile { - my $self = shift; - my $sql = shift; - open CMDCMD, "> $self->{sql_commandfile}"; - printf CMDCMD "%s\n", $sql; - printf CMDCMD "go\n"; - close CMDCMD; -} - -package DBD::MSSQL::Server::Connection::Sqsh; - -use strict; -use File::Temp qw/tempfile/; - -our @ISA = qw(DBD::MSSQL::Server::Connection); - - -sub init { - my $self = shift; - my %params = @_; - my $retval = undef; - $self->{loginstring} = "hostport"; - my $template = $self->{mode}.'XXXXX'; - if ($^O =~ /MSWin/) { - $template =~ s/::/_/g; - } - ($self->{sql_commandfile_handle}, $self->{sql_commandfile}) = - tempfile($template, SUFFIX => ".sql", - DIR => $self->system_tmpdir() ); - close $self->{sql_commandfile_handle}; - ($self->{sql_resultfile_handle}, $self->{sql_resultfile}) = - tempfile($template, SUFFIX => ".out", - DIR => $self->system_tmpdir() ); - close $self->{sql_resultfile_handle}; - ($self->{sql_outfile_handle}, $self->{sql_outfile}) = - tempfile($template, SUFFIX => ".out", - DIR => $self->system_tmpdir() ); - close $self->{sql_outfile_handle}; - - if ($self->{mode} =~ /^server::tnsping/) { - die "oracle leftover"; - } else { - # --server xy --username xy --password xy - # --hostname xy --username xy --password xy - # --hostname xy --port --username xy --password xy - if ($self->{server} && $self->{username} && $self->{password}) { - # --server bba --user nagios --password oradbmon - $self->{loginstring} = "server"; - } elsif ($self->{hostname} && $self->{username} && $self->{password}) { - # --hostname bba --user nagios --password oradbmon - $self->{loginstring} = "server"; - $self->{server} = sprintf 'tcp:%s,%s', $self->{hostname}, $self->{port}; - } else { - $self->{errstr} = "Please specify servername, username and password"; - return undef; - } - } - if (! exists $self->{errstr}) { - eval { - if (! exists $ENV{SQL_HOME}) { - if ($^O =~ /MSWin/) { - foreach my $path (split(';', $ENV{PATH})) { - if (-x $path.'/sqsh.exe') { - $ENV{SQL_HOME} = $path; - last; - } - } - } else { - foreach my $path (split(':', $ENV{PATH})) { - if (-x $path.'/bin/sqsh') { - $ENV{SQL_HOME} = $path; - last; - } - } - } - $ENV{SQL_HOME} |= ''; - } else { - if ($^O =~ /MSWin/) { - $ENV{PATH} = $ENV{SQL_HOME}. - (defined $ENV{PATH} ? ";".$ENV{PATH} : ""); - } else { - $ENV{PATH} = $ENV{SQL_HOME}."/bin". - (defined $ENV{PATH} ? ":".$ENV{PATH} : ""); - $ENV{LD_LIBRARY_PATH} = $ENV{SQL_HOME}."/lib". - (defined $ENV{LD_LIBRARY_PATH} ? ":".$ENV{LD_LIBRARY_PATH} : ""); - } - } - my $sqsh = undef; - my $tnsping = undef; - if (-x $ENV{SQL_HOME}.'/'.'bin'.'/'.'sqsh') { - $sqsh = $ENV{SQL_HOME}.'/'.'bin'.'/'.'sqsh'; - } elsif (-x $ENV{SQL_HOME}.'/'.'sqsh') { - $sqsh = $ENV{SQL_HOME}.'/'.'sqsh'; - } elsif (-x $ENV{SQL_HOME}.'/'.'sqsh.exe') { - $sqsh = $ENV{SQL_HOME}.'/'.'sqsh.exe'; - } elsif (-x '/usr/bin/sqsh') { - $sqsh = '/usr/bin/sqsh'; - } - if (! $sqsh) { - die "nosqsh\n"; - } - if ($self->{mode} =~ /^server::tnsping/) { - die "oracle leftover"; - } else { - if ($self->{loginstring} eq "server") { - $self->{sqsh} = sprintf '"%s" -S %s -U "%s" -P "%s" -i "%s" -o "%s"', - $sqsh, $self->{server}, $self->{username}, $self->{password}, - $self->{sql_commandfile}, $self->{sql_resultfile}; - $self->{sqsh} .= ' -h -s"|"'; - } - } - - use POSIX ':signal_h'; - local $SIG{'ALRM'} = sub { - die "timeout\n"; - }; - if ($^O !~ /MSWin/) { - my $mask = POSIX::SigSet->new( SIGALRM ); - my $action = POSIX::SigAction->new( - sub { die "alarm\n" ; }, $mask); - my $oldaction = POSIX::SigAction->new(); - sigaction(SIGALRM ,$action ,$oldaction ); - } - alarm($self->{timeout} - 1); # 1 second before the global unknown timeout - - my $answer = $self->fetchrow_array( - q{ SELECT 'schnorch' }); - die unless defined $answer and $answer eq 'schnorch'; - $retval = $self; - }; - if ($@) { - $self->{errstr} = $@; - $self->{errstr} =~ s/at $0 .*//g; - chomp $self->{errstr}; - $retval = undef; - } - } - $self->{tac} = Time::HiRes::time(); - return $retval; -} - - -sub fetchrow_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my @row = (); - foreach (@arguments) { - # replace the ? by the parameters - if (/^\d+$/) { - $sql =~ s/\?/$_/; - } else { - $sql =~ s/\?/'$_'/; - } - } - $self->trace(sprintf "SQL (? resolved):\n%s\nARGS:\n%s\n", - $sql, Data::Dumper::Dumper(\@arguments)); - $self->create_commandfile($sql); - my $exit_output = `$self->{sqsh}`; - if ($?) { - printf STDERR "fetchrow_array exit bumm \n"; - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - my @oerrs = map { - /(ORA\-\d+:.*)/ ? $1 : (); - } split(/\n/, $output); - $self->{errstr} = join(" ", @oerrs); - } else { - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - @row = map { convert($_) } - map { s/^\s+([\.\d]+)$/$1/g; $_ } # strip leading space from numbers - map { s/\s+$//g; $_ } # strip trailing space - split(/\|/, (split(/\n/, $output))[0]); - $self->trace(sprintf "RESULT:\n%s\n", - Data::Dumper::Dumper(\@row)); - } - if ($@) { - $self->debug(sprintf "bumm %s", $@); - } - unlink $self->{sql_commandfile}; - unlink $self->{sql_resultfile}; - return $row[0] unless wantarray; - return @row; -} - -sub fetchall_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my $rows = undef; - foreach (@arguments) { - # replace the ? by the parameters - if (/^\d+$/) { - $sql =~ s/\?/$_/; - } else { - $sql =~ s/\?/'$_'/; - } - } - $self->trace(sprintf "SQL (? resolved):\n%s\nARGS:\n%s\n", - $sql, Data::Dumper::Dumper(\@arguments)); - $self->create_commandfile($sql); - my $exit_output = `$self->{sqsh}`; - if ($?) { - printf STDERR "fetchrow_array exit bumm %s\n", $exit_output; - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - my @oerrs = map { - /(ORA\-\d+:.*)/ ? $1 : (); - } split(/\n/, $output); - $self->{errstr} = join(" ", @oerrs); - } else { - my $output = do { local (@ARGV, $/) = $self->{sql_resultfile}; <> }; - my @rows = map { [ - map { convert($_) } - map { s/^\s+([\.\d]+)$/$1/g; $_ } - map { s/\s+$//g; $_ } - split /\|/ - ] } grep { ! /^\(\d+ rows affected\)/ } - grep { ! /^\s*$/ } - grep { ! /^Database name .* ignored, referencing object in/ } split(/\n/, $output); - $rows = \@rows; - $self->trace(sprintf "RESULT:\n%s\n", - Data::Dumper::Dumper($rows)); - } - if ($@) { - $self->debug(sprintf "bumm %s", $@); - } - unlink $self->{sql_commandfile}; - unlink $self->{sql_resultfile}; - return @{$rows}; -} - -sub func { - my $self = shift; - my $function = shift; - $self->{handle}->func(@_); -} - -sub convert { - my $n = shift; - # mostly used to convert numbers in scientific notation - if ($n =~ /^\s*\d+\s*$/) { - return $n; - } elsif ($n =~ /^\s*([-+]?)(\d*[\.,]*\d*)[eE]{1}([-+]?)(\d+)\s*$/) { - my ($vor, $num, $sign, $exp) = ($1, $2, $3, $4); - $n =~ s/E/e/g; - $n =~ s/,/\./g; - $num =~ s/,/\./g; - my $sig = $sign eq '-' ? "." . ($exp - 1 + length $num) : ''; - my $dec = sprintf "%${sig}f", $n; - $dec =~ s/\.[0]+$//g; - return $dec; - } elsif ($n =~ /^\s*([-+]?)(\d+)[\.,]*(\d*)\s*$/) { - return $1.$2.".".$3; - } elsif ($n =~ /^\s*(.*?)\s*$/) { - return $1; - } else { - return $n; - } -} - - -sub execute { - my $self = shift; - my $sql = shift; - eval { - my $sth = $self->{handle}->prepare($sql); - $sth->execute(); - }; - if ($@) { - printf STDERR "bumm %s\n", $@; - } -} - -sub DESTROY { - my $self = shift; - $self->trace("try to clean up command and result files"); - unlink $self->{sql_commandfile} if -f $self->{sql_commandfile}; - unlink $self->{sql_resultfile} if -f $self->{sql_resultfile}; -} - -sub create_commandfile { - my $self = shift; - my $sql = shift; - open CMDCMD, "> $self->{sql_commandfile}"; - printf CMDCMD "%s\n", $sql; - printf CMDCMD "go\n"; - close CMDCMD; -} - -package DBD::MSSQL::Server::Connection::Sqlrelay; - -use strict; -use Net::Ping; - -our @ISA = qw(DBD::MSSQL::Server::Connection); - - -sub init { - my $self = shift; - my %params = @_; - my $retval = undef; - if ($self->{mode} =~ /^server::tnsping/) { - } else { - if (! $self->{hostname} || ! $self->{username} || ! $self->{password} || ! $self->{port}) { - $self->{errstr} = "Please specify database, username and password"; - return undef; - } - } - if (! exists $self->{errstr}) { - my $stderrvar; - eval { - require DBI; - use POSIX ':signal_h'; - local $SIG{'ALRM'} = sub { - die "alarm\n"; - }; - my $mask = POSIX::SigSet->new( SIGALRM ); - my $action = POSIX::SigAction->new( - sub { die "alarm\n" ; }, $mask); - my $oldaction = POSIX::SigAction->new(); - sigaction(SIGALRM ,$action ,$oldaction ); - alarm($self->{timeout} - 1); # 1 second before the global unknown timeout - *SAVEERR = *STDERR; - open OUT ,'>',\$stderrvar; - *STDERR = *OUT; - if ($self->{handle} = DBI->connect( - #sprintf("DBI:SQLRelay:host=%s;port=%d;socket=%s", - sprintf("DBI:SQLRelay:host=%s;port=%d;", - $self->{hostname}, $self->{port}), - $self->{username}, - $self->{password}, - { RaiseError => 1, AutoCommit => 0, PrintError => 1 })) { - } else { - $self->{errstr} = DBI::errstr(); - } - my $answer = $self->fetchrow_array( - q{ SELECT 42 }); - die $self->{errstr} unless defined $answer and $answer == 42; - *STDERR = *SAVEERR; - }; - if ($@) { - $self->{errstr} = $@; - $self->{errstr} =~ s/at [\w\/\.]+ line \d+.*//g; - $retval = undef; - } - } - $self->{tac} = Time::HiRes::time(); - return $retval; -} - -sub fetchrow_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my @row = (); - my $new_dbh = $self->{handle}->clone(); - $self->trace(sprintf "fetchrow_array: %s", $sql); - # - # does not work with bind variables - # - while ($sql =~ /\?/) { - my $param = shift @arguments; - if ($param !~ /^\d+$/) { - $param = $self->{handle}->quote($param); - } - $sql =~ s/\?/$param/; - } - $sql =~ s/^\s*//g; - $sql =~ s/\s*$//g; - eval { - $sth = $self->{handle}->prepare($sql); - if (scalar(@arguments)) { - $sth->execute(@arguments); - } else { - $sth->execute(); - } - @row = $sth->fetchrow_array(); - $sth->finish(); - }; - if ($@) { - $self->debug(sprintf "bumm %s", $@); - } - # without this trick, there are error messages like - # "No server-side cursors were available to process the query" - # and the results are messed up. - $self->{handle}->disconnect(); - $self->{handle} = $new_dbh; - if (-f "/tmp/check_mssql_health_simulation/".$self->{mode}) { - my $simulation = do { local (@ARGV, $/) = - "/tmp/check_mssql_health_simulation/".$self->{mode}; <> }; - @row = split(/\s+/, (split(/\n/, $simulation))[0]); - } - return $row[0] unless wantarray; - return @row; -} - -sub fetchall_array { - my $self = shift; - my $sql = shift; - my @arguments = @_; - my $sth = undef; - my $rows = undef; - my $new_dbh = $self->{handle}->clone(); - $self->trace(sprintf "fetchall_array: %s", $sql); - while ($sql =~ /\?/) { - my $param = shift @arguments; - if ($param !~ /^\d+$/) { - $param = $self->{handle}->quote($param); - } - $sql =~ s/\?/$param/; - } - eval { - $sth = $self->{handle}->prepare($sql); - if (scalar(@arguments)) { - $sth->execute(@arguments); - } else { - $sth->execute(); - } - $rows = $sth->fetchall_arrayref(); - my $asrows = $sth->fetchall_arrayref(); - $sth->finish(); - }; - if ($@) { - printf STDERR "bumm %s\n", $@; - } - $self->{handle}->disconnect(); - $self->{handle} = $new_dbh; - if (-f "/tmp/check_mssql_health_simulation/".$self->{mode}) { - my $simulation = do { local (@ARGV, $/) = - "/tmp/check_mssql_health_simulation/".$self->{mode}; <> }; - @{$rows} = map { [ split(/\s+/, $_) ] } split(/\n/, $simulation); - } - return @{$rows}; -} - -sub func { - my $self = shift; - $self->{handle}->func(@_); -} - - -sub execute { - my $self = shift; - my $sql = shift; - eval { - my $sth = $self->{handle}->prepare($sql); - $sth->execute(); - }; - if ($@) { - printf STDERR "bumm %s\n", $@; - } -} - -sub DESTROY { - my $self = shift; - #$self->trace(sprintf "disconnecting DBD %s", - # $self->{handle} ? "with handle" : "without handle"); - #$self->{handle}->disconnect() if $self->{handle}; -} - - - - - -package Extraopts; - -use strict; -use File::Basename; -use Data::Dumper; - -sub new { - my $class = shift; - my %params = @_; - my $self = { - file => $params{file}, - commandline => $params{commandline}, - config => {}, - section => 'default_no_section', - }; - bless $self, $class; - $self->prepare_file_and_section(); - $self->init(); - return $self; -} - -sub prepare_file_and_section { - my $self = shift; - if (! defined $self->{file}) { - # ./check_stuff --extra-opts - $self->{section} = basename($0); - $self->{file} = $self->get_default_file(); - } elsif ($self->{file} =~ /^[^@]+$/) { - # ./check_stuff --extra-opts=special_opts - $self->{section} = $self->{file}; - $self->{file} = $self->get_default_file(); - } elsif ($self->{file} =~ /^@(.*)/) { - # ./check_stuff --extra-opts=@/etc/myconfig.ini - $self->{section} = basename($0); - $self->{file} = $1; - } elsif ($self->{file} =~ /^(.*?)@(.*)/) { - # ./check_stuff --extra-opts=special_opts@/etc/myconfig.ini - $self->{section} = $1; - $self->{file} = $2; - } -} - -sub get_default_file { - my $self = shift; - foreach my $default (qw(/etc/nagios/plugins.ini - /usr/local/nagios/etc/plugins.ini - /usr/local/etc/nagios/plugins.ini - /etc/opt/nagios/plugins.ini - /etc/nagios-plugins.ini - /usr/local/etc/nagios-plugins.ini - /etc/opt/nagios-plugins.ini)) { - if (-f $default) { - return $default; - } - } - return undef; -} - -sub init { - my $self = shift; - if (! defined $self->{file}) { - $self->{errors} = sprintf 'no extra-opts file specified and no default file found'; - } elsif (! -f $self->{file}) { - $self->{errors} = sprintf 'could not open %s', $self->{file}; - } else { - my $data = do { local (@ARGV, $/) = $self->{file}; <> }; - my $in_section = 'default_no_section'; - foreach my $line (split(/\n/, $data)) { - if ($line =~ /\[(.*)\]/) { - $in_section = $1; - } elsif ($line =~ /(.*)=(.*)/) { - $self->{config}->{$in_section}->{$1} = $2; - } - } - } -} - -sub is_valid { - my $self = shift; - return ! exists $self->{errors}; -} - -sub overwrite { - my $self = shift; - my %commandline = (); - if (scalar(keys %{$self->{config}->{default_no_section}}) > 0) { - foreach (keys %{$self->{config}->{default_no_section}}) { - $commandline{$_} = $self->{config}->{default_no_section}->{$_}; - } - } - if (exists $self->{config}->{$self->{section}}) { - foreach (keys %{$self->{config}->{$self->{section}}}) { - $commandline{$_} = $self->{config}->{$self->{section}}->{$_}; - } - } - foreach (keys %commandline) { - if (! exists $self->{commandline}->{$_}) { - $self->{commandline}->{$_} = $commandline{$_}; - } - } -} - - - -package main; - -use strict; -use Getopt::Long qw(:config no_ignore_case); -use File::Basename; -use lib dirname($0); - - - -use vars qw ($PROGNAME $REVISION $CONTACT $TIMEOUT $STATEFILESDIR $needs_restart %commandline); - -$PROGNAME = "check_mssql_health"; -$REVISION = '$Revision: 1.5.8.2 $'; -$CONTACT = 'gerhard.lausser@consol.de'; -$TIMEOUT = 60; -$STATEFILESDIR = '/var/tmp/check_mssql_health'; -$needs_restart = 0; - -my @modes = ( - ['server::connectiontime', - 'connection-time', undef, - 'Time to connect to the server' ], - ['server::cpubusy', - 'cpu-busy', undef, - 'Cpu busy in percent' ], - ['server::iobusy', - 'io-busy', undef, - 'IO busy in percent' ], - ['server::fullscans', - 'full-scans', undef, - 'Full table scans per second' ], - ['server::connectedusers', - 'connected-users', undef, - 'Number of currently connected users' ], - ['server::database::transactions', - 'transactions', undef, - 'Transactions per second (per database)' ], - ['server::batchrequests', - 'batch-requests', undef, - 'Batch requests per second' ], - ['server::latch::waits', - 'latches-waits', undef, - 'Number of latch requests that could not be granted immediately' ], - ['server::latch::waittime', - 'latches-wait-time', undef, - 'Average time for a latch to wait before the request is met' ], - ['server::memorypool::lock::waits', - 'locks-waits', undef, - 'The number of locks per second that had to wait' ], - ['server::memorypool::lock::timeouts', - 'locks-timeouts', undef, - 'The number of locks per second that timed out' ], - ['server::memorypool::lock::deadlocks', - 'locks-deadlocks', undef, - 'The number of deadlocks per second' ], - ['server::sql::recompilations', - 'sql-recompilations', undef, - 'Re-Compilations per second' ], - ['server::sql::initcompilations', - 'sql-initcompilations', undef, - 'Initial compilations per second' ], - ['server::totalmemory', - 'total-server-memory', undef, - 'The amount of memory that SQL Server has allocated to it' ], - ['server::memorypool::buffercache::hitratio', - 'mem-pool-data-buffer-hit-ratio', ['buffer-cache-hit-ratio'], - 'Data Buffer Cache Hit Ratio' ], - - - ['server::memorypool::buffercache::lazywrites', - 'lazy-writes', undef, - 'Lazy writes per second' ], - ['server::memorypool::buffercache::pagelifeexpectancy', - 'page-life-expectancy', undef, - 'Seconds a page is kept in memory before being flushed' ], - ['server::memorypool::buffercache::freeliststalls', - 'free-list-stalls', undef, - 'Requests per second that had to wait for a free page' ], - ['server::memorypool::buffercache::checkpointpages', - 'checkpoint-pages', undef, - 'Dirty pages flushed to disk per second. (usually by a checkpoint)' ], - - - ['server::database::databasefree', - 'database-free', undef, - 'Free space in database' ], - ['server::database::backupage', - 'database-backup-age', ['backup-age'], - 'Elapsed time (in hours) since a database was last backupped' ], - ['server::sql', - 'sql', undef, - 'any sql command returning a single number' ], - ['server::database::listdatabases', - 'list-databases', undef, - 'convenience function which lists all databases' ], - ['server::database::datafile::listdatafiles', - 'list-datafiles', undef, - 'convenience function which lists all datafiles' ], - ['server::memorypool::lock::listlocks', - 'list-locks', undef, - 'convenience function which lists all locks' ], -); - -sub print_usage () { - print <] --hostname= - --username= --password= [--port ] - --mode= - $PROGNAME [-v] [-t ] --server= - --username= --password= - --mode= - $PROGNAME [-h | --help] - $PROGNAME [-V | --version] - - Options: - --hostname - the database server - --port - the database server's port - --server - the name of a predefined connection - --currentdb - the name of a database which is used as the current database - for the connection. (don't use this parameter unless you - know what you're doing) - --username - the mssql user - --password - the mssql user's password - --warning - the warning range - --critical - the critical range - --mode - the mode of the plugin. select one of the following keywords: -EOUS - my $longest = length ((reverse sort {length $a <=> length $b} map { $_->[1] } @modes)[0]); - my $format = " %-". - (length ((reverse sort {length $a <=> length $b} map { $_->[1] } @modes)[0])). - "s\t(%s)\n"; - foreach (@modes) { - printf $format, $_->[1], $_->[3]; - } - printf "\n"; - print <new(file => $commandline{'extra-opts'}, commandline => \%commandline); - if (! $extras->is_valid()) { - printf "extra-opts are not valid: %s\n", $extras->{errors}; - exit $ERRORS{UNKNOWN}; - } else { - $extras->overwrite(); - } -} - -if (exists $commandline{version}) { - print_revision($PROGNAME, $REVISION); - exit $ERRORS{OK}; -} - -if (exists $commandline{help}) { - print_help(); - exit $ERRORS{OK}; -} elsif (! exists $commandline{mode}) { - printf "Please select a mode\n"; - print_help(); - exit $ERRORS{OK}; -} - -if ($commandline{mode} eq "encode") { - my $input = <>; - chomp $input; - $input =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; - printf "%s\n", $input; - exit $ERRORS{OK}; -} - -if (exists $commandline{3}) { - $ENV{NRPE_MULTILINESUPPORT} = 1; -} - -if (exists $commandline{timeout}) { - $TIMEOUT = $commandline{timeout}; -} - -if (exists $commandline{verbose}) { - $DBD::MSSQL::Server::verbose = exists $commandline{verbose}; -} - -if (exists $commandline{scream}) { -# $DBD::MSSQL::Server::hysterical = exists $commandline{scream}; -} - -if (exists $commandline{report}) { - # short, long, html -} else { - $commandline{report} = "long"; -} - -if (exists $commandline{'with-mymodules-dyn-dir'}) { - $DBD::MSSQL::Server::my_modules_dyn_dir = $commandline{'with-mymodules-dyn-dir'}; -} else { - $DBD::MSSQL::Server::my_modules_dyn_dir = '/usr/local/nagios/libexec'; -} - - -if (exists $commandline{environment}) { - # if the desired environment variable values are different from - # the environment of this running script, then a restart is necessary. - # because setting $ENV does _not_ change the environment of the running script. - foreach (keys %{$commandline{environment}}) { - if ((! $ENV{$_}) || ($ENV{$_} ne $commandline{environment}->{$_})) { - $needs_restart = 1; - $ENV{$_} = $commandline{environment}->{$_}; - printf STDERR "new %s=%s forces restart\n", $_, $ENV{$_} - if $DBD::MSSQL::Server::verbose; - } - } - # e.g. called with --runas dbnagio. shlib_path environment variable is stripped - # during the sudo. - # so the perl interpreter starts without a shlib_path. but --runas cares for - # a --environment shlib_path=... - # so setting the environment variable in the code above and restarting the - # perl interpreter will help it find shared libs -} - -if (exists $commandline{runas}) { - # remove the runas parameter - # exec sudo $0 ... the remaining parameters - $needs_restart = 1; - # if the calling script has a path for shared libs and there is no --environment - # parameter then the called script surely needs the variable too. - foreach my $important_env qw(LD_LIBRARY_PATH SHLIB_PATH - MSSQL_HOME TNS_ADMIN ORA_NLS ORA_NLS33 ORA_NLS10) { - if ($ENV{$important_env} && ! scalar(grep { /^$important_env=/ } - keys %{$commandline{environment}})) { - $commandline{environment}->{$important_env} = $ENV{$important_env}; - printf STDERR "add important --environment %s=%s\n", - $important_env, $ENV{$important_env} if $DBD::MSSQL::Server::verbose; - } - } -} - -if ($needs_restart) { - my @newargv = (); - my $runas = undef; - if (exists $commandline{runas}) { - $runas = $commandline{runas}; - delete $commandline{runas}; - } - foreach my $option (keys %commandline) { - if (grep { /^$option/ && /=/ } @params) { - if (ref ($commandline{$option}) eq "HASH") { - foreach (keys %{$commandline{$option}}) { - push(@newargv, sprintf "--%s", $option); - push(@newargv, sprintf "%s=%s", $_, $commandline{$option}->{$_}); - } - } else { - push(@newargv, sprintf "--%s", $option); - push(@newargv, sprintf "%s", $commandline{$option}); - } - } else { - push(@newargv, sprintf "--%s", $option); - } - } - if ($runas && ($> == 0)) { - # this was not my idea. some people connect as root to their nagios clients. - exec "su", "-c", sprintf("%s %s", $0, join(" ", @newargv)), "-", $runas; - } elsif ($runas) { - exec "sudo", "-S", "-u", $runas, $0, @newargv; - } else { - exec $0, @newargv; - # this makes sure that even a SHLIB or LD_LIBRARY_PATH are set correctly - # when the perl interpreter starts. Setting them during runtime does not - # help loading e.g. libclntsh.so - } - exit; -} - -if (exists $commandline{shell}) { - # forget what you see here. - system("/bin/sh"); -} - -if (exists $commandline{name}) { - # objects can be encoded like an url - # with s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; - if (($commandline{mode} ne "sql") || - (($commandline{mode} eq "sql") && - ($commandline{name} =~ /select%20/i))) { # protect ... like '%cac%' ... from decoding - $commandline{name} =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; - } - if ($commandline{name} =~ /^0$/) { - # without this, $params{selectname} would be treated like undef - $commandline{name} = "00"; - } -} - -$SIG{'ALRM'} = sub { - printf "UNKNOWN - %s timed out after %d seconds\n", $PROGNAME, $TIMEOUT; - exit $ERRORS{UNKNOWN}; -}; -alarm($TIMEOUT); - -my $nagios_level = $ERRORS{UNKNOWN}; -my $nagios_message = ""; -my $perfdata = ""; -my $racmode = 0; -if ($commandline{mode} =~ /^rac-([^\-.]+)/) { - $racmode = 1; - $commandline{mode} =~ s/^rac\-//g; -} -if ($commandline{mode} =~ /^my-([^\-.]+)/) { - my $param = $commandline{mode}; - $param =~ s/\-/::/g; - push(@modes, [$param, $commandline{mode}, undef, 'my extension']); -} elsif ((! grep { $commandline{mode} eq $_ } map { $_->[1] } @modes) && - (! grep { $commandline{mode} eq $_ } map { defined $_->[2] ? @{$_->[2]} : () } @modes)) { - printf "UNKNOWN - mode %s\n", $commandline{mode}; - print_usage(); - exit 3; -} - -my %params = ( - timeout => $TIMEOUT, - mode => ( - map { $_->[0] } - grep { - ($commandline{mode} eq $_->[1]) || - ( defined $_->[2] && grep { $commandline{mode} eq $_ } @{$_->[2]}) - } @modes - )[0], - cmdlinemode => $commandline{mode}, - method => $commandline{method} || - $ENV{NAGIOS__SERVICEMSSQL_METH} || - $ENV{NAGIOS__HOSTMSSQL_METH} || 'dbi', - hostname => $commandline{hostname} || - $ENV{NAGIOS__SERVICEMSSQL_HOST} || - $ENV{NAGIOS__HOSTMSSQL_HOST}, - username => $commandline{username} || - $ENV{NAGIOS__SERVICEMSSQL_USER} || - $ENV{NAGIOS__HOSTMSSQL_USER}, - password => $commandline{password} || - $ENV{NAGIOS__SERVICEMSSQL_PASS} || - $ENV{NAGIOS__HOSTMSSQL_PASS}, - port => $commandline{port} || - $ENV{NAGIOS__SERVICEMSSQL_PORT} || - $ENV{NAGIOS__HOSTMSSQL_PORT}, - server => $commandline{server} || - $ENV{NAGIOS__SERVICEMSSQL_SERVER} || - $ENV{NAGIOS__HOSTMSSQL_SERVER}, - currentdb => $commandline{currentdb} || - $ENV{NAGIOS__SERVICEMSSQL_CURRENTDB} || - $ENV{NAGIOS__HOSTMSSQL_CURRENTDB}, - warningrange => $commandline{warning}, - criticalrange => $commandline{critical}, - dbthresholds => $commandline{dbthresholds}, - absolute => $commandline{absolute}, - lookback => $commandline{lookback}, - tablespace => $commandline{tablespace}, - database => $commandline{database}, - datafile => $commandline{datafile}, - basis => $commandline{basis}, - selectname => $commandline{name} || $commandline{tablespace} || $commandline{datafile}, - regexp => $commandline{regexp}, - name => $commandline{name}, - name2 => $commandline{name2} || $commandline{name}, - units => $commandline{units}, - eyecandy => $commandline{eyecandy}, - statefilesdir => $STATEFILESDIR, - verbose => $commandline{verbose}, - report => $commandline{report}, -); - -my $server = undef; - -$server = DBD::MSSQL::Server->new(%params); -$server->nagios(%params); -$server->calculate_result(); -$nagios_message = $server->{nagios_message}; -$nagios_level = $server->{nagios_level}; -$perfdata = $server->{perfdata}; - -printf "%s - %s", $ERRORCODES{$nagios_level}, $nagios_message; -printf " | %s", $perfdata if $perfdata; -printf "\n"; -exit $nagios_level; diff --git a/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/subst b/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/subst deleted file mode 100644 index dedf856..0000000 --- a/check_mssql_health/src/check_mssql_health-1.5.8.2/plugins-scripts/subst +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/awk - -function which(c,path) { - cmd = "test -x " c; - - if (system(cmd)==0) { - return c; - } - - sub(/\/.*\//,"",c); - for (dir in path) { - cmd = "test -x " path[dir] "/" c; - if (system(cmd)==0) { - return path[dir] "/" c; - } - } - - - return c; -} - -# used to replace "use lib utils.pm" with "use lib @libexecdir" -# -function led() { - led1 = "${exec_prefix}/libexec"; - led2 = "${prefix}"; - led3 = "/usr/local/nagios"; - if ( match(led1, /^\$\{exec_prefix\}/ ) != 0 ) { - return "\"" led3 "/libexec\" " ; - - } - return "\"" led1 "\"" ; -} - -BEGIN { - split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/); - -} - -# scripting language (first line) - -/^#! ?\/.*\/python/ {sub(/^#! ?\/.*\/python/,"#! @PYTHON@");} -/^#! ?\/.*\/perl/ {sub(/^#! ?\/.*\/perl/,"#! /usr/bin/perl");} -/^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! /usr/bin/gawk");} -/^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! /bin/bash");} - -# add to libexecdir to INC for perl utils.pm -/^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } } - - -# Replace the placeholders with the values from configure -/#PERL#/ {sub(/#PERL#/,"/usr/bin/perl");} -/#GZIP#/ {sub(/#GZIP#/,"/bin/gzip");} -/#STATEFILES_DIR#/ {sub(/#STATEFILES_DIR#/,"/var/tmp/check_mssql_health");} -/#PACKAGE_VERSION#/ {sub(/#PACKAGE_VERSION#/,"1.5.8.2");} -/#MYMODULES_DYN_DIR#/ {sub(/#MYMODULES_DYN_DIR#/,"/usr/local/nagios/libexec");} - -{ - print; -} - diff --git a/check_mssql_health/src/check_mssql_health-1.5.8.2/t/Makefile b/check_mssql_health/src/check_mssql_health-1.5.8.2/t/Makefile deleted file mode 100644 index 4dc546a..0000000 --- a/check_mssql_health/src/check_mssql_health-1.5.8.2/t/Makefile +++ /dev/null @@ -1,297 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# t/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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. - - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/check_mssql_health -pkglibdir = $(libdir)/check_mssql_health -pkgincludedir = $(includedir)/check_mssql_health -top_builddir = .. -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 = x86_64-unknown-linux-gnu -host_triplet = x86_64-unknown-linux-gnu -subdir = t -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -INSTALL = /usr/bin/install -c -ACLOCAL = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run aclocal-1.9 -AMTAR = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run tar -AUTOCONF = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoconf -AUTOHEADER = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run autoheader -AUTOMAKE = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run automake-1.9 -AWK = /usr/bin/gawk -CAT = /bin/cat -CYGPATH_W = echo -DEFS = -DPACKAGE_NAME=\"check_mssql_health\" -DPACKAGE_TARNAME=\"check_mssql_health\" -DPACKAGE_VERSION=\"1.5.8.2\" -DPACKAGE_STRING=\"check_mssql_health\ 1.5.8.2\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"check_mssql_health\" -DVERSION=\"1.5.8.2\" -ECHO = /bin/echo -ECHO_C = -ECHO_N = -n -ECHO_T = -GREP = /bin/grep -GZIP = /bin/gzip -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_OPTS = -o nagios -g nagios -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -LIBOBJS = -LIBS = -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/missing --run makeinfo -MYMODULES_DIR = /usr/local/nagios/libexec -MYMODULES_DYN_DIR = /usr/local/nagios/libexec -PACKAGE = check_mssql_health -PACKAGE_BUGREPORT = -PACKAGE_NAME = check_mssql_health -PACKAGE_STRING = check_mssql_health 1.5.8.2 -PACKAGE_TARNAME = check_mssql_health -PACKAGE_VERSION = 1.5.8.2 -PATH_SEPARATOR = : -PERL = /usr/bin/perl -RELEASE = 1 -SED = /bin/sed -SET_MAKE = -SH = /bin/sh -SHELL = /bin/bash -STATEFILES_DIR = /var/tmp/check_mssql_health -STRIP = -SUPPORT = Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n -VERSION = 1.5.8.2 -WARRANTY = This plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugin under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n -ac_ct_STRIP = -am__leading_dot = . -am__tar = tar --format=posix -chf - "$$tardir" -am__untar = tar -xf - -bindir = ${exec_prefix}/bin -build = x86_64-unknown-linux-gnu -build_alias = -build_cpu = x86_64 -build_os = linux-gnu -build_vendor = unknown -datadir = ${prefix}/share -exec_prefix = ${prefix} -host = x86_64-unknown-linux-gnu -host_alias = -host_cpu = x86_64 -host_os = linux-gnu -host_vendor = unknown -includedir = ${prefix}/include -infodir = ${prefix}/info -install_sh = /home/palli/projects/okconfig/nagios-plugins/check_mssql_health/src/check_mssql_health-1.5.8.2/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localstatedir = ${prefix}/var -mandir = ${prefix}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -prefix = /usr/local/nagios -program_transform_name = s,x,x, -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target_alias = -with_nagios_group = nagios -with_nagios_user = nagios -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: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu t/Makefile'; \ - 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: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$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: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -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: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-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: