check_nwc_health: Update to 5.7.1.3
This commit is contained in:
parent
96914b6c6e
commit
4c86b3906b
|
@ -1,3 +1,9 @@
|
|||
* 2016-07-07 5.7.1.3
|
||||
remove trailing Nul from Bintec memories
|
||||
* 2016-07-07 5.7.1.2
|
||||
Bintec doesn't like bulk requests
|
||||
* 2016-06-16 5.7.1.1
|
||||
repair a pull request.
|
||||
* 2016-05-30 5.7.1
|
||||
update GLPlugin
|
||||
* 2016-05-28 5.7.0.3
|
|
@ -13,7 +13,7 @@ use Digest::MD5 qw(md5_hex);
|
|||
use Errno;
|
||||
use Data::Dumper;
|
||||
our $AUTOLOAD;
|
||||
*VERSION = \'2.1';
|
||||
*VERSION = \'2.1.3';
|
||||
|
||||
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
|
||||
|
||||
|
@ -636,6 +636,7 @@ sub load_my_extension {
|
|||
}
|
||||
my $plugin_name = $Monitoring::GLPlugin::pluginname;
|
||||
$plugin_name =~ /check_(.*?)_health/;
|
||||
my $deprecated_class = "DBD::".(uc $1)."::Server";
|
||||
$plugin_name = "Check".uc(substr($1, 0, 1)).substr($1, 1)."Health";
|
||||
foreach my $libpath (split(":", $self->opts->get("with-mymodules-dyn-dir"))) {
|
||||
foreach my $extmod (glob $libpath."/".$plugin_name."*.pm") {
|
||||
|
@ -658,7 +659,8 @@ sub load_my_extension {
|
|||
my $original_init = $self->can("init");
|
||||
$self->compatibility_class() if $self->can('compatibility_class');
|
||||
bless $self, "My$class";
|
||||
$self->compatibility_methods() if $self->can('compatibility_methods');
|
||||
$self->compatibility_methods() if $self->can('compatibility_methods') &&
|
||||
$self->isa($deprecated_class);
|
||||
if ($self->isa("Monitoring::GLPlugin")) {
|
||||
my $new_init = $self->can("init");
|
||||
if ($new_init == $original_init) {
|
||||
|
@ -1538,9 +1540,9 @@ sub AUTOLOAD {
|
|||
$self->{components}->{$subsystem}->check();
|
||||
$self->{components}->{$subsystem}->dump()
|
||||
if $self->opts->verbose >= 2;
|
||||
} elsif ($AUTOLOAD =~ /^.*::(status_code|check_messages|nagios_exit|html_string|perfdata_string|selected_perfdata|check_thresholds|get_thresholds|opts)$/) {
|
||||
} elsif ($AUTOLOAD =~ /^.*::(status_code|check_messages|nagios_exit|html_string|perfdata_string|selected_perfdata|check_thresholds|get_thresholds|opts|pandora_string)$/) {
|
||||
return $Monitoring::GLPlugin::plugin->$1(@params);
|
||||
} elsif ($AUTOLOAD =~ /^.*::(reduce_messages|reduce_messages_short|clear_messages|suppress_messages|add_html|add_perfdata|override_opt|create_opt|set_thresholds|force_thresholds)$/) {
|
||||
} elsif ($AUTOLOAD =~ /^.*::(reduce_messages|reduce_messages_short|clear_messages|suppress_messages|add_html|add_perfdata|override_opt|create_opt|set_thresholds|force_thresholds|add_pandora)$/) {
|
||||
$Monitoring::GLPlugin::plugin->$1(@params);
|
||||
} elsif ($AUTOLOAD =~ /^.*::mod_arg_(.*)$/) {
|
||||
return $Monitoring::GLPlugin::plugin->mod_arg($1, @params);
|
|
@ -218,6 +218,28 @@ sub add_perfdata {
|
|||
if $self->selected_perfdata($label);
|
||||
}
|
||||
|
||||
sub add_pandora {
|
||||
my ($self, %args) = @_;
|
||||
my $label = $args{label};
|
||||
my $value = $args{value};
|
||||
|
||||
if ($args{help}) {
|
||||
push @{$self->{pandora}}, sprintf("# HELP %s %s", $label, $args{help});
|
||||
}
|
||||
if ($args{type}) {
|
||||
push @{$self->{pandora}}, sprintf("# TYPE %s %s", $label, $args{type});
|
||||
}
|
||||
if ($args{labels}) {
|
||||
push @{$self->{pandora}}, sprintf("%s{%s} %s", $label,
|
||||
join(",", map {
|
||||
sprintf '%s="%s"', $_, $args{labels}->{$_};
|
||||
} keys %{$args{labels}}),
|
||||
$value);
|
||||
} else {
|
||||
push @{$self->{pandora}}, sprintf("%s %s", $label, $value);
|
||||
}
|
||||
}
|
||||
|
||||
sub add_html {
|
||||
my ($self, $line) = @_;
|
||||
push @{$self->{html}}, $line;
|
||||
|
@ -322,6 +344,15 @@ sub perfdata_string {
|
|||
}
|
||||
}
|
||||
|
||||
sub metrics_string {
|
||||
my ($self) = @_;
|
||||
if (scalar (@{$self->{metrics}})) {
|
||||
return join("\n", @{$self->{metrics}});
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
sub html_string {
|
||||
my ($self) = @_;
|
||||
if (scalar (@{$self->{html}})) {
|
|
@ -1658,6 +1658,12 @@ sub get_snmp_table_objects {
|
|||
return @entries;
|
||||
}
|
||||
|
||||
sub bulk_is_baeh {
|
||||
my ($self, $maxrepetitions) = @_;
|
||||
$maxrepetitions ||= 1;
|
||||
$Monitoring::GLPlugin::SNMP::maxrepetitions = $maxrepetitions;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# 3rd level functions. calling net::snmp-functions
|
||||
#
|
||||
|
@ -1955,6 +1961,11 @@ sub get_table {
|
|||
$params{-contextengineid} = $self->opts->contextengineid if $self->opts->contextengineid;
|
||||
$params{-contextname} = $self->opts->contextname if $self->opts->contextname;
|
||||
}
|
||||
if ($Monitoring::GLPlugin::SNMP::maxrepetitions) {
|
||||
# some devices (Bintec) don't like bulk-requests. They call bulk_is_baeh(), so
|
||||
# we immediately send get-next
|
||||
$params{'-maxrepetitions'} = $Monitoring::GLPlugin::SNMP::maxrepetitions;
|
||||
}
|
||||
$self->debug(sprintf "get_table %s", Data::Dumper::Dumper(\%params));
|
||||
my $result = $Monitoring::GLPlugin::SNMP::session->get_table(%params);
|
||||
$self->debug(sprintf "get_table returned %d oids", scalar(keys %{$result}));
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue