diff options
author | manu <manu> | 2013-01-19 09:59:12 +0000 |
---|---|---|
committer | manu <manu> | 2013-01-19 09:59:12 +0000 |
commit | a7292cf5f8b740654205ce56ed9d694a7a9fef90 (patch) | |
tree | f4708ff930d770ff3f4ed0a73c37bf33f8f134e7 /net | |
parent | 6ffc6cc633e5bab9110c9d0becd14ae972233724 (diff) | |
download | pkgsrc-a7292cf5f8b740654205ce56ed9d694a7a9fef90.tar.gz |
Add NetBSD support in check_ide_smart
Patch submitted upstream, but without much success
Diffstat (limited to 'net')
-rw-r--r-- | net/nagios-plugins/Makefile | 10 | ||||
-rw-r--r-- | net/nagios-plugins/PLIST | 3 | ||||
-rw-r--r-- | net/nagios-plugins/distinfo | 5 | ||||
-rw-r--r-- | net/nagios-plugins/patches/patch-configure | 336 | ||||
-rw-r--r-- | net/nagios-plugins/patches/patch-configure.in | 50 | ||||
-rw-r--r-- | net/nagios-plugins/patches/patch-plugins_check_ide_smart.c | 157 |
6 files changed, 556 insertions, 5 deletions
diff --git a/net/nagios-plugins/Makefile b/net/nagios-plugins/Makefile index 82aecb7a9e5..dd219851bd0 100644 --- a/net/nagios-plugins/Makefile +++ b/net/nagios-plugins/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.29 2012/10/03 21:56:57 wiz Exp $ +# $NetBSD: Makefile,v 1.30 2013/01/19 09:59:12 manu Exp $ # -PKGREVISION= 3 +PKGREVISION= 4 CATEGORIES= net sysutils MAINTAINER= pkgsrc-users@NetBSD.org @@ -27,15 +27,19 @@ CONFIGURE_ARGS+= --without-pgsql --without-mysql \ SPECIAL_PERMS+= ${PREFIX}/libexec/nagios/check_icmp ${SETUID_ROOT_PERMS} SPECIAL_PERMS+= ${PREFIX}/libexec/nagios/check_dhcp ${SETUID_ROOT_PERMS} -PLIST_VARS+= linux sunos +PLIST_VARS+= linux sunos NetBSD .if ${OPSYS} == "Linux" PLIST.linux= yes .elif ${OPSYS} == "SunOS" PLIST.sunos= yes +.elif ${OPSYS} == "NetBSD" +PLIST.NetBSD= yes .endif .if ${OPSYS} == "NetBSD" CONFIGURE_ARGS+= --with-df-command="/bin/df -Pklt nokernfs,procfs,fdesc" +SPECIAL_PERMS+= ${PREFIX}/libexec/nagios/check_ide_smart \ + ${REAL_ROOT_USER} ${NAGIOS_GROUP} 4551 .endif # required to enable large file support on Solaris diff --git a/net/nagios-plugins/PLIST b/net/nagios-plugins/PLIST index d5a484c2e07..a8a628ffd33 100644 --- a/net/nagios-plugins/PLIST +++ b/net/nagios-plugins/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.8 2012/07/25 12:01:54 fhajny Exp $ +@comment $NetBSD: PLIST,v 1.9 2013/01/19 09:59:12 manu Exp $ libexec/nagios/check_by_ssh libexec/nagios/check_clamd libexec/nagios/check_dhcp @@ -11,6 +11,7 @@ libexec/nagios/check_ftp libexec/nagios/check_http libexec/nagios/check_icmp ${PLIST.linux}libexec/nagios/check_ide_smart +${PLIST.NetBSD}libexec/nagios/check_ide_smart libexec/nagios/check_imap libexec/nagios/check_ircd libexec/nagios/check_jabber diff --git a/net/nagios-plugins/distinfo b/net/nagios-plugins/distinfo index e203084c43f..911f3c0fa17 100644 --- a/net/nagios-plugins/distinfo +++ b/net/nagios-plugins/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.12 2012/07/25 12:01:54 fhajny Exp $ +$NetBSD: distinfo,v 1.13 2013/01/19 09:59:12 manu Exp $ SHA1 (nagios-plugins-1.4.15.tar.gz) = 1faab309c06d37e559490fd852ecb0dc8a8ab610 RMD160 (nagios-plugins-1.4.15.tar.gz) = c2780a3523cf4eaaed34a94c07f5f6bd6fb1f736 @@ -13,4 +13,7 @@ SHA1 (patch-ak) = dd9aba7a0930a6448e372b581ba04d62018a973b SHA1 (patch-al) = 63e28ae36d671e773acfe6aeb45ab7603c112594 SHA1 (patch-am) = adc95ba1037a7d7caab6dde6ca1e27e47754db62 SHA1 (patch-an) = 372a111ed040114479e363e42d66e2281d0d629f +SHA1 (patch-configure) = 16eec1d6b42401184ef4892a68353c476cc63cc5 +SHA1 (patch-configure.in) = 7db3d0ac3bbb6c1f6b05a5a3e9e4813a9635aecf SHA1 (patch-plugins__check_swap.c) = d7557d1e6823e8bfeb02706ba914685c564bfdea +SHA1 (patch-plugins_check_ide_smart.c) = 9eccab59931bbfe102f1166be36c6939a6e3a1ae diff --git a/net/nagios-plugins/patches/patch-configure b/net/nagios-plugins/patches/patch-configure new file mode 100644 index 00000000000..02e292c0c79 --- /dev/null +++ b/net/nagios-plugins/patches/patch-configure @@ -0,0 +1,336 @@ +$NetBSD: patch-configure,v 1.1 2013/01/19 09:59:12 manu Exp $ + +Enable check_smart_ide for NetBSD + +--- configure.orig 2013-01-03 05:43:34.000000000 +0100 ++++ configure 2013-01-03 06:02:14.000000000 +0100 +@@ -15047,9 +15047,11 @@ + echo "$as_me: WARNING: install LDAP libs to compile this plugin (see REQUIREMENTS)." >&2;} + fi + LIBS="$_SAVEDLIBS" + +-if test "${ac_cv_header_linux_hdreg_h+set}" = set; then ++case $host in ++ *linux*) ++ if test "${ac_cv_header_linux_hdreg_h+set}" = set; then + { echo "$as_me:$LINENO: checking for linux/hdreg.h" >&5 + echo $ECHO_N "checking for linux/hdreg.h... $ECHO_C" >&6; } + if test "${ac_cv_header_linux_hdreg_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +@@ -15179,10 +15181,10 @@ + FOUNDINCLUDE=no + fi + + +-if test "$FOUNDINCLUDE" = "yes" ; then +- if test "${ac_cv_header_linux_types_h+set}" = set; then ++ if test "$FOUNDINCLUDE" = "yes" ; then ++ if test "${ac_cv_header_linux_types_h+set}" = set; then + { echo "$as_me:$LINENO: checking for linux/types.h" >&5 + echo $ECHO_N "checking for linux/types.h... $ECHO_C" >&6; } + if test "${ac_cv_header_linux_types_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +@@ -15312,17 +15314,299 @@ + FOUNDINCLUDE=no + fi + + ++ fi ++ if test "$FOUNDINCLUDE" = "no" ; then ++ { echo "$as_me:$LINENO: WARNING: Skipping check_ide_smart plugin." >&5 ++echo "$as_me: WARNING: Skipping check_ide_smart plugin." >&2;} ++ { echo "$as_me:$LINENO: WARNING: check_ide_smart requires linux/hdreg.h and linux/types.h." >&5 ++echo "$as_me: WARNING: check_ide_smart requires linux/hdreg.h and linux/types.h." >&2;} ++ fi ++ ;; ++ *netbsd*) ++ if test "${ac_cv_header_dev_ata_atareg_h+set}" = set; then ++ { echo "$as_me:$LINENO: checking for dev/ata/atareg.h" >&5 ++echo $ECHO_N "checking for dev/ata/atareg.h... $ECHO_C" >&6; } ++if test "${ac_cv_header_dev_ata_atareg_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + fi ++{ echo "$as_me:$LINENO: result: $ac_cv_header_dev_ata_atareg_h" >&5 ++echo "${ECHO_T}$ac_cv_header_dev_ata_atareg_h" >&6; } ++else ++ # Is the header compilable? ++{ echo "$as_me:$LINENO: checking dev/ata/atareg.h usability" >&5 ++echo $ECHO_N "checking dev/ata/atareg.h usability... $ECHO_C" >&6; } ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++#include <dev/ata/atareg.h> ++_ACEOF ++rm -f conftest.$ac_objext ++if { (ac_try="$ac_compile" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_compile") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest.$ac_objext; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 + +-if test "$FOUNDINCLUDE" = "yes" ; then +- EXTRAS="$EXTRAS check_ide_smart" ++ ac_header_compiler=no ++fi ++ ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6; } ++ ++# Is the header present? ++{ echo "$as_me:$LINENO: checking dev/ata/atareg.h presence" >&5 ++echo $ECHO_N "checking dev/ata/atareg.h presence... $ECHO_C" >&6; } ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <dev/ata/atareg.h> ++_ACEOF ++if { (ac_try="$ac_cpp conftest.$ac_ext" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null && { ++ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || ++ test ! -s conftest.err ++ }; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++ ++rm -f conftest.err conftest.$ac_ext ++{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6; } ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes ++ ;; ++ no:yes:* ) ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: section \"Present But Cannot Be Compiled\"" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ata/atareg.h: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: dev/ata/atareg.h: in the future, the compiler will take precedence" >&2;} ++ ++ ;; ++esac ++{ echo "$as_me:$LINENO: checking for dev/ata/atareg.h" >&5 ++echo $ECHO_N "checking for dev/ata/atareg.h... $ECHO_C" >&6; } ++if test "${ac_cv_header_dev_ata_atareg_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_header_dev_ata_atareg_h=$ac_header_preproc ++fi ++{ echo "$as_me:$LINENO: result: $ac_cv_header_dev_ata_atareg_h" >&5 ++echo "${ECHO_T}$ac_cv_header_dev_ata_atareg_h" >&6; } ++ ++fi ++if test $ac_cv_header_dev_ata_atareg_h = yes; then ++ FOUNDINCLUDE=yes ++else ++ FOUNDINCLUDE=no ++fi ++ ++ ++ if test "$FOUNDINCLUDE" = "yes" ; then ++ if test "${ac_cv_header_dev_ic_wdcreg_h+set}" = set; then ++ { echo "$as_me:$LINENO: checking for dev/ic/wdcreg.h" >&5 ++echo $ECHO_N "checking for dev/ic/wdcreg.h... $ECHO_C" >&6; } ++if test "${ac_cv_header_dev_ic_wdcreg_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++fi ++{ echo "$as_me:$LINENO: result: $ac_cv_header_dev_ic_wdcreg_h" >&5 ++echo "${ECHO_T}$ac_cv_header_dev_ic_wdcreg_h" >&6; } + else ++ # Is the header compilable? ++{ echo "$as_me:$LINENO: checking dev/ic/wdcreg.h usability" >&5 ++echo $ECHO_N "checking dev/ic/wdcreg.h usability... $ECHO_C" >&6; } ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++#include <dev/ic/wdcreg.h> ++_ACEOF ++rm -f conftest.$ac_objext ++if { (ac_try="$ac_compile" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_compile") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest.$ac_objext; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_compiler=no ++fi ++ ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6; } ++ ++# Is the header present? ++{ echo "$as_me:$LINENO: checking dev/ic/wdcreg.h presence" >&5 ++echo $ECHO_N "checking dev/ic/wdcreg.h presence... $ECHO_C" >&6; } ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <dev/ic/wdcreg.h> ++_ACEOF ++if { (ac_try="$ac_cpp conftest.$ac_ext" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null && { ++ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || ++ test ! -s conftest.err ++ }; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++ ++rm -f conftest.err conftest.$ac_ext ++{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6; } ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes ++ ;; ++ no:yes:* ) ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: section \"Present But Cannot Be Compiled\"" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: dev/ic/wdcreg.h: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: dev/ic/wdcreg.h: in the future, the compiler will take precedence" >&2;} ++ ++ ;; ++esac ++{ echo "$as_me:$LINENO: checking for dev/ic/wdcreg.h" >&5 ++echo $ECHO_N "checking for dev/ic/wdcreg.h... $ECHO_C" >&6; } ++if test "${ac_cv_header_dev_ic_wdcreg_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_header_dev_ic_wdcreg_h=$ac_header_preproc ++fi ++{ echo "$as_me:$LINENO: result: $ac_cv_header_dev_ic_wdcreg_h" >&5 ++echo "${ECHO_T}$ac_cv_header_dev_ic_wdcreg_h" >&6; } ++ ++fi ++if test $ac_cv_header_dev_ic_wdcreg_h = yes; then ++ FOUNDINCLUDE=yes ++else ++ FOUNDINCLUDE=no ++fi ++ ++ ++ fi ++ if test "$FOUNDINCLUDE" = "no" ; then + { echo "$as_me:$LINENO: WARNING: Skipping check_ide_smart plugin." >&5 + echo "$as_me: WARNING: Skipping check_ide_smart plugin." >&2;} +- { echo "$as_me:$LINENO: WARNING: check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h." >&5 +-echo "$as_me: WARNING: check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h." >&2;} ++ { echo "$as_me:$LINENO: WARNING: check_ide_smart requires dev/ata/atareg.h and dev/ic/wdcreg.h" >&5 ++echo "$as_me: WARNING: check_ide_smart requires dev/ata/atareg.h and dev/ic/wdcreg.h" >&2;} ++ fi ++ ;; ++ *) ++ { echo "$as_me:$LINENO: WARNING: Skipping check_ide_smart plugin." >&5 ++echo "$as_me: WARNING: Skipping check_ide_smart plugin." >&2;} ++ { echo "$as_me:$LINENO: WARNING: check_ide_smart works only on Linux and NetBSD" >&5 ++echo "$as_me: WARNING: check_ide_smart works only on Linux and NetBSD" >&2;} ++esac ++ ++if test "$FOUNDINCLUDE" = "yes" ; then ++ EXTRAS="$EXTRAS check_ide_smart" + fi + + + diff --git a/net/nagios-plugins/patches/patch-configure.in b/net/nagios-plugins/patches/patch-configure.in new file mode 100644 index 00000000000..a8c2a832663 --- /dev/null +++ b/net/nagios-plugins/patches/patch-configure.in @@ -0,0 +1,50 @@ +$NetBSD: patch-configure.in,v 1.1 2013/01/19 09:59:12 manu Exp $ + +Enable check_smart_ide for NetBSD + +--- configure.in.orig 2013-01-03 05:43:46.000000000 +0100 ++++ configure.in 2013-01-03 05:50:57.000000000 +0100 +@@ -289,18 +289,36 @@ + fi + LIBS="$_SAVEDLIBS" + + dnl Check for headers used by check_ide_smart +-AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no) +-if test "$FOUNDINCLUDE" = "yes" ; then +- AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no) +-fi ++case $host in ++ *linux*) ++ AC_CHECK_HEADER(linux/hdreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no) ++ if test "$FOUNDINCLUDE" = "yes" ; then ++ AC_CHECK_HEADER(linux/types.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no) ++ fi ++ if test "$FOUNDINCLUDE" = "no" ; then ++ AC_MSG_WARN([Skipping check_ide_smart plugin.]) ++ AC_MSG_WARN([check_ide_smart requires linux/hdreg.h and linux/types.h.]) ++ fi ++ ;; ++ *netbsd*) ++ AC_CHECK_HEADER(dev/ata/atareg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no) ++ if test "$FOUNDINCLUDE" = "yes" ; then ++ AC_CHECK_HEADER(dev/ic/wdcreg.h, FOUNDINCLUDE=yes, FOUNDINCLUDE=no) ++ fi ++ if test "$FOUNDINCLUDE" = "no" ; then ++ AC_MSG_WARN([Skipping check_ide_smart plugin.]) ++ AC_MSG_WARN([check_ide_smart requires dev/ata/atareg.h and dev/ic/wdcreg.h]) ++ fi ++ ;; ++ *) ++ AC_MSG_WARN([Skipping check_ide_smart plugin.]) ++ AC_MSG_WARN([check_ide_smart works only on Linux and NetBSD]) ++esac + + if test "$FOUNDINCLUDE" = "yes" ; then + EXTRAS="$EXTRAS check_ide_smart" +-else +- AC_MSG_WARN([Skipping check_ide_smart plugin.]) +- AC_MSG_WARN([check_ide_smart is linux specific. It requires linux/hdreg.h and linux/types.h.]) + fi + + dnl Check for mysql libraries + np_mysqlclient diff --git a/net/nagios-plugins/patches/patch-plugins_check_ide_smart.c b/net/nagios-plugins/patches/patch-plugins_check_ide_smart.c new file mode 100644 index 00000000000..5a10cbda729 --- /dev/null +++ b/net/nagios-plugins/patches/patch-plugins_check_ide_smart.c @@ -0,0 +1,157 @@ +$NetBSD: patch-plugins_check_ide_smart.c,v 1.1 2013/01/19 09:59:12 manu Exp $ + +NetBSD support for SMART checks + +--- plugins/check_ide_smart.c.orig 2012-12-27 09:37:31.000000000 +0100 ++++ plugins/check_ide_smart.c 2012-12-27 09:37:31.000000000 +0100 +@@ -47,6 +47,27 @@ + #include <sys/ioctl.h> + #include <fcntl.h> ++#ifdef linux + #include <linux/hdreg.h> + #include <linux/types.h> ++ ++#define OPEN_MODE O_RDONLY ++#endif /* linux */ ++#ifdef __NetBSD__ ++#include <sys/device.h> ++#include <sys/param.h> ++#include <sys/sysctl.h> ++#include <sys/videoio.h> /* for __u8 and friends */ ++#include <sys/scsiio.h> ++#include <sys/ataio.h> ++#include <dev/ata/atareg.h> ++#include <dev/ic/wdcreg.h> ++ ++#define SMART_ENABLE WDSM_ENABLE_OPS ++#define SMART_DISABLE WDSM_DISABLE_OPS ++#define SMART_IMMEDIATE_OFFLINE WDSM_EXEC_OFFL_IMM ++#define SMART_AUTO_OFFLINE 0xdb /* undefined in NetBSD headers */ ++ ++#define OPEN_MODE O_RDWR ++#endif /* __NetBSD__ */ + #include <errno.h> + +@@ -224,5 +245,5 @@ + } + +- fd = open (device, O_RDONLY); ++ fd = open (device, OPEN_MODE); + + if (fd < 0) { +@@ -285,4 +306,5 @@ + smart_read_values (int fd, values_t * values) + { ++#ifdef linux + int e; + __u8 args[4 + 512]; +@@ -297,4 +319,33 @@ + } + memcpy (values, args + 4, 512); ++#endif /* linux */ ++#ifdef __NetBSD__ ++ struct atareq req; ++ unsigned char inbuf[DEV_BSIZE]; ++ ++ memset(&req, 0, sizeof(req)); ++ req.timeout = 1000; ++ memset(&inbuf, 0, sizeof(inbuf)); ++ ++ req.flags = ATACMD_READ; ++ req.features = WDSM_RD_DATA; ++ req.command = WDCC_SMART; ++ req.databuf = (char *)inbuf; ++ req.datalen = sizeof(inbuf); ++ req.cylinder = WDSMART_CYL; ++ ++ if (ioctl(fd, ATAIOCCOMMAND, &req) == 0) { ++ if (req.retsts != ATACMD_OK) ++ errno = ENODEV; ++ } ++ ++ if (errno != 0) { ++ int e = errno; ++ printf (_("CRITICAL - SMART_READ_VALUES: %s\n"), strerror (errno)); ++ return e; ++ } ++ ++ (void)memcpy(values, inbuf, 512); ++#endif /* __NetBSD__ */ + return 0; + } +@@ -440,4 +491,5 @@ + { + int e = 0; ++#ifdef linux + __u8 args[4]; + args[0] = WIN_SMART; +@@ -451,4 +503,29 @@ + } + } ++#endif /* linux */ ++#ifdef __NetBSD__ ++ struct atareq req; ++ ++ memset(&req, 0, sizeof(req)); ++ req.timeout = 1000; ++ req.flags = ATACMD_READREG; ++ req.features = smart_command[command].value; ++ req.command = WDCC_SMART; ++ req.cylinder = WDSMART_CYL; ++ req.sec_count = val0; ++ ++ if (ioctl(fd, ATAIOCCOMMAND, &req) == 0) { ++ if (req.retsts != ATACMD_OK) ++ errno = ENODEV; ++ if (req.cylinder != WDSMART_CYL) ++ errno = ENODEV; ++ } ++ ++ if (errno != 0) { ++ e = errno; ++ printf (_("CRITICAL - %s: %s\n"), smart_command[command].text, strerror (errno)); ++ return e; ++ } ++#endif /* __NetBSD__ */ + return e; + } +@@ -459,4 +536,5 @@ + smart_read_thresholds (int fd, thresholds_t * thresholds) + { ++#ifdef linux + int e; + __u8 args[4 + 512]; +@@ -471,4 +549,33 @@ + } + memcpy (thresholds, args + 4, 512); ++#endif /* linux */ ++#ifdef __NetBSD__ ++ struct atareq req; ++ unsigned char inbuf[DEV_BSIZE]; ++ ++ memset(&req, 0, sizeof(req)); ++ req.timeout = 1000; ++ memset(&inbuf, 0, sizeof(inbuf)); ++ ++ req.flags = ATACMD_READ; ++ req.features = WDSM_RD_THRESHOLDS; ++ req.command = WDCC_SMART; ++ req.databuf = (char *)inbuf; ++ req.datalen = sizeof(inbuf); ++ req.cylinder = WDSMART_CYL; ++ ++ if (ioctl(fd, ATAIOCCOMMAND, &req) == 0) { ++ if (req.retsts != ATACMD_OK) ++ errno = ENODEV; ++ } ++ ++ if (errno != 0) { ++ int e = errno; ++ printf (_("CRITICAL - SMART_READ_THRESHOLDS: %s\n"), strerror (errno)); ++ return e; ++ } ++ ++ (void)memcpy(thresholds, inbuf, 512); ++#endif /* __NetBSD__ */ + return 0; + } |