From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- ...001-move-nagios_die-out-of-N-P-Thresholds.patch | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch (limited to 'web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch') diff --git a/web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch b/web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch new file mode 100644 index 0000000..449cdd9 --- /dev/null +++ b/web/attachments/352097-0001-move-nagios_die-out-of-N-P-Thresholds.patch @@ -0,0 +1,69 @@ +From c1f379dbeb62b56530a25319690977385ce6766f Mon Sep 17 00:00:00 2001 +From: Danijel Tasov +Date: Sun, 22 Nov 2009 14:25:33 +0100 +Subject: [PATCH] move nagios_die out of N::P::Thresholds. + +N::P::Thresholds uses nagios_die. This is suboptimal for using +that Class in other Projects. Though one can set +N::P::F::_use_die, but then $@ contains get_shortname and a +STATUS_TEXT, which feels odd. + +Signed-off-by: Danijel Tasov +--- + lib/Nagios/Plugin.pm | 7 ++++++- + lib/Nagios/Plugin/Threshold.pm | 7 ++++--- + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/lib/Nagios/Plugin.pm b/lib/Nagios/Plugin.pm +index 697005a..958d617 100644 +--- a/lib/Nagios/Plugin.pm ++++ b/lib/Nagios/Plugin.pm +@@ -83,7 +83,12 @@ sub all_perfoutput { + sub set_thresholds { + my $self = shift; + require Nagios::Plugin::Threshold; +- return $self->threshold( Nagios::Plugin::Threshold->set_thresholds(@_)); ++ eval { ++ $self->threshold( Nagios::Plugin::Threshold->set_thresholds(@_)); ++ }; if($@) { ++ $self->nagios_die($@); ++ } ++ return $self->threshold; + } + + # NP::Functions wrappers +diff --git a/lib/Nagios/Plugin/Threshold.pm b/lib/Nagios/Plugin/Threshold.pm +index 73fce53..e481cd4 100644 +--- a/lib/Nagios/Plugin/Threshold.pm ++++ b/lib/Nagios/Plugin/Threshold.pm +@@ -9,7 +9,8 @@ use base qw(Class::Accessor::Fast); + __PACKAGE__->mk_accessors(qw(warning critical)); + + use Nagios::Plugin::Range; +-use Nagios::Plugin::Functions qw(:codes nagios_die); ++use Nagios::Plugin::Functions qw(:codes); ++use Carp; + our ($VERSION) = $Nagios::Plugin::Functions::VERSION; + + sub get_status +@@ -34,7 +35,7 @@ sub _inflate + + # For refs, check isa N::P::Range + if (ref $value) { +- nagios_die("Invalid $key object: type " . ref $value) ++ croak("Invalid $key object: type " . ref $value) + unless $value->isa("Nagios::Plugin::Range"); + return $value; + } +@@ -44,7 +45,7 @@ sub _inflate + + # Otherwise parse $value + my $range = Nagios::Plugin::Range->parse_range_string($value); +- nagios_die("Cannot parse $key range: '$value'") unless(defined($range)); ++ croak("Cannot parse $key range: '$value'") unless(defined($range)); + return $range; + } + +-- +1.6.5.2.10.g754571 + -- cgit v1.2.3-74-g34f1