break(infoblox/snmp): remove cpu/memory modes - add system mode (#2839)
This commit is contained in:
parent
766256427e
commit
629b80b890
|
@ -1,93 +0,0 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::infoblox::snmp::mode::cpu;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'usage', set => {
|
||||
key_values => [ { name => 'cpu' } ],
|
||||
output_template => 'CPU Usage : %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu_usage', value => 'cpu', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
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 => [
|
||||
$oid_ibSystemMonitorCpuUsage
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = { cpu => $snmp_result->{$oid_ibSystemMonitorCpuUsage} };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check CPU usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-usage>
|
||||
|
||||
Threshold warning.
|
||||
|
||||
=item B<--critical-usage>
|
||||
|
||||
Threshold critical.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -26,65 +26,6 @@ use strict;
|
|||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
|
||||
{ name => 'dhcp', type => 1, cb_prefix_output => 'prefix_dhcp_output', message_multiple => 'All dhcp subnets are ok' },
|
||||
];
|
||||
|
||||
my @map = (
|
||||
['ibDhcpTotalNoOfDiscovers', 'discovers : %s', 'total-discovers'],
|
||||
['ibDhcpTotalNoOfRequests', 'requests : %s', 'total-requests'],
|
||||
['ibDhcpTotalNoOfReleases', 'releases : %s', 'total-releases'],
|
||||
['ibDhcpTotalNoOfOffers', 'offers : %s', 'total-offers'],
|
||||
['ibDhcpTotalNoOfAcks', 'acks : %s', 'total-acks'],
|
||||
['ibDhcpTotalNoOfNacks', 'nacks : %s', 'total-nacks'],
|
||||
['ibDhcpTotalNoOfDeclines', 'declines : %s', 'total-declines'],
|
||||
['ibDhcpTotalNoOfInforms', 'informs : %s', 'total-informs'],
|
||||
['ibDhcpTotalNoOfOthers', 'others : %s', 'total-others'],
|
||||
);
|
||||
|
||||
$self->{maps_counters}->{global} = [];
|
||||
for (my $i = 0; $i < scalar(@map); $i++) {
|
||||
my $perf_label = $map[$i]->[2];
|
||||
$perf_label =~ s/-/_/g;
|
||||
push @{$self->{maps_counters}->{global}}, { label => $map[$i]->[2], set => {
|
||||
key_values => [ { name => $map[$i]->[0], diff => 1 } ],
|
||||
output_template => $map[$i]->[1],
|
||||
perfdatas => [
|
||||
{ label => $perf_label, value => $map[$i]->[0] , template => '%s', min => 0 },
|
||||
],
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$self->{maps_counters}->{dhcp} = [
|
||||
{ label => 'subnet-used', set => {
|
||||
key_values => [ { name => 'ibDHCPSubnetPercentUsed' }, { name => 'display' } ],
|
||||
output_template => 'Used : %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'subnet_used', value => 'iibDHCPSubnetPercentUsed', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub prefix_global_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -97,6 +38,63 @@ sub prefix_dhcp_output {
|
|||
return "Subnet '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
|
||||
{ name => 'dhcp', type => 1, cb_prefix_output => 'prefix_dhcp_output', message_multiple => 'All dhcp subnets are ok' }
|
||||
];
|
||||
|
||||
my @map = (
|
||||
['ibDhcpTotalNoOfDiscovers', 'discovers: %s', 'total-discovers', 'dhcp.discovers.count'],
|
||||
['ibDhcpTotalNoOfRequests', 'requests: %s', 'total-requests', 'dhcp.requests.count'],
|
||||
['ibDhcpTotalNoOfReleases', 'releases: %s', 'total-releases', 'dhcp.releases.count'],
|
||||
['ibDhcpTotalNoOfOffers', 'offers: %s', 'total-offers', 'dhcp.offers.count'],
|
||||
['ibDhcpTotalNoOfAcks', 'acks: %s', 'total-acks', 'dhcp.acks.count'],
|
||||
['ibDhcpTotalNoOfNacks', 'nacks: %s', 'total-nacks', 'dhcp.nacks.count'],
|
||||
['ibDhcpTotalNoOfDeclines', 'declines: %s', 'total-declines', 'dhcp.declines.count'],
|
||||
['ibDhcpTotalNoOfInforms', 'informs: %s', 'total-informs', 'dhcp.informs.count'],
|
||||
['ibDhcpTotalNoOfOthers', 'others: %s', 'total-others', 'dhcp.others.count']
|
||||
);
|
||||
|
||||
$self->{maps_counters}->{global} = [];
|
||||
for (my $i = 0; $i < scalar(@map); $i++) {
|
||||
push @{$self->{maps_counters}->{global}}, {
|
||||
label => $map[$i]->[2], nlabel => $map[$i]->[3], set => {
|
||||
key_values => [ { name => $map[$i]->[0], diff => 1 } ],
|
||||
output_template => $map[$i]->[1],
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$self->{maps_counters}->{dhcp} = [
|
||||
{ label => 'subnet-used', nlabel => 'subnet.addresses.usage.percentage', set => {
|
||||
key_values => [ { name => 'ibDHCPSubnetPercentUsed' }, { name => 'display' } ],
|
||||
output_template => 'used: %.2f %%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $mapping = {
|
||||
ibDhcpTotalNoOfDiscovers => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.3.1' },
|
||||
ibDhcpTotalNoOfRequests => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.3.2' },
|
||||
|
@ -106,12 +104,12 @@ my $mapping = {
|
|||
ibDhcpTotalNoOfNacks => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.3.6' },
|
||||
ibDhcpTotalNoOfDeclines => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.3.7' },
|
||||
ibDhcpTotalNoOfInforms => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.3.8' },
|
||||
ibDhcpTotalNoOfOthers => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.3.9' },
|
||||
ibDhcpTotalNoOfOthers => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.3.9' }
|
||||
};
|
||||
my $mapping2 = {
|
||||
ibDHCPSubnetNetworkAddress => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.1.1.1' },
|
||||
ibDHCPSubnetNetworkMask => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.1.1.2' },
|
||||
ibDHCPSubnetPercentUsed => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.1.1.3' },
|
||||
ibDHCPSubnetPercentUsed => { oid => '.1.3.6.1.4.1.7779.3.1.1.4.1.1.1.3' }
|
||||
};
|
||||
|
||||
my $oid_ibDHCPStatistics = '.1.3.6.1.4.1.7779.3.1.1.4.1.3';
|
||||
|
@ -123,7 +121,7 @@ sub manage_selection {
|
|||
my $snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oid_ibDHCPStatistics },
|
||||
{ oid => $oid_ibDHCPSubnetEntry },
|
||||
{ oid => $oid_ibDHCPSubnetEntry }
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
@ -140,16 +138,16 @@ sub manage_selection {
|
|||
$self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{dhcp}->{$instance} = { display => $name,
|
||||
|
||||
$self->{dhcp}->{$instance} = {
|
||||
display => $name,
|
||||
%$result
|
||||
};
|
||||
}
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result->{$oid_ibDHCPStatistics}, instance => '0');
|
||||
$self->{global} = { %$result };
|
||||
$self->{global} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result->{$oid_ibDHCPStatistics}, instance => 0);
|
||||
|
||||
$self->{cache_name} = "infoblox_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
$self->{cache_name} = 'infoblox_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
(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'));
|
||||
}
|
||||
|
|
|
@ -26,107 +26,135 @@ use strict;
|
|||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub set_counters {
|
||||
sub prefix_dns_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "zone '" . $options{instance_value}->{name} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_aa_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'autoritative average latency ';
|
||||
}
|
||||
|
||||
sub prefix_naa_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'non autoritative average latency ';
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'dns', type => 1, cb_prefix_output => 'prefix_dns_output', message_multiple => 'All dns zones are ok' },
|
||||
{ name => 'aa', type => 0, cb_prefix_output => 'prefix_aa_output' },
|
||||
{ name => 'naa', type => 0, cb_prefix_output => 'prefix_naa_output' },
|
||||
{ name => 'dns', type => 1, cb_prefix_output => 'prefix_dns_output', message_multiple => 'All dns zones are ok' }
|
||||
];
|
||||
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'total-query-rate', set => {
|
||||
key_values => [ { name => 'ibDnsQueryRate' } ],
|
||||
output_template => 'Total query rate : %s',
|
||||
{ label => 'total-query-rate', nlabel => 'dns.queries.persecond', set => {
|
||||
key_values => [ { name => 'dns_query' } ],
|
||||
output_template => 'query rate: %s/s',
|
||||
perfdatas => [
|
||||
{ label => 'total_query_rate', value => 'ibDnsQueryRate', template => '%s',
|
||||
min => 0 },
|
||||
],
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'total-hit-ratio', set => {
|
||||
key_values => [ { name => 'ibDnsHitRatio' } ],
|
||||
output_template => 'Total hit ratio : %.2f %%',
|
||||
{ label => 'total-hit-ratio', nlabel => 'dns.hits.percentage', set => {
|
||||
key_values => [ { name => 'dns_hit' } ],
|
||||
output_template => 'hit ratio: %.2f %%',
|
||||
perfdatas => [
|
||||
{ label => 'total_hit_ratio', value => 'ibDnsHitRatio', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%' },
|
||||
],
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
my $nlabels = { aa => 'authoritative', naa => 'non_authoritative' };
|
||||
foreach (('aa', 'naa')) {
|
||||
$self->{maps_counters}->{$_} = [];
|
||||
foreach my $timeframe (('1m', '5m', '15m')) {
|
||||
push @{$self->{maps_counters}->{$_}}, {
|
||||
label => $_ . '-latency-' . $timeframe, nlabel => 'dns.queries.' . $nlabels->{$_} . '.latency.' . $timeframe . '.microseconds', set => {
|
||||
key_values => [ { name => $_ . '_latency_' . $timeframe } ],
|
||||
output_template => '%s (' . $timeframe . ')',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 'us' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$self->{maps_counters}->{dns} = [
|
||||
{ label => 'success-count', set => {
|
||||
key_values => [ { name => 'ibBindZoneSuccess', diff => 1 }, { name => 'display' } ],
|
||||
output_template => 'Success responses : %s',
|
||||
{ label => 'success-count', nlabel => 'zone.responses.succeeded.count', set => {
|
||||
key_values => [ { name => 'success', diff => 1 }, { name => 'name' } ],
|
||||
output_template => 'success responses: %s',
|
||||
perfdatas => [
|
||||
{ label => 'success_count', value => 'ibBindZoneSuccess', template => '%s',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'name' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'referral-count', set => {
|
||||
key_values => [ { name => 'ibBindZoneReferral', diff => 1 }, { name => 'display' } ],
|
||||
output_template => 'Referrals : %s',
|
||||
{ label => 'referral-count', nlabel => 'zone.referrals.count', set => {
|
||||
key_values => [ { name => 'referral', diff => 1 }, { name => 'name' } ],
|
||||
output_template => 'referrals: %s',
|
||||
perfdatas => [
|
||||
{ label => 'referral_count', value => 'ibBindZoneReferral', template => '%s',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'name' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'nxrrset-count', set => {
|
||||
key_values => [ { name => 'ibBindZoneNxRRset', diff => 1 }, { name => 'display' } ],
|
||||
output_template => 'Non-existent record : %s',
|
||||
{ label => 'nxrrset-count', nlabel => 'zone.queries.nxrrset.count', set => {
|
||||
key_values => [ { name => 'nxrrset', diff => 1 }, { name => 'name' } ],
|
||||
output_template => 'non-existent record: %s',
|
||||
perfdatas => [
|
||||
{ label => 'nxrrset_count', value => 'ibBindZoneNxRRset', template => '%s',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'name' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'failure-count', set => {
|
||||
key_values => [ { name => 'ibBindZoneFailure', diff => 1 }, { name => 'display' } ],
|
||||
output_template => 'Failed queries : %s',
|
||||
{ label => 'failure-count', nlabel => 'zone.queries.failed.count', set => {
|
||||
key_values => [ { name => 'failure', diff => 1 }, { name => 'name' } ],
|
||||
output_template => 'failed queries: %s',
|
||||
perfdatas => [
|
||||
{ label => 'failure_count', value => 'ibBindZoneFailure', template => '%s',
|
||||
min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'name' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' }
|
||||
});
|
||||
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub prefix_dns_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Zone '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
my $mapping = {
|
||||
ibBindZoneName => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.1' },
|
||||
ibBindZoneSuccess => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.2' },
|
||||
ibBindZoneReferral => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.3' },
|
||||
ibBindZoneNxRRset => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.4' },
|
||||
ibBindZoneFailure => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.7' },
|
||||
name => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.1' }, # ibBindZoneName
|
||||
success => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.2' }, # ibBindZoneSuccess
|
||||
referral => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.3' }, # ibBindZoneReferral
|
||||
nxrrset => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.4' }, # ibBindZoneNxRRset
|
||||
failure => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1.7' } # ibBindZoneFailure
|
||||
};
|
||||
my $mapping2 = {
|
||||
ibDnsHitRatio => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.5' },
|
||||
ibDnsQueryRate => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.6' },
|
||||
naa_latency_1m => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.3.1.2.1.1' }, # ibNetworkMonitorDNSNonAAT1AvgLatency
|
||||
naa_latency_5m => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.3.1.2.2.1' }, # ibNetworkMonitorDNSNonAAT5AvgLatency
|
||||
naa_latency_15m => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.3.1.2.3.1' }, # ibNetworkMonitorDNSNonAAT15AvgLatency
|
||||
aa_latency_1m => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.3.1.3.1.1' }, # ibNetworkMonitorDNSAAT1AvgLatency
|
||||
aa_latency_5m => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.3.1.3.2.1' }, # ibNetworkMonitorDNSAAT5AvgLatency
|
||||
aa_latency_15m => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.3.1.3.3.1' }, # ibNetworkMonitorDNSAAT15AvgLatency
|
||||
dns_hit => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.5' }, # ibDnsHitRatio
|
||||
dns_query => { oid => '.1.3.6.1.4.1.7779.3.1.1.3.1.6' } # ibDnsQueryRate
|
||||
};
|
||||
|
||||
my $oid_ibZoneStatisticsEntry = '.1.3.6.1.4.1.7779.3.1.1.3.1.1.1';
|
||||
my $oid_ibDnsModule = '.1.3.6.1.4.1.7779.3.1.1.3.1';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -135,16 +163,17 @@ sub manage_selection {
|
|||
$self->{output}->add_option_msg(short_msg => "Need to use SNMP v2c or v3.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{dns} = {};
|
||||
my $snmp_result = $options{snmp}->get_multiple_table(
|
||||
oids => [
|
||||
{ oid => $oid_ibZoneStatisticsEntry },
|
||||
{ oid => $oid_ibDnsModule, start => $mapping2->{ibDnsHitRatio}->{oid} },
|
||||
],
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ map($_->{oid} . '.0', values(%$mapping2)) ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
$self->{global} = $options{snmp}->map_instance(mapping => $mapping2, results => $snmp_result, instance => 0);
|
||||
$self->{aa} = $self->{global};
|
||||
$self->{naa} = $self->{global};
|
||||
|
||||
$snmp_result = $options{snmp}->get_table(oid => $oid_ibZoneStatisticsEntry);
|
||||
$self->{dns} = {};
|
||||
foreach my $oid (keys %{$snmp_result->{$oid_ibZoneStatisticsEntry}}) {
|
||||
next if ($oid !~ /^$mapping->{ibBindZoneName}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
|
@ -155,21 +184,11 @@ sub manage_selection {
|
|||
$self->{output}->output_add(long_msg => "skipping '" . $result->{ibBindZoneName} . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{dns}->{$instance} = { display => $result->{ibBindZoneName},
|
||||
%$result
|
||||
};
|
||||
|
||||
$self->{dns}->{$instance} = $result;
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{dns}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No dns zone found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping2, results => $snmp_result->{$oid_ibDnsModule}, instance => '0');
|
||||
$self->{global} = { %$result };
|
||||
|
||||
$self->{cache_name} = "infoblox_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
$self->{cache_name} = 'infoblox_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
(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'));
|
||||
}
|
||||
|
@ -187,7 +206,7 @@ Check dns usage.
|
|||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^success-coun$'
|
||||
Example: --filter-counters='success'
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
|
@ -202,8 +221,10 @@ Can be: 'total-query-rate', 'total-hit-ratio', 'success-count', 'referral-count'
|
|||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'total-query-rate', 'total-hit-ratio', 'success-count', 'referral-count', 'nxrrset-count',
|
||||
'failure-count'.
|
||||
Can be: 'total-query-rate', 'total-hit-ratio',
|
||||
'success-count', 'referral-count', 'nxrrset-count', 'failure-count',
|
||||
'aa-latency-1m', 'aa-latency-5m', 'aa-latency-15m',
|
||||
'naa-latency-1m', 'naa-latency-5m', 'naa-latency-15m'.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::infoblox::snmp::mode::memory;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'memory', type => 0 },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{memory} = [
|
||||
{ label => 'mem-usage', set => {
|
||||
key_values => [ { name => 'ram_used' } ],
|
||||
output_template => 'Memory Used: %.2f%%',
|
||||
perfdatas => [
|
||||
{ label => 'memory_used', value => 'ram_used', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%' },
|
||||
],
|
||||
}
|
||||
},
|
||||
{ label => 'swap-usage', set => {
|
||||
key_values => [ { name => 'swap_used' } ],
|
||||
output_template => 'Swap Used: %.2f%%',
|
||||
perfdatas => [
|
||||
{ label => 'swap_used', value => 'swap_used', template => '%.2f',
|
||||
min => 0, max => 100, unit => '%' },
|
||||
],
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
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 $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [
|
||||
$oid_ibSystemMonitorMemUsage, $oid_ibSystemMonitorSwapUsage,
|
||||
],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{memory} = {
|
||||
ram_used => $snmp_result->{$oid_ibSystemMonitorMemUsage},
|
||||
swap_used => $snmp_result->{$oid_ibSystemMonitorSwapUsage},
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check memory usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*>
|
||||
|
||||
Threshold warning.
|
||||
Can be: 'mem-usage' (%), 'swap-usage' (%).
|
||||
|
||||
=item B<--critical-*>
|
||||
|
||||
Threshold critical.
|
||||
Can be: 'mem-usage' (%), 'swap-usage' (%).
|
||||
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -46,7 +46,7 @@ sub set_system {
|
|||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
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, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
@ -101,7 +101,7 @@ use warnings;
|
|||
|
||||
my %map_service_status = (
|
||||
1 => 'working', 2 => 'warning',
|
||||
3 => 'failed', 4 => 'inactive', 5 => 'unknown',
|
||||
3 => 'failed', 4 => 'inactive', 5 => 'unknown'
|
||||
);
|
||||
my %map_service_name = (
|
||||
1 => 'dhcp', 2 => 'dns', 3 => 'ntp', 4 => 'tftp', 5 => 'http-file-dist',
|
||||
|
@ -118,18 +118,18 @@ my %map_service_name = (
|
|||
49 => 'reporting', 50 => 'dns-cache-acceleration', 51 => 'ospf6',
|
||||
52 => 'swap-usage', 53 => 'discovery-consolidator', 54 => 'discovery-collector',
|
||||
55 => 'discovery-capacity', 56 => 'threat-protection', 57 => 'cloud-api',
|
||||
58 => 'threat-analytics', 59 => 'taxii', 60 => 'bfd', 61 => 'outbound',
|
||||
58 => 'threat-analytics', 59 => 'taxii', 60 => 'bfd', 61 => 'outbound'
|
||||
);
|
||||
|
||||
my $mapping = {
|
||||
ibNodeServiceName => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.10.1.1', map => \%map_service_name },
|
||||
ibNodeServiceStatus => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.10.1.2', map => \%map_service_status },
|
||||
ibNodeServiceStatus => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.10.1.2', map => \%map_service_status }
|
||||
};
|
||||
my $oid_ibMemberNodeServiceStatusEntry = '.1.3.6.1.4.1.7779.3.1.1.2.1.10.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_ibMemberNodeServiceStatusEntry, end => $mapping->{ibNodeServiceStatus}->{oid} };
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::infoblox::snmp::mode::system;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_ha_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"high-availablity status is '%s'",
|
||||
$self->{result_values}->{ha_status}
|
||||
);
|
||||
}
|
||||
|
||||
sub system_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "checking system '" . $options{instance_value}->{hw_type} . "'";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'system', type => 3, cb_long_output => 'system_long_output', indent_long_output => ' ',
|
||||
group => [
|
||||
{ name => 'cpu', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'memory', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'swap', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'temperature', type => 0, display_short => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'ha', type => 0, display_short => 0, skipped_code => { -10 => 1 } }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{cpu} = [
|
||||
{ label => 'cpu-load', nlabel => 'cpu.utilization.percentage', set => {
|
||||
key_values => [ { name => 'cpu_load' } ],
|
||||
output_template => 'cpu load: %.2f %%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{memory} = [
|
||||
{ label => 'memory-usage', nlabel => 'memory.usage.percentage', set => {
|
||||
key_values => [ { name => 'memory_used' } ],
|
||||
output_template => 'memory used: %.2f %%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{swap} = [
|
||||
{ label => 'swap-usage', nlabel => 'swap.usage.percentage', set => {
|
||||
key_values => [ { name => 'swap_used' } ],
|
||||
output_template => 'swap used: %.2f %%',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{temperature} = [
|
||||
{ label => 'cpu1-temperature', nlabel => 'system.cpu1.temperature.celsius', set => {
|
||||
key_values => [ { name => 'cpu1_temp' } ],
|
||||
output_template => 'cpu1 temperature: %.2f C',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', unit => 'C' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'cpu2-temperature', nlabel => 'system.cpu2.temperature.celsius', set => {
|
||||
key_values => [ { name => 'cpu2_temp' } ],
|
||||
output_template => 'cpu2 temperature: %.2f C',
|
||||
perfdatas => [
|
||||
{ template => '%.2f', unit => 'C' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{ha} = [
|
||||
{ label => 'ha-status', type => 2, set => {
|
||||
key_values => [ { name => 'ha_status' }, ],
|
||||
closure_custom_output => $self->can('custom_ha_status_output'),
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $mapping = {
|
||||
hw_type => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.4' }, # ibHardwareType
|
||||
cpu_load => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.8.1.1' }, # ibSystemMonitorCpuUsage
|
||||
memory_used => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.8.2.1' }, # ibSystemMonitorMemUsage
|
||||
swap_used => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.8.3.1' }, # ibSystemMonitorSwapUsage
|
||||
ha_status => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.13' }, # ibHaStatus
|
||||
cpu1_temp => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.17' }, # ibCPU1Temperature
|
||||
cpu2_temp => { oid => '.1.3.6.1.4.1.7779.3.1.1.2.1.18' } # ibCPU2Temperature
|
||||
};
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ map($_->{oid} . '.0', values(%$mapping)) ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => 0);
|
||||
|
||||
$self->{output}->output_add(short_msg => "System '" . $result->{hw_type} . "' is ok");
|
||||
$result->{cpu1_temp} = defined($result->{cpu1_temp}) && $result->{cpu1_temp} > 0 ? sprintf('%.2f', $result->{cpu1_temp}) : undef;
|
||||
$result->{cpu2_temp} = defined($result->{cpu2_temp}) && $result->{cpu2_temp} > 0 ? sprintf('%.2f', $result->{cpu2_temp}) : undef;
|
||||
|
||||
$self->{system} = {
|
||||
global => {
|
||||
hw_type => $result->{hw_type},
|
||||
cpu => { cpu_load => $result->{cpu_load} },
|
||||
memory => { memory_used => $result->{memory_used} },
|
||||
swap => { swap_used => $result->{swap_used} },
|
||||
temperature => {
|
||||
cpu1_temp => $result->{cpu1_temp},
|
||||
cpu2_temp => $result->{cpu2_temp}
|
||||
},
|
||||
ha => { ha_status => $result->{ha_status} }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^memory-usage$'
|
||||
|
||||
=item B<--warning-ha-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Can used special variables like: %{ha_status}
|
||||
|
||||
=item B<--critical-ha-status>
|
||||
|
||||
Set critical threshold for status.
|
||||
Can used special variables like: %{ha_status}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'cpu-load' (%), 'cpu1-temperature', 'cpu2-temperature', 'swap-usage' (%), 'memory-usage' (%).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -30,15 +30,14 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'cpu' => 'network::infoblox::snmp::mode::cpu',
|
||||
$self->{modes} = {
|
||||
'dhcp-usage' => 'network::infoblox::snmp::mode::dhcpusage',
|
||||
'dns-usage' => 'network::infoblox::snmp::mode::dnsusage',
|
||||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'memory' => 'network::infoblox::snmp::mode::memory',
|
||||
'services' => 'network::infoblox::snmp::mode::services',
|
||||
);
|
||||
'system' => 'network::infoblox::snmp::mode::system'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue