diff --git a/Makefile.am b/Makefile.am index 581158cf..c83c6084 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,6 @@ dist-hook: if [ -f ../GLPlugin/lib/Monitoring/GLPlugin.pm ]; then cp -r ../GLPlugin/lib .; fi rm -f t/var/tmp/* rm -f t/var/adm/* - find $(distdir) -type f -exec $(DOS2UNIX) {} \; + find $(distdir) -type f -exec $(DOS2UNIX) {} >/dev/null 2>&1 \; make diff --git a/configure.ac b/configure.ac index 71a79abf..138abb15 100644 --- a/configure.ac +++ b/configure.ac @@ -38,57 +38,6 @@ AC_SUBST(with_nagios_user) AC_SUBST(with_nagios_group) INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group" AC_SUBST(INSTALL_OPTS) -AC_ARG_WITH(noinst_level, - ACX_HELP_STRING([--with-noinst-level=LEVEL], - [error level if nwc_health is not installed]), - with_noinst_level=$withval, - with_noinst_level=unknown) -AC_SUBST(NOINSTLEVEL, $with_noinst_level) -AC_ARG_WITH(degrees, - ACX_HELP_STRING([--with-degrees=UNIT], - [which temperature unit to use. (celsius or fahrenheit)]), - with_degrees=$withval, - with_degrees=unknown) -case "$with_degrees" in - fahrenheit) - AC_SUBST(CELSIUS, 0) - ;; - *) - AC_SUBST(CELSIUS, 1) - ;; -esac -AC_ARG_ENABLE([perfdata], -[ --enable-perfdata wether to output perfdata (default=no)], ,enable_perfdata=no) -if test x"$enable_perfdata" = xyes ; then - AC_SUBST(PERFDATA, 1) -else - AC_SUBST(PERFDATA, 0) -fi -AC_ARG_ENABLE([extendedinfo], -[ --enable-extendedinfo wether to output extended info (default=no)], ,enable_extendedinfo=no) -if test x"$enable_extendedinfo" = xyes ; then - AC_SUBST(EXTENDEDINFO, 1) -else - AC_SUBST(EXTENDEDINFO, 0) -fi -AC_ARG_ENABLE([hwinfo], -[ --disable-hwinfo wether to output model desc., serial no., bios version (default=yes)], ,enable_hwinfo=yes) - -if test x"$enable_hwinfo" = xyes ; then - AC_SUBST(HWINFO, 1) -else - AC_SUBST(HWINFO, 0) -fi - - -case "$host_os" in - *hp*) - defaulttrustedpath=/bin:/sbin:/usr/bin:/usr/sbin:/usr/contrib/bin - ;; - *) - defaulttrustedpath=/bin:/sbin:/usr/bin:/usr/sbin - ;; -esac EXTRAS= dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH @@ -116,9 +65,4 @@ AC_OUTPUT(Makefile plugins-scripts/Makefile plugins-scripts/subst) ACX_FEATURE([with],[perl]) ACX_FEATURE([with],[nagios-user]) ACX_FEATURE([with],[nagios-group]) -ACX_FEATURE([with],[noinst-level]) -ACX_FEATURE([with],[degrees]) -ACX_FEATURE([enable],[perfdata]) -ACX_FEATURE([enable],[extendedinfo]) -ACX_FEATURE([enable],[hwinfo]) ACX_FEATURE([disable],[standalone], $disable_standalone) diff --git a/check_nwc_health.php b/contrib/check_nwc_health.php similarity index 100% rename from check_nwc_health.php rename to contrib/check_nwc_health.php diff --git a/lib/Monitoring/GLPlugin.pm b/lib/Monitoring/GLPlugin.pm index 2b862549..c3bcd802 100755 --- a/lib/Monitoring/GLPlugin.pm +++ b/lib/Monitoring/GLPlugin.pm @@ -1,11 +1,13 @@ package Monitoring::GLPlugin; +# ABSTRACT: helper functions to build a upnp-based monitoring plugin + use strict; use IO::File; use File::Basename; use Digest::MD5 qw(md5_hex); use Errno; -#use AutoLoader; our $AUTOLOAD; +our $VERSION = "1.0"; use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; @@ -1011,9 +1013,12 @@ sub valdiff { } if ($mode eq "normal" || $mode eq "lookback" || $mode eq "lookback_freeze_chill") { if ($self->{$_} =~ /^\d+$/) { - if ($self->opts->lookback) { - $last_values->{$_} = 0 if ! exists $last_values->{$_}; - if ($self->{$_} >= $last_values->{$_}) { + $last_values->{$_} = 0 if ! exists $last_values->{$_}; + if ($self->{$_} >= $last_values->{$_}) { + $self->{'delta_'.$_} = $self->{$_} - $last_values->{$_}; + } else { + if ($mode =~ /lookback_freeze/) { + # hier koennen delta-werte auch negativ sein, wenn z.b. peers verschwinden $self->{'delta_'.$_} = $self->{$_} - $last_values->{$_}; } else { # vermutlich db restart und zaehler alle auf null diff --git a/lib/Monitoring/GLPlugin/SNMP.pm b/lib/Monitoring/GLPlugin/SNMP.pm index 7fe08842..dd9c101f 100644 --- a/lib/Monitoring/GLPlugin/SNMP.pm +++ b/lib/Monitoring/GLPlugin/SNMP.pm @@ -1,5 +1,6 @@ package Monitoring::GLPlugin::SNMP; our @ISA = qw(Monitoring::GLPlugin); +# ABSTRACT: helper functions to build a snmp-based monitoring plugin use strict; use File::Basename; @@ -7,6 +8,7 @@ use Digest::MD5 qw(md5_hex); use Data::Dumper; use AutoLoader; our $AUTOLOAD; +our $VERSION = "1.0"; use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; @@ -146,6 +148,13 @@ sub add_snmp_args { required => 0, env => 'SNMPWALK', ); + $self->add_arg( + spec => 'servertype=s', + help => '--servertype + The type of the network device: cisco (default). Use it if auto-detection + is not possible', + required => 0, + ); $self->add_arg( spec => 'oids=s', help => '--oids diff --git a/lib/Monitoring/GLPlugin/UPNP.pm b/lib/Monitoring/GLPlugin/UPNP.pm index 727a748f..3b6ad931 100644 --- a/lib/Monitoring/GLPlugin/UPNP.pm +++ b/lib/Monitoring/GLPlugin/UPNP.pm @@ -1,11 +1,13 @@ package Monitoring::GLPlugin::UPNP; our @ISA = qw(Monitoring::GLPlugin); +# ABSTRACT: helper functions to build a upnp-based monitoring plugin use strict; use File::Basename; use Digest::MD5 qw(md5_hex); use AutoLoader; our $AUTOLOAD; +our $VERSION = "1.0"; use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am index c7b3dcdf..e412d6fc 100644 --- a/plugins-scripts/Makefile.am +++ b/plugins-scripts/Makefile.am @@ -1,19 +1,3 @@ -## Process this file with automake to produce Makefile.in - -SED=/bin/sed -GREP=/bin/grep -CAT=/bin/cat -ECHO=/bin/echo -if DISABLE_STANDALONE -STANDALONE = no -else -STANDALONE = yes -endif - -SUFFIXES = .pl .pm .sh - -VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t - libexec_SCRIPTS=check_nwc_health GL_MODULES=\ ../lib/Monitoring/GLPlugin.pm \ @@ -206,7 +190,22 @@ EXTRA_MODULES=\ Classes/Lantronix/SLS.pm \ Classes/MibsAndOids.pm \ Classes/Device.pm -EXTRA_DIST=check_nwc_health.pl $(EXTRA_MODULES) $(GL_MODULES) + +SED=/bin/sed +GREP=/bin/grep +CAT=/bin/cat +ECHO=/bin/echo +if DISABLE_STANDALONE +STANDALONE = no +else +STANDALONE = yes +endif + +SUFFIXES = .pl .pm .sh + +VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t + +EXTRA_DIST=$(libexec_SCRIPTS).pl $(EXTRA_MODULES) $(GL_MODULES) CLEANFILES=$(libexec_SCRIPTS) @@ -225,6 +224,7 @@ AM_INSTALL_PROGRAM_FLAGS=@INSTALL_OPTS@ chmod +x $@ $(libexec_SCRIPTS) : $(EXTRA_DIST) + if [ -f ../../GLPlugin/lib/Monitoring/GLPlugin.pm ]; then cp -r ../../GLPlugin/lib ..; fi $(ECHO) "#! #PERL# -w" | $(AWK) -f ./subst > $@ $(ECHO) "# nagios: -epn" >> $@ $(ECHO) >> $@ @@ -235,7 +235,7 @@ $(libexec_SCRIPTS) : $(EXTRA_DIST) done \ fi for m in ${EXTRA_MODULES}; do \ - $(SED) -e 's/^1;//g' < $$m | $(SED) -e '/^__END__/,$$d' | $(AWK) -f ./subst | $(GREP) -v "use Nagios::Plugin" >> $@; \ + $(SED) -e 's/^1;//g' < $$m | $(SED) -e '/^__END__/,$$d' | $(AWK) -f ./subst >> $@; \ done $(ECHO) "package main;" >> $@ $(CAT) $(libexec_SCRIPTS).pl | $(AWK) -f ./subst >> $@ diff --git a/plugins-scripts/check_nwc_health.pl b/plugins-scripts/check_nwc_health.pl index 87a6ad95..e8e290e0 100644 --- a/plugins-scripts/check_nwc_health.pl +++ b/plugins-scripts/check_nwc_health.pl @@ -3,7 +3,6 @@ use strict; no warnings qw(once); - eval { if ( ! grep /AUTOLOAD/, keys %Monitoring::GLPlugin::) { require "Monitoring::GLPlugin"; @@ -414,13 +413,6 @@ The role of this device in a hsrp group (active/standby/listen)", required => 0, ); -$plugin->add_arg( - spec => 'servertype=s', - help => '--servertype - The type of the network device: cisco (default). Use it if auto-detection - is not possible', - required => 0, -); $plugin->getopts(); $plugin->classify(); @@ -444,7 +436,5 @@ $plugin->check_messages(join => ', ', join_all => ', '); $message .= sprintf "\n%s\n", $plugin->get_info("\n") if $plugin->opts->verbose >= 1; -#printf "%s\n", Data::Dumper::Dumper($plugin); $plugin->nagios_exit($code, $message); -printf "schluss\n";