(plugin) network:🇦🇼:cppm::snmp - new (#4325)

This commit is contained in:
qgarnier 2023-04-05 16:55:47 +02:00 committed by GitHub
parent 99af7a68f6
commit 1402f7cad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1111 additions and 0 deletions

View File

@ -0,0 +1,5 @@
{
"dependencies": [
"libsnmp-perl"
]
}

View File

@ -0,0 +1,14 @@
{
"pkg_name": "centreon-plugin-Network-Aruba-Cppm-Snmp",
"pkg_summary": "Centreon Plugin to monitor Aruba ClearPass Policy Manager using SNMP",
"plugin_name": "centreon_aruba_cppm_snmp.pl",
"files": [
"centreon/plugins/script_snmp.pm",
"centreon/plugins/snmp.pm",
"snmp_standard/mode/cpu.pm",
"snmp_standard/mode/listinterfaces.pm",
"snmp_standard/mode/resources/",
"snmp_standard/mode/interfaces.pm",
"network/aruba/cppm/snmp/"
]
}

View File

@ -0,0 +1,5 @@
{
"dependencies": [
"perl(SNMP)"
]
}

View File

@ -0,0 +1,68 @@
#
# Copyright 2023 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::aruba::cppm::snmp::mode::cpu;
use base qw(snmp_standard::mode::cpu);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
1;
__END__
=head1 MODE
Check system CPUs.
=over 8
=item B<--use-ucd>
Use UCD mib for cpu average.
=item B<--warning-average>
Warning threshold average CPU utilization.
=item B<--critical-average>
Critical threshold average CPU utilization.
=item B<--warning-core>
Warning thresholds for each CPU core
=item B<--critical-core>
Critical thresholds for each CPU core
=back
=cut

View File

@ -0,0 +1,154 @@
#
# Copyright 2023 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::aruba::cppm::snmp::mode::disks;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_space_usage_output {
my ($self, %options) = @_;
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total_space});
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used_space});
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free_space});
return sprintf(
'space usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)',
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used_space},
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free_space}
);
}
sub prefix_disk_output {
my ($self, %options) = @_;
return "Disk '" . $options{instance}. "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'disks', type => 1, cb_prefix_output => 'prefix_disk_output', message_multiple => 'All disks are ok' }
];
$self->{maps_counters}->{disks} = [
{ label => 'space-usage', nlabel => 'disk.space.usage.bytes', set => {
key_values => [ { name => 'used_space' }, { name => 'free_space' }, { name => 'prct_used_space' }, { name => 'prct_free_space' }, { name => 'total_space' } ],
closure_custom_output => $self->can('custom_space_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total_space', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'space-usage-free', nlabel => 'disk.space.free.bytes', display_ok => 0, set => {
key_values => [ { name => 'free_space' }, { name => 'used_space' }, { name => 'prct_used_space' }, { name => 'prct_free_space' }, { name => 'total_space' } ],
closure_custom_output => $self->can('custom_space_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total_space', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'space-usage-prct', nlabel => 'disk.space.usage.percentage', display_ok => 0, set => {
key_values => [ { name => 'prct_used_space' }, { name => 'used_space' }, { name => 'free_space' }, { name => 'prct_free_space' }, { name => 'total_space' } ],
closure_custom_output => $self->can('custom_space_usage_output'),
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
}
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 => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
hostname => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.4' }, # cppmSystemHostname
total => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.14' }, # cppmSystemDiskSpaceTotal
free => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.15' } # cppmSystemDiskSpaceFree
};
my $oid_diskEntry = '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1';
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_diskEntry, start => $mapping->{total}->{oid}, end => $mapping->{free}->{oid} },
{ oid => $mapping->{hostname}->{oid} }
],
return_type => 1,
nothing_quit => 1
);
$self->{disks} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping->{hostname}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{hostname} !~ /$self->{option_results}->{filter_name}/);
$self->{disks}->{ $result->{hostname} } = {
free_space => $result->{free},
total_space => $result->{total},
used_space => $result->{total} - $result->{free},
prct_used_space => ($result->{total} - $result->{free}) * 100 / $result->{total},
prct_free_space => $result->{free} * 100 / $result->{total},
};
}
}
1;
__END__
=head1 MODE
Check disks.
=over 8
=item B<--filter-name>
Filter disks by system hostname (can be a regexp).
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'space-usage', 'space-usage-free', 'space-usage-prct'.
=back
=cut

View File

@ -0,0 +1,182 @@
#
# Copyright 2023 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::aruba::cppm::snmp::mode::interfaces;
use base qw(snmp_standard::mode::interfaces);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
return $self;
}
1;
__END__
=head1 MODE
Check interfaces.
=over 8
=item B<--add-global>
Check global port statistics (By default if no --add-* option is set).
=item B<--add-status>
Check interface status.
=item B<--add-duplex-status>
Check duplex status (with --warning-status and --critical-status).
=item B<--add-traffic>
Check interface traffic.
=item B<--add-errors>
Check interface errors.
=item B<--add-cast>
Check interface cast.
=item B<--add-speed>
Check interface speed.
=item B<--add-volume>
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
=item B<--check-metrics>
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
=item B<--warning-status>
Set warning threshold for status.
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
=item B<--critical-status>
Set critical threshold for status (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
'speed' (b/s).
=item B<--units-traffic>
Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta', 'bps', 'counter').
=item B<--units-errors>
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
=item B<--units-cast>
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
=item B<--nagvis-perfdata>
Display traffic perfdata to be compatible with nagvis widget.
=item B<--interface>
Set the interface (number expected) ex: 1,2,... (empty means 'check all interface').
=item B<--name>
Allows to use interface name with option --interface instead of interface oid index (Can be a regexp)
=item B<--speed>
Set interface speed for incoming/outgoing traffic (in Mb).
=item B<--speed-in>
Set interface speed for incoming traffic (in Mb).
=item B<--speed-out>
Set interface speed for outgoing traffic (in Mb).
=item B<--map-speed-dsl>
Get interface speed configuration for interface type 'adsl' and 'vdsl2'.
Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name
E.g: --map-speed-dsl=Et0.835,Et0-vdsl2
=item B<--force-counters64>
Force to use 64 bits counters only. Can be used to improve performance.
=item B<--force-counters32>
Force to use 32 bits counters (even in snmp v2c and v3). Should be used when 64 bits counters are buggy.
=item B<--reload-cache-time>
Time in minutes before reloading cache file (default: 180).
=item B<--oid-filter>
Choose OID used to filter interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
=item B<--oid-display>
Choose OID used to display interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
=item B<--oid-extra-display>
Add an OID to display.
=item B<--display-transform-src>
Regexp src to transform display value.
=item B<--display-transform-dst>
Regexp dst to transform display value.
=item B<--show-cache>
Display cache interface datas.
=back
=cut

View File

@ -0,0 +1,154 @@
#
# Copyright 2023 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::aruba::cppm::snmp::mode::memory;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub custom_usage_output {
my ($self, %options) = @_;
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
return sprintf(
'usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)',
$total_size_value . " " . $total_size_unit,
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
);
}
sub prefix_memory_output {
my ($self, %options) = @_;
return "Memory '" . $options{instance}. "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'memories', type => 1, cb_prefix_output => 'prefix_memory_output', message_multiple => 'All memories are ok' }
];
$self->{maps_counters}->{memories} = [
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'usage-free', nlabel => 'memory.free.bytes', display_ok => 0, set => {
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
]
}
},
{ label => 'usage-prct', nlabel => 'memory.usage.percentage', display_ok => 0, set => {
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
closure_custom_output => $self->can('custom_usage_output'),
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
]
}
}
];
}
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 => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
hostname => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.4' }, # cppmSystemHostname
total => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.12' }, # cppmSystemMemoryTotal
free => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.13' } # cppmSystemMemoryFree
};
my $oid_memEntry = '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1';
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_memEntry, start => $mapping->{total}->{oid}, end => $mapping->{free}->{oid} },
{ oid => $mapping->{hostname}->{oid} }
],
return_type => 1,
nothing_quit => 1
);
$self->{memories} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping->{hostname}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{hostname} !~ /$self->{option_results}->{filter_name}/);
$self->{memories}->{ $result->{hostname} } = {
free => $result->{free},
total => $result->{total},
used => $result->{total} - $result->{free},
prct_used => ($result->{total} - $result->{free}) * 100 / $result->{total},
prct_free => $result->{free} * 100 / $result->{total},
};
}
}
1;
__END__
=head1 MODE
Check memory usages.
=over 8
=item B<--filter-name>
Filter memory by system hostname (can be a regexp).
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'usage', 'usage-free', 'usage-prct'.
=back
=cut

View File

@ -0,0 +1,156 @@
#
# Copyright 2023 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.
#
# Authors : Alexandre Moreau <alexandre.moreau@cheops.fr> (@SpyL1nk)
package network::aruba::cppm::snmp::mode::radius;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_radius_output {
my ($self, %options) = @_;
return "Radius '" . $options{instance}. "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'radius', type => 1, cb_prefix_output => 'prefix_radius_output', message_multiple => 'All radius statistics are ok' }
];
$self->{maps_counters}->{radius} = [
{ label => 'radius-policy-eval', nlabel => 'radius.policy.evaluation.milliseconds', set => {
key_values => [ { name => 'policyEvalTime' } ],
output_template => 'policy evaluation time: %s ms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'radius-requests-time', nlabel => 'radius.requests.milliseconds', set => {
key_values => [ { name => 'authRequestTime' } ],
output_template => 'requests time: %s ms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'radius-requests', nlabel => 'radius.requests.count', set => {
key_values => [ { name => 'totalReq' } ],
output_template => 'total requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'radius-requests-failed', nlabel => 'radius.requests.failed.count', set => {
key_values => [ { name => 'failedReq' } ],
output_template => 'failed requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'radius-requests-succeeded', nlabel => 'radius.requests.succeeded.count', set => {
key_values => [ { name => 'successReq' } ],
output_template => 'succeeded requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
];
}
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 => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
hostname => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.4' }, # cppmSystemHostname
policyEvalTime => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.1.1.1' }, # radPolicyEvalTime
authRequestTime => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.1.1.2' }, # radAuthRequestTime
successReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.1.1.3' }, # radServerCounterSuccess
failedReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.1.1.4' }, # radServerCounterFailure
totalReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.1.1.5' } # radServerCounterCount
};
my $oid_radiusEntry = '.1.3.6.1.4.1.14823.1.6.1.1.2.1.1';
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_radiusEntry },
{ oid => $mapping->{hostname}->{oid} }
],
return_type => 1,
nothing_quit => 1
);
$self->{radius} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping->{hostname}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{hostname} !~ /$self->{option_results}->{filter_name}/);
$self->{radius}->{ $result->{hostname} } = $result;
}
}
1;
__END__
=head1 MODE
Check radius statistics.
=over 8
=item B<--filter-name>
Filter radius by system hostname (can be a regexp).
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'radius-policy-eval', 'radius-requests-time',
'radius-requests', 'radius-requests-failed', 'radius-requests-succeeded'.
=back
=cut

View File

@ -0,0 +1,143 @@
#
# Copyright 2023 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.
#
# Authors : Alexandre Moreau <alexandre.moreau@cheops.fr> (@SpyL1nk)
package network::aruba::cppm::snmp::mode::repositories;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_repository_output {
my ($self, %options) = @_;
return "Authentication repository '" . $options{instance}. "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'repositories', type => 1, cb_prefix_output => 'prefix_repository_output', message_multiple => 'All authentication repositories are ok' }
];
$self->{maps_counters}->{repositories} = [
{ label => 'requests-time', nlabel => 'authentication_repository.requests.milliseconds', set => {
key_values => [ { name => 'timeReq' } ],
output_template => 'requests time: %s ms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'requests', nlabel => 'authentication_repository.requests.count', set => {
key_values => [ { name => 'totalReq' } ],
output_template => 'total requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'requests-failed', nlabel => 'authentication_repository.requests.failed.count', set => {
key_values => [ { name => 'failedReq' } ],
output_template => 'failed requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'requests-succeeded', nlabel => 'authentication_repository.requests.succeeded.count', set => {
key_values => [ { name => 'successReq' } ],
output_template => 'succeeded requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
}
];
}
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 => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
sourceName => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.2.1.2' }, # radAuthSourceName
successReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.2.1.3' }, # radAuthCounterSuccess
failedReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.2.1.4' }, # radAuthCounterFailure
totalReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.2.1.5' }, # radAuthCounterCount
timeReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.2.1.6' } # radAuthCounterTime
};
my $oid_authEntry = '.1.3.6.1.4.1.14823.1.6.1.1.2.2.1';
my $snmp_result = $options{snmp}->get_table(
oid => $oid_authEntry,
nothing_quit => 1
);
$self->{repositories} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping->{sourceName}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{sourceName} !~ /$self->{option_results}->{filter_name}/);
$self->{repositories}->{ $result->{sourceName} } = $result;
}
}
1;
__END__
=head1 MODE
Check ClearPass authentication repository statistics.
=over 8
=item B<--filter-name>
Filter authentification repositories by system hostname (can be a regexp).
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'requests-time', 'requests', 'requests-failed',
'requests-succeeded'.
=back
=cut

View File

@ -0,0 +1,175 @@
#
# Copyright 2023 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.
#
# Authors : Alexandre Moreau <alexandre.moreau@cheops.fr> (@SpyL1nk)
package network::aruba::cppm::snmp::mode::tacacs;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_tacacs_auth_output {
my ($self, %options) = @_;
return "Tacacs authentication '" . $options{instance}. "' ";
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'tacacs_auth', type => 1, cb_prefix_output => 'prefix_tacacs_auth_output', message_multiple => 'All tacas+ authentication are ok' }
];
$self->{maps_counters}->{tacacs_auth} = [
{ label => 'tacacs-auth-policy-eval', nlabel => 'tacacs.authentication.policy.evaluation.milliseconds', set => {
key_values => [ { name => 'policyEvalTime' } ],
output_template => 'policy evaluation time: %s ms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'tacacs-auth-policy-eval', nlabel => 'tacacs.authentication.service.policy.evaluation.milliseconds', set => {
key_values => [ { name => 'servicePolicyEvalTime' } ],
output_template => 'service policy evaluation time: %s ms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'tacacs-auth-requests-auth-time', nlabel => 'tacacs.authentication.requests.authentication.time.milliseconds', set => {
key_values => [ { name => 'authTimeReq' } ],
output_template => 'requests authentication time: %s ms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'tacacs-auth-requests-time', nlabel => 'tacacs.authentication.requests.time.milliseconds', set => {
key_values => [ { name => 'timeReq' } ],
output_template => 'requests time: %s ms',
perfdatas => [
{ template => '%s', unit => 'ms', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'tacacs-auth-requests', nlabel => 'tacacs.authentication.requests.count', set => {
key_values => [ { name => 'totalReq' } ],
output_template => 'total requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'tacacs-auth-requests-failed', nlabel => 'tacacs.authentication.requests.failed.count', set => {
key_values => [ { name => 'failedReq' } ],
output_template => 'failed requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
},
{ label => 'tacacs-auth-requests-succeeded', nlabel => 'tacacs.authentication.requests.succeeded.count', set => {
key_values => [ { name => 'successReq' } ],
output_template => 'succeeded requests: %s',
perfdatas => [
{ template => '%s', min => 0, label_extra_instance => 1 }
]
}
}
];
}
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 => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
hostname => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.4' }, # cppmSystemHostname
successReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1.1' }, # tacAuthCounterSuccess
failedReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1.2' }, # tacAuthCounterFailure
totalReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1.3' }, # tacAuthCounterCount
timeReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1.4' }, # tacAuthCounterTime
authTimeReq => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1.5' }, # tacAuthCounterAuthTime
servicePolicyEvalTime => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1.6' }, # tacServicePolicyEvalTime
policyEvalTime => { oid => '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1.7' } # tacPolicyEvalTime
};
my $oid_tacacsAuthEntry = '.1.3.6.1.4.1.14823.1.6.1.1.2.7.1';
my $snmp_result = $options{snmp}->get_multiple_table(
oids => [
{ oid => $oid_tacacsAuthEntry },
{ oid => $mapping->{hostname}->{oid} }
],
return_type => 1,
nothing_quit => 1
);
$self->{tacacs_auth} = {};
foreach my $oid (keys %$snmp_result) {
next if ($oid !~ /^$mapping->{hostname}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{hostname} !~ /$self->{option_results}->{filter_name}/);
$self->{tacacs_auth}->{ $result->{hostname} } = $result;
}
}
1;
__END__
=head1 MODE
Check TACACS+ statistics.
=over 8
=item B<--filter-name>
Filter tacacs by system hostname (can be a regexp).
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'tacacs-auth-policy-eval', 'tacacs-auth-policy-eval', 'tacacs-auth-requests-auth-time','
'tacacs-auth-requests-time', 'tacacs-auth-requests', 'tacacs-auth-requests-failed',
'tacacs-auth-requests-succeeded'.
=back
=cut

View File

@ -0,0 +1,55 @@
#
# Copyright 2023 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.
#
# Authors : Alexandre Moreau <alexandre.moreau@cheops.fr> (@SpyL1nk)
package network::aruba::cppm::snmp::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_snmp);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{modes} = {
'cpu' => 'network::aruba::cppm::snmp::mode::cpu',
'disks' => 'network::aruba::cppm::snmp::mode::disks',
'interfaces' => 'network::aruba::cppm::snmp::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'network::aruba::cppm::snmp::mode::memory',
'radius' => 'network::aruba::cppm::snmp::mode::radius',
'repositories' => 'network::aruba::cppm::snmp::mode::repositories',
'tacacs' => 'network::aruba::cppm::snmp::mode::tacacs'
};
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Aruba ClearPass Policy Manager in SNMP.
=cut