enhance indent

This commit is contained in:
garnier-quentin 2019-10-04 09:35:30 +02:00
parent 8ff13ed649
commit b7449b02b1
15 changed files with 170 additions and 136 deletions

View File

@ -80,11 +80,10 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'warning-status:s' => { name => 'warning_status', default => '' },
"warning-status:s" => { name => 'warning_status', default => '' }, 'critical-status:s' => { name => 'critical_status', default => '%{instanceState} ne %{instanceWantedState} or %{instanceState} ne %{instanceStateLast}' },
"critical-status:s" => { name => 'critical_status', default => '%{instanceState} ne %{instanceWantedState} or %{instanceState} ne %{instanceStateLast}' }, });
});
return $self; return $self;
} }
@ -110,8 +109,11 @@ sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{vrrp} = {}; $self->{vrrp} = {};
my $snmp_result = $options{snmp}->get_table(oid => $oid_vrrpInstanceEntry, end => $mapping->{vrrpInstancePrimaryInterface}->{oid}, my $snmp_result = $options{snmp}->get_table(
nothing_quit => 1); oid => $oid_vrrpInstanceEntry,
end => $mapping->{vrrpInstancePrimaryInterface}->{oid},
nothing_quit => 1
);
foreach my $oid (keys %{$snmp_result}) { foreach my $oid (keys %{$snmp_result}) {
next if ($oid !~ /^$mapping->{vrrpInstanceState}->{oid}\.(.*)$/); next if ($oid !~ /^$mapping->{vrrpInstanceState}->{oid}\.(.*)$/);

View File

@ -31,7 +31,7 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
%{$self->{modes}} = ( %{$self->{modes}} = (
'vrrp-status' => 'apps::keepalived::snmp::mode::vrrpstatus', 'vrrp-status' => 'apps::keepalived::snmp::mode::vrrpstatus',
); );
return $self; return $self;

View File

@ -122,7 +122,7 @@ sub set_counters {
sub prefix_global_output { sub prefix_global_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "Scenario "; return 'Scenario ';
} }
sub prefix_step_output { sub prefix_step_output {
@ -137,24 +137,24 @@ sub new {
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
"sahi-hostname:s" => { name => 'sahi_hostname' }, 'sahi-hostname:s' => { name => 'sahi_hostname' },
"sahi-port:s" => { name => 'sahi_port', default => 9999 }, 'sahi-port:s' => { name => 'sahi_port', default => 9999 },
"sahi-proto:s" => { name => 'sahi_proto', default => 'http' }, 'sahi-proto:s' => { name => 'sahi_proto', default => 'http' },
"sahi-http-timeout:s" => { name => 'sahi_http_timeout', default => 5 }, 'sahi-http-timeout:s' => { name => 'sahi_http_timeout', default => 5 },
"sahi-endpoint:s" => { name => 'sahi_endpoint', default => '/_s_/dyn/' }, 'sahi-endpoint:s' => { name => 'sahi_endpoint', default => '/_s_/dyn/' },
"sahi-suite:s" => { name => 'sahi_suite' }, 'sahi-suite:s' => { name => 'sahi_suite' },
"sahi-threads:s" => { name => 'sahi_threads', default => 1 }, 'sahi-threads:s' => { name => 'sahi_threads', default => 1 },
"sahi-startwith:s" => { name => 'sahi_startwith', default => 'BROWSER' }, 'sahi-startwith:s' => { name => 'sahi_startwith', default => 'BROWSER' },
"sahi-browsertype:s" => { name => 'sahi_browsertype', default => 'chrome' }, 'sahi-browsertype:s' => { name => 'sahi_browsertype', default => 'chrome' },
"sahi-baseurl:s" => { name => 'sahi_baseurl' }, 'sahi-baseurl:s' => { name => 'sahi_baseurl' },
"timeout:s" => { name => 'timeout' }, 'timeout:s' => { name => 'timeout' },
"retries-scenario-status:s" => { name => 'retries_scenario_status' }, 'retries-scenario-status:s' => { name => 'retries_scenario_status' },
"interval-scenario-status:s" => { name => 'interval_scenario_status', default => 10 }, 'interval-scenario-status:s' => { name => 'interval_scenario_status', default => 10 },
"unknown-run-status:s" => { name => 'unknown_run_status', default => '%{http_code} < 200 or %{http_code} >= 300' }, 'unknown-run-status:s' => { name => 'unknown_run_status', default => '%{http_code} < 200 or %{http_code} >= 300' },
"warning-run-status:s" => { name => 'warning_run_status' }, 'warning-run-status:s' => { name => 'warning_run_status' },
"critical-run-status:s" => { name => 'critical_run_status', default => '' }, 'critical-run-status:s' => { name => 'critical_run_status', default => '' },
"warning-status:s" => { name => 'warning_status', default => '' }, 'warning-status:s' => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{status} ne "SUCCESS"' }, 'critical-status:s' => { name => 'critical_status', default => '%{status} ne "SUCCESS"' },
}); });
$self->{http} = centreon::plugins::http->new(%options); $self->{http} = centreon::plugins::http->new(%options);
@ -179,7 +179,7 @@ sub handle_ALRM {
my $self = shift; my $self = shift;
$self->killed_scenario(); $self->killed_scenario();
$self->{output}->add_option_msg(short_msg => "Cannot finished scenario execution (timeout received)"); $self->{output}->add_option_msg(short_msg => 'Cannot finished scenario execution (timeout received)');
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
@ -190,7 +190,7 @@ sub check_options {
foreach my $option (('sahi_hostname', 'sahi_suite', 'sahi_startwith', 'sahi_browsertype')) { foreach my $option (('sahi_hostname', 'sahi_suite', 'sahi_startwith', 'sahi_browsertype')) {
(my $label = $option) =~ s/_/-/g; (my $label = $option) =~ s/_/-/g;
if (!defined($self->{option_results}->{$option}) || $self->{option_results}->{$option} eq '') { if (!defined($self->{option_results}->{$option}) || $self->{option_results}->{$option} eq '') {
$self->{output}->add_option_msg(short_msg => "Please set " . $label . " option"); $self->{output}->add_option_msg(short_msg => 'Please set ' . $label . ' option');
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
} }
@ -232,7 +232,7 @@ sub generate_user_defined_id {
my ($self, %options) = @_; my ($self, %options) = @_;
my ($seconds, $microseconds) = Time::HiRes::gettimeofday(); my ($seconds, $microseconds) = Time::HiRes::gettimeofday();
my $user_defined_id = strftime("%d%B%Y__%H_%M_%S_", localtime($seconds)); my $user_defined_id = strftime('%d%B%Y__%H_%M_%S_', localtime($seconds));
$user_defined_id .= $microseconds; $user_defined_id .= $microseconds;
return $user_defined_id; return $user_defined_id;
@ -301,7 +301,7 @@ sub run_scenario {
); );
if ($self->{http}->get_code() != 200) { if ($self->{http}->get_code() != 200) {
$self->{output}->add_option_msg(short_msg => "run scenario issue:" . $content); $self->{output}->add_option_msg(short_msg => 'run scenario issue:' . $content);
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
@ -325,7 +325,7 @@ sub check_scenario_status {
); );
if ($self->{http}->get_code() != 200) { if ($self->{http}->get_code() != 200) {
if ($retries == $self->{option_results}->{retries_scenario_status}) { if ($retries == $self->{option_results}->{retries_scenario_status}) {
$self->{output}->add_option_msg(short_msg => "check scenario status issue:" . $content); $self->{output}->add_option_msg(short_msg => 'check scenario status issue:' . $content);
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
$retries++; $retries++;
@ -362,13 +362,13 @@ sub get_suite_report {
); );
if ($self->{http}->get_code() != 200) { if ($self->{http}->get_code() != 200) {
$self->cleanup_option_exit(short_msg => "get suite report issue:" . $content); $self->cleanup_option_exit(short_msg => 'get suite report issue:' . $content);
} }
my $response = $self->decode_xml_response(response => $content, ForceArray => ['summary']); my $response = $self->decode_xml_response(response => $content, ForceArray => ['summary']);
if (!defined($response->{suite}->{scriptSummaries}->{summary})) { if (!defined($response->{suite}->{scriptSummaries}->{summary})) {
$self->{output}->output_add(long_msg => $response, debug => 1); $self->{output}->output_add(long_msg => $response, debug => 1);
$self->cleanup_option_exit(short_msg => "get suite report issue: unknown response format"); $self->cleanup_option_exit(short_msg => 'get suite report issue: unknown response format');
} }
# in milliseconds # in milliseconds
@ -396,13 +396,13 @@ sub get_script_report {
); );
if ($self->{http}->get_code() != 200) { if ($self->{http}->get_code() != 200) {
$self->cleanup_option_exit(short_msg => "get suite report issue:" . $content); $self->cleanup_option_exit(short_msg => 'get suite report issue:' . $content);
} }
my $response = $self->decode_xml_response(response => $content, ForceArray => ['step']); my $response = $self->decode_xml_response(response => $content, ForceArray => ['step']);
if (!defined($response->{steps}->{step})) { if (!defined($response->{steps}->{step})) {
$self->{output}->output_add(long_msg => $response, debug => 1); $self->{output}->output_add(long_msg => $response, debug => 1);
$self->cleanup_option_exit(short_msg => "get script report issue: unknown response format"); $self->cleanup_option_exit(short_msg => 'get script report issue: unknown response format');
} }
$self->{steps} = {}; $self->{steps} = {};

View File

@ -101,12 +101,12 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'filter-name:s' => { name => 'filter_name' },
"filter-name:s" => { name => 'filter_name' }, 'warning-ap-status:s' => { name => 'warning_ap_status', default => '' },
"warning-ap-status:s" => { name => 'warning_ap_status', default => '' }, 'critical-ap-status:s' => { name => 'critical_ap_status', default => '%{state} eq "disconnected"' },
"critical-ap-status:s" => { name => 'critical_ap_status', default => '%{state} eq "disconnected"' }, });
});
return $self; return $self;
} }
@ -138,11 +138,15 @@ sub manage_selection {
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' . (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')); (defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
my $snmp_result = $options{snmp}->get_multiple_table(oids => [ my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $mapping->{coDevDisState}->{oid} }, { oid => $mapping->{coDevDisState}->{oid} },
{ oid => $mapping->{coDevDisSystemName}->{oid} }, { oid => $mapping->{coDevDisSystemName}->{oid} },
{ oid => $mapping2->{coDevWirCliStaMACAddress}->{oid} }, { oid => $mapping2->{coDevWirCliStaMACAddress}->{oid} },
], nothing_quit => 1, return_type => 1); ],
nothing_quit => 1,
return_type => 1
);
$self->{ap} = {}; $self->{ap} = {};
$self->{global} = { total_ap => 0, total_users => 0 }; $self->{global} = { total_ap => 0, total_users => 0 };

View File

@ -83,9 +83,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ });
});
return $self; return $self;
} }
@ -97,8 +96,13 @@ sub manage_selection {
my $oid_coUsInfoCpuUse5Sec = '.1.3.6.1.4.1.8744.5.21.1.1.6.0'; my $oid_coUsInfoCpuUse5Sec = '.1.3.6.1.4.1.8744.5.21.1.1.6.0';
my $oid_coUsInfoCpuUse10Sec = '.1.3.6.1.4.1.8744.5.21.1.1.7.0'; my $oid_coUsInfoCpuUse10Sec = '.1.3.6.1.4.1.8744.5.21.1.1.7.0';
my $oid_coUsInfoCpuUse20Sec = '.1.3.6.1.4.1.8744.5.21.1.1.8.0'; my $oid_coUsInfoCpuUse20Sec = '.1.3.6.1.4.1.8744.5.21.1.1.8.0';
my $snmp_result = $options{snmp}->get_leef(oids => [$oid_coUsInfoCpuUseNow, my $snmp_result = $options{snmp}->get_leef(
$oid_coUsInfoCpuUse5Sec, $oid_coUsInfoCpuUse10Sec, $oid_coUsInfoCpuUse20Sec], nothing_quit => 1); oids => [
$oid_coUsInfoCpuUseNow, $oid_coUsInfoCpuUse5Sec,
$oid_coUsInfoCpuUse10Sec, $oid_coUsInfoCpuUse20Sec
],
nothing_quit => 1
);
$self->{global} = { $self->{global} = {
usage_now => $snmp_result->{$oid_coUsInfoCpuUseNow}, usage_now => $snmp_result->{$oid_coUsInfoCpuUseNow},

View File

@ -71,9 +71,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ });
});
return $self; return $self;
} }
@ -84,8 +83,13 @@ sub manage_selection {
my $oid_coUsInfoLoadAverage1Min = '.1.3.6.1.4.1.8744.5.21.1.1.5.0'; my $oid_coUsInfoLoadAverage1Min = '.1.3.6.1.4.1.8744.5.21.1.1.5.0';
my $oid_coUsInfoLoadAverage5Min = '.1.3.6.1.4.1.8744.5.21.1.1.6.0'; my $oid_coUsInfoLoadAverage5Min = '.1.3.6.1.4.1.8744.5.21.1.1.6.0';
my $oid_coUsInfoLoadAverage15Min = '.1.3.6.1.4.1.8744.5.21.1.1.7.0'; my $oid_coUsInfoLoadAverage15Min = '.1.3.6.1.4.1.8744.5.21.1.1.7.0';
my $snmp_result = $options{snmp}->get_leef(oids => [$oid_coUsInfoLoadAverage1Min, my $snmp_result = $options{snmp}->get_leef(
$oid_coUsInfoLoadAverage5Min, $oid_coUsInfoLoadAverage15Min], nothing_quit => 1); oids => [
$oid_coUsInfoLoadAverage1Min,
$oid_coUsInfoLoadAverage5Min, $oid_coUsInfoLoadAverage15Min
],
nothing_quit => 1
);
$self->{global} = { $self->{global} = {
load1 => $snmp_result->{$oid_coUsInfoLoadAverage1Min}, load1 => $snmp_result->{$oid_coUsInfoLoadAverage1Min},

View File

@ -30,11 +30,10 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'warning:s' => { name => 'warning' },
"warning:s" => { name => 'warning' }, 'critical:s' => { name => 'critical' },
"critical:s" => { name => 'critical' }, });
});
return $self; return $self;
} }
@ -44,12 +43,12 @@ sub check_options {
$self->SUPER::init(%options); $self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
} }
@ -62,10 +61,13 @@ sub run {
my $oid_coUsInfoRamBuffer = '.1.3.6.1.4.1.8744.5.21.1.1.11.0'; my $oid_coUsInfoRamBuffer = '.1.3.6.1.4.1.8744.5.21.1.1.11.0';
my $oid_coUsInfoRamCached = '.1.3.6.1.4.1.8744.5.21.1.1.12.0'; my $oid_coUsInfoRamCached = '.1.3.6.1.4.1.8744.5.21.1.1.12.0';
my $result = $self->{snmp}->get_leef(oids => [ my $result = $self->{snmp}->get_leef(
$oid_coUsInfoRamTotal, $oid_coUsInfoRamFree, oids => [
$oid_coUsInfoRamBuffer, $oid_coUsInfoRamCached $oid_coUsInfoRamTotal, $oid_coUsInfoRamFree,
], nothing_quit => 1); $oid_coUsInfoRamBuffer, $oid_coUsInfoRamCached
],
nothing_quit => 1
);
my $cached_used = $result->{$oid_coUsInfoRamCached}; my $cached_used = $result->{$oid_coUsInfoRamCached};
my $buffer_used = $result->{$oid_coUsInfoRamBuffer}; my $buffer_used = $result->{$oid_coUsInfoRamBuffer};
@ -82,24 +84,34 @@ sub run {
my ($buffer_value, $buffer_unit) = $self->{perfdata}->change_bytes(value => $buffer_used); my ($buffer_value, $buffer_unit) = $self->{perfdata}->change_bytes(value => $buffer_used);
my ($cached_value, $cached_unit) = $self->{perfdata}->change_bytes(value => $cached_used); my ($cached_value, $cached_unit) = $self->{perfdata}->change_bytes(value => $cached_used);
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(
short_msg => sprintf("Ram Total: %s, Used (-buffers/cache): %s (%.2f%%), Buffer: %s, Cached: %s", severity => $exit,
$total_value . " " . $total_unit, short_msg => sprintf(
$nobuf_value . " " . $nobuf_unit, $prct_used, "Ram Total: %s, Used (-buffers/cache): %s (%.2f%%), Buffer: %s, Cached: %s",
$buffer_value . " " . $buffer_unit, $total_value . " " . $total_unit,
$cached_value . " " . $cached_unit)); $nobuf_value . " " . $nobuf_unit, $prct_used,
$buffer_value . " " . $buffer_unit,
$cached_value . " " . $cached_unit
)
);
$self->{output}->perfdata_add(label => "cached", unit => 'B', $self->{output}->perfdata_add(
value => $cached_used, label => "cached", unit => 'B',
min => 0); value => $cached_used,
$self->{output}->perfdata_add(label => "buffer", unit => 'B', min => 0
value => $buffer_used, );
min => 0); $self->{output}->perfdata_add(
$self->{output}->perfdata_add(label => "used", unit => 'B', label => "buffer", unit => 'B',
value => $nobuf_used, value => $buffer_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1), min => 0
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1), );
min => 0, max => $total_size); $self->{output}->perfdata_add(
label => "used", unit => 'B',
value => $nobuf_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
min => 0, max => $total_size
);
$self->{output}->display(); $self->{output}->display();
$self->{output}->exit(); $self->{output}->exit();

View File

@ -59,9 +59,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ });
});
return $self; return $self;
} }
@ -71,9 +70,12 @@ sub manage_selection {
my $oid_coUsInfoStorageUsePermanent = '.1.3.6.1.4.1.8744.5.21.1.1.13.0'; my $oid_coUsInfoStorageUsePermanent = '.1.3.6.1.4.1.8744.5.21.1.1.13.0';
my $oid_coUsInfoStorageUseTemporary = '.1.3.6.1.4.1.8744.5.21.1.1.14.0'; my $oid_coUsInfoStorageUseTemporary = '.1.3.6.1.4.1.8744.5.21.1.1.14.0';
my $snmp_result = $options{snmp}->get_leef(oids => [ my $snmp_result = $options{snmp}->get_leef(
oids => [
$oid_coUsInfoStorageUsePermanent, $oid_coUsInfoStorageUseTemporary, $oid_coUsInfoStorageUsePermanent, $oid_coUsInfoStorageUseTemporary,
], nothing_quit => 1); ],
nothing_quit => 1
);
$self->{storage} = { $self->{storage} = {
perm_used => $snmp_result->{$oid_coUsInfoStorageUsePermanent}, perm_used => $snmp_result->{$oid_coUsInfoStorageUsePermanent},

View File

@ -31,14 +31,14 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
%{$self->{modes}} = ( %{$self->{modes}} = (
'ap-usage' => 'network::colubris::snmp::mode::apusage', 'ap-usage' => 'network::colubris::snmp::mode::apusage',
'cpu' => 'network::colubris::snmp::mode::cpu', 'cpu' => 'network::colubris::snmp::mode::cpu',
'interfaces' => 'snmp_standard::mode::interfaces', 'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces', 'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'load' => 'network::colubris::snmp::mode::load', 'load' => 'network::colubris::snmp::mode::load',
'memory' => 'network::colubris::snmp::mode::memory', 'memory' => 'network::colubris::snmp::mode::memory',
'storage' => 'network::colubris::snmp::mode::storage', 'storage' => 'network::colubris::snmp::mode::storage',
); );
return $self; return $self;
} }

View File

@ -50,9 +50,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ });
});
return $self; return $self;
} }
@ -61,9 +60,12 @@ sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
my $oid_ibSystemMonitorCpuUsage = '.1.3.6.1.4.1.7779.3.1.1.2.1.8.1.1.0'; my $oid_ibSystemMonitorCpuUsage = '.1.3.6.1.4.1.7779.3.1.1.2.1.8.1.1.0';
my $snmp_result = $options{snmp}->get_leef(oids => [ my $snmp_result = $options{snmp}->get_leef(
oids => [
$oid_ibSystemMonitorCpuUsage $oid_ibSystemMonitorCpuUsage
], nothing_quit => 1); ],
nothing_quit => 1
);
$self->{global} = { cpu => $snmp_result->{$oid_ibSystemMonitorCpuUsage} }; $self->{global} = { cpu => $snmp_result->{$oid_ibSystemMonitorCpuUsage} };
} }

View File

@ -78,10 +78,9 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'filter-name:s' => { name => 'filter_name' },
"filter-name:s" => { name => 'filter_name' }, });
});
return $self; return $self;
} }
@ -121,10 +120,13 @@ my $oid_ibDHCPSubnetEntry = '.1.3.6.1.4.1.7779.3.1.1.4.1.1.1';
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_multiple_table(oids => [ my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_ibDHCPStatistics }, { oid => $oid_ibDHCPStatistics },
{ oid => $oid_ibDHCPSubnetEntry }, { oid => $oid_ibDHCPSubnetEntry },
], nothing_quit => 1); ],
nothing_quit => 1
);
$self->{dhcp} = {}; $self->{dhcp} = {};
foreach my $oid (keys %{$snmp_result->{$oid_ibDHCPSubnetEntry}}) { foreach my $oid (keys %{$snmp_result->{$oid_ibDHCPSubnetEntry}}) {

View File

@ -100,10 +100,9 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ 'filter-name:s' => { name => 'filter_name' },
"filter-name:s" => { name => 'filter_name' }, });
});
return $self; return $self;
} }
@ -138,10 +137,13 @@ sub manage_selection {
} }
$self->{dns} = {}; $self->{dns} = {};
my $snmp_result = $options{snmp}->get_multiple_table(oids => [ my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_ibZoneStatisticsEntry }, { oid => $oid_ibZoneStatisticsEntry },
{ oid => $oid_ibDnsModule, start => $mapping2->{ibDnsHitRatio}->{oid} }, { oid => $oid_ibDnsModule, start => $mapping2->{ibDnsHitRatio}->{oid} },
], nothing_quit => 1); ],
nothing_quit => 1
);
foreach my $oid (keys %{$snmp_result->{$oid_ibZoneStatisticsEntry}}) { foreach my $oid (keys %{$snmp_result->{$oid_ibZoneStatisticsEntry}}) {
next if ($oid !~ /^$mapping->{ibBindZoneName}->{oid}\.(.*)$/); next if ($oid !~ /^$mapping->{ibBindZoneName}->{oid}\.(.*)$/);

View File

@ -59,9 +59,8 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{ });
});
return $self; return $self;
} }
@ -71,9 +70,12 @@ sub manage_selection {
my $oid_ibSystemMonitorMemUsage = '.1.3.6.1.4.1.7779.3.1.1.2.1.8.2.1.0'; my $oid_ibSystemMonitorMemUsage = '.1.3.6.1.4.1.7779.3.1.1.2.1.8.2.1.0';
my $oid_ibSystemMonitorSwapUsage = '.1.3.6.1.4.1.7779.3.1.1.2.1.8.3.1.0'; my $oid_ibSystemMonitorSwapUsage = '.1.3.6.1.4.1.7779.3.1.1.2.1.8.3.1.0';
my $snmp_result = $options{snmp}->get_leef(oids => [ my $snmp_result = $options{snmp}->get_leef(
oids => [
$oid_ibSystemMonitorMemUsage, $oid_ibSystemMonitorSwapUsage, $oid_ibSystemMonitorMemUsage, $oid_ibSystemMonitorSwapUsage,
], nothing_quit => 1); ],
nothing_quit => 1
);
$self->{memory} = { $self->{memory} = {
ram_used => $snmp_result->{$oid_ibSystemMonitorMemUsage}, ram_used => $snmp_result->{$oid_ibSystemMonitorMemUsage},

View File

@ -51,9 +51,7 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_load_components => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, no_load_components => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {});
{
});
return $self; return $self;
} }

View File

@ -31,14 +31,14 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
%{$self->{modes}} = ( %{$self->{modes}} = (
'cpu' => 'network::infoblox::snmp::mode::cpu', 'cpu' => 'network::infoblox::snmp::mode::cpu',
'dhcp-usage' => 'network::infoblox::snmp::mode::dhcpusage', 'dhcp-usage' => 'network::infoblox::snmp::mode::dhcpusage',
'dns-usage' => 'network::infoblox::snmp::mode::dnsusage', 'dns-usage' => 'network::infoblox::snmp::mode::dnsusage',
'interfaces' => 'snmp_standard::mode::interfaces', 'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces', 'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'network::infoblox::snmp::mode::memory', 'memory' => 'network::infoblox::snmp::mode::memory',
'services' => 'network::infoblox::snmp::mode::services', 'services' => 'network::infoblox::snmp::mode::services',
); );
return $self; return $self;
} }