add plugin acme packet SNMP

This commit is contained in:
qgarnier 2017-06-06 14:56:19 +02:00
parent 22cf8df530
commit 9c6c813ea1
12 changed files with 1393 additions and 0 deletions

View File

@ -0,0 +1,79 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::components::fan;
use strict;
use warnings;
use network::acmepacket::snmp::mode::components::resources qw($map_status);
my $mapping = {
apEnvMonFanStatusDescr => { oid => '.1.3.6.1.4.1.9148.3.3.1.4.1.1.3' },
apEnvMonFanStatusValue => { oid => '.1.3.6.1.4.1.9148.3.3.1.4.1.1.4' },
apEnvMonFanState => { oid => '.1.3.6.1.4.1.9148.3.3.1.4.1.1.5', map => $map_status },
};
my $oid_apEnvMonFanStatusEntry = '.1.3.6.1.4.1.9148.3.3.1.4.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_apEnvMonFanStatusEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fans");
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
return if ($self->check_filter(section => 'fan'));
my ($exit, $warn, $crit, $checked);
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_apEnvMonFanStatusEntry}})) {
next if ($oid !~ /^$mapping->{apEnvMonFanState}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_apEnvMonFanStatusEntry}, instance => $instance);
next if ($self->check_filter(section => 'fan', instance => $instance));
next if ($result->{apEnvMonFanState} =~ /notPresent/i &&
$self->absent_problem(section => 'fan', instance => $instance));
$self->{components}->{fan}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance = %s, speed = %s]",
$result->{apEnvMonFanStatusDescr}, $result->{apEnvMonFanState}, $instance, defined($result->{apEnvMonFanStatusValue}) ? $result->{apEnvMonFanStatusValue} : 'unknown'));
$exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{apEnvMonFanState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' status is '%s'", $result->{apEnvMonFanStatusDescr}, $result->{apEnvMonFanState}));
}
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{apEnvMonFanStatusValue});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' is '%s' %%", $result->{apEnvMonFanStatusDescr}, $result->{apEnvMonFanStatusValue}));
}
$self->{output}->perfdata_add(label => 'fan_' . $result->{apEnvMonFanStatusDescr}, unit => '%',
value => $result->{apEnvMonFanStatusValue},
warning => $warn,
critical => $crit, min => 0, max => 100
);
}
}
1;

View File

@ -0,0 +1,66 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::components::psu;
use strict;
use warnings;
use network::acmepacket::snmp::mode::components::resources qw($map_status);
my $mapping = {
apEnvMonPowerSupplyStatusDescr => { oid => '.1.3.6.1.4.1.9148.3.3.1.5.1.1.3' },
apEnvMonPowerSupplyState => { oid => '.1.3.6.1.4.1.9148.3.3.1.5.1.1.4', map => $map_status },
};
my $oid_apEnvMonPowerSupplyStatusEntry = '.1.3.6.1.4.1.9148.3.3.1.5.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_apEnvMonPowerSupplyStatusEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking power supplies");
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
return if ($self->check_filter(section => 'psu'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_apEnvMonPowerSupplyStatusEntry}})) {
next if ($oid !~ /^$mapping->{apEnvMonPowerSupplyState}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_apEnvMonPowerSupplyStatusEntry}, instance => $instance);
next if ($self->check_filter(section => 'psu', instance => $instance));
next if ($result->{apEnvMonPowerSupplyState} =~ /notPresent/i &&
$self->absent_problem(section => 'psu', instance => $instance));
$self->{components}->{psu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance = %s]",
$result->{apEnvMonPowerSupplyStatusDescr}, $result->{apEnvMonPowerSupplyState}, $instance));
my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{apEnvMonPowerSupplyState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{apEnvMonPowerSupplyStatusDescr}, $result->{apEnvMonPowerSupplyState}));
}
}
}
1;

View File

@ -0,0 +1,38 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::components::resources;
use strict;
use warnings;
use Exporter;
our $map_status;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw($map_status);
$map_status = { 1 => 'initial', 2 => 'normal',
3 => 'minor', 4 => 'major', 5 => 'critical',
6 => 'shutdown', 7 => 'notPresent',
8 => 'notFunctioning', 9 => 'unknown'
};
1;

View File

@ -0,0 +1,80 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::components::temperature;
use strict;
use warnings;
use network::acmepacket::snmp::mode::components::resources qw($map_status);
my $mapping = {
apEnvMonTemperatureStatusDescr => { oid => '.1.3.6.1.4.1.9148.3.3.1.3.1.1.3' },
apEnvMonTemperatureStatusValue => { oid => '.1.3.6.1.4.1.9148.3.3.1.3.1.1.4' },
apEnvMonTemperatureState => { oid => '.1.3.6.1.4.1.9148.3.3.1.3.1.1.5', map => $map_status },
};
my $oid_apEnvMonTemperatureStatusEntry = '.1.3.6.1.4.1.9148.3.3.1.3.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_apEnvMonTemperatureStatusEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking temperatures");
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
return if ($self->check_filter(section => 'temperature'));
my ($exit, $warn, $crit, $checked);
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_apEnvMonTemperatureStatusEntry}})) {
next if ($oid !~ /^$mapping->{apEnvMonTemperatureState}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_apEnvMonTemperatureStatusEntry}, instance => $instance);
next if ($self->check_filter(section => 'temperature', instance => $instance));
next if ($result->{apEnvMonTemperatureState} =~ /notPresent/i &&
$self->absent_problem(section => 'temperature', instance => $instance));
$self->{components}->{temperature}->{total}++;
$self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s' [instance = %s, value = %s]",
$result->{apEnvMonTemperatureStatusDescr}, $result->{apEnvMonTemperatureState}, $instance,
$result->{apEnvMonTemperatureStatusValue}));
$exit = $self->get_severity(label => 'default', section => 'temperature', value => $result->{apEnvMonTemperatureState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature '%s' status is '%s'", $result->{apEnvMonTemperatureStatusDescr}, $result->{apEnvMonTemperatureState}));
}
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{apEnvMonTemperatureStatusValue});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature '%s' is '%s' C", $result->{apEnvMonTemperatureStatusDescr}, $result->{apEnvMonTemperatureStatusValue}));
}
$self->{output}->perfdata_add(label => 'temperature_' . $result->{apEnvMonTemperatureStatusDescr}, unit => 'C',
value => $result->{apEnvMonTemperatureStatusValue},
warning => $warn,
critical => $crit
);
}
}
1;

View File

@ -0,0 +1,81 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::components::voltage;
use strict;
use warnings;
use network::acmepacket::snmp::mode::components::resources qw($map_status);
my $mapping = {
apEnvMonVoltageStatusDescr => { oid => '.1.3.6.1.4.1.9148.3.3.1.2.1.1.3' },
apEnvMonVoltageStatusValue => { oid => '.1.3.6.1.4.1.9148.3.3.1.2.1.1.4' },
apEnvMonVoltageState => { oid => '.1.3.6.1.4.1.9148.3.3.1.2.1.1.5', map => $map_status },
};
my $oid_apEnvMonVoltageStatusEntry = '.1.3.6.1.4.1.9148.3.3.1.2.1.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_apEnvMonVoltageStatusEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking voltages");
$self->{components}->{voltage} = {name => 'voltages', total => 0, skip => 0};
return if ($self->check_filter(section => 'voltage'));
my ($exit, $warn, $crit, $checked);
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_apEnvMonVoltageStatusEntry}})) {
next if ($oid !~ /^$mapping->{apEnvMonVoltageState}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_apEnvMonVoltageStatusEntry}, instance => $instance);
next if ($self->check_filter(section => 'voltage', instance => $instance));
next if ($result->{apEnvMonVoltageState} =~ /notPresent/i &&
$self->absent_problem(section => 'voltage', instance => $instance));
$result->{apEnvMonVoltageStatusValue} = sprintf("%.3f", $result->{apEnvMonVoltageStatusValue});
$self->{components}->{voltage}->{total}++;
$self->{output}->output_add(long_msg => sprintf("voltage '%s' status is '%s' [instance = %s, value = %s]",
$result->{apEnvMonVoltageStatusDescr}, $result->{apEnvMonVoltageState}, $instance,
$result->{apEnvMonVoltageStatusValue}));
$exit = $self->get_severity(label => 'default', section => 'voltage', value => $result->{apEnvMonVoltageState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Voltage '%s' status is '%s'", $result->{apEnvMonVoltageStatusDescr}, $result->{apEnvMonVoltageState}));
}
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{apEnvMonVoltageStatusValue});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Voltage '%s' is '%s' V", $result->{apEnvMonVoltageStatusDescr}, $result->{apEnvMonVoltageStatusValue}));
}
$self->{output}->perfdata_add(label => 'voltage_' . $result->{apEnvMonVoltageStatusDescr}, unit => 'V',
value => $result->{apEnvMonVoltageStatusValue},
warning => $warn,
critical => $crit
);
}
}
1;

View File

@ -0,0 +1,121 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::hardware;
use base qw(centreon::plugins::templates::hardware);
use strict;
use warnings;
sub set_system {
my ($self, %options) = @_;
$self->{regexp_threshold_overload_check_section_option} = '^(voltage|temperature|fan|psu)$';
$self->{regexp_threshold_numeric_check_section_option} = '^(voltage|temperature|fan)$';
$self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = {
default => [
['initial', 'OK'],
['normal', 'OK'],
['minor', 'WARNING'],
['major', 'CRITICAL'],
['critical', 'CRITICAL'],
['shutdown', 'CRITICAL'],
['notPresent', 'OK'],
['notFunctioning', 'CRITICAL'],
['unknown', 'UNKNOWN'],
],
};
$self->{components_path} = 'network::acmepacket::snmp::mode::components';
$self->{components_module} = ['voltage', 'temperature', 'fan', 'psu'];
}
sub snmp_execute {
my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
});
return $self;
}
1;
__END__
=head1 MODE
Check hardware.
=over 8
=item B<--component>
Which component to check (Default: '.*').
Can be: 'voltage', 'temperature', 'fan', 'psu'.
=item B<--filter>
Exclude some parts (comma seperated list) (Example: --filter=fan --filter=psu)
Can also exclude specific instance: --filter=fan,1
=item B<--absent-problem>
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
Can be specific or global: --absent-problem=psu,1
=item B<--no-component>
Return an error if no compenents are checked.
If total (with skipped) is 0. (Default: 'critical' returns).
=item B<--threshold-overload>
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
It used before default thresholds (order stays).
Example: --threshold-overload='psu,CRITICAL,^(?!(normal|initial)$)'
=item B<--warning>
Set warning threshold for 'temperature', 'fan', 'voltage' (syntax: type,regexp,threshold)
Example: --warning='temperature,.*,40'
=item B<--critical>
Set critical threshold for 'temperature', 'fan', 'voltage' (syntax: type,regexp,threshold)
Example: --critical='temperature,.*,50'
=back
=cut

View File

@ -0,0 +1,112 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::listrealm;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
my $oid_apSigRealmStatsRealmName = '.1.3.6.1.4.1.9148.3.2.1.2.4.1.2';
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $self->{snmp}->get_table(oid => $oid_apSigRealmStatsRealmName, nothing_quit => 1);
$self->{realm} = {};
foreach my $oid (keys %{$snmp_result}) {
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$snmp_result->{$oid} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping service class '" . $snmp_result->{$oid} . "'.", debug => 1);
next;
}
$self->{realm}->{$snmp_result->{$oid}} = { name => $snmp_result->{$oid} };
}
}
sub run {
my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
$self->manage_selection();
foreach my $name (sort keys %{$self->{realm}}) {
$self->{output}->output_add(long_msg => "'" . $name . "'");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List Realm:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['name']);
}
sub disco_show {
my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
$self->manage_selection();
foreach my $name (sort keys %{$self->{realm}}) {
$self->{output}->add_disco_entry(name => $name);
}
}
1;
__END__
=head1 MODE
List realm.
=over 8
=item B<--filter-name>
Filter by realm name.
=back
=cut

View File

@ -0,0 +1,129 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::listsip;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
});
$self->{sip} = {};
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
my %map_status = (
0 => 'disabled', 1 => 'outOfService',
2 => 'standby', 3 => 'inService',
4 => 'constraintsViolation', 5 => 'inServiceTimedOut',
6 => 'oosprovisionedresponse',
);
my $mapping = {
apSipSAStatsSessionAgentHostname => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.2.1.2' },
apSipSAStatsSessionAgentStatus => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.2.1.22', map => \%map_status },
};
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_multiple_table(oids => [
{ oid => $mapping->{apSipSAStatsSessionAgentHostname}->{oid} },
{ oid => $mapping->{apSipSAStatsSessionAgentStatus}->{oid} },
],
return_type => 1, nothing_quit => 1);
foreach my $oid (keys %{$snmp_result}) {
next if ($oid !~ /^$mapping->{apSipSAStatsSessionAgentHostname}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{apSipSAStatsSessionAgentHostname} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $result->{apSipSAStatsSessionAgentHostname} . "': no matching filter.", debug => 1);
next;
}
$self->{sip}->{$instance} = { name => $result->{apSipSAStatsSessionAgentHostname}, status => $result->{apSipSAStatsSessionAgentStatus} };
}
}
sub run {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach my $instance (sort keys %{$self->{sip}}) {
$self->{output}->output_add(long_msg => '[name = ' . $self->{sip}->{$instance}->{name} . "] [status = '" . $self->{sip}->{$instance}->{status} . "']");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List SIPs:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['name', 'status']);
}
sub disco_show {
my ($self, %options) = @_;
$self->manage_selection(%options);
foreach my $instance (sort keys %{$self->{sip}}) {
$self->{output}->add_disco_entry(name => $self->{sip}->{$instance}->{name}, status => $self->{sip}->{$instance}->{status});
}
}
1;
__END__
=head1 MODE
List SIPs.
=over 8
=item B<--filter-name>
Filter by SIP name (can be a regexp).
=back
=cut

View File

@ -0,0 +1,216 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::realmusage;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'realm', type => 1, cb_prefix_output => 'prefix_realm_output', message_multiple => 'All realms are ok' }
];
$self->{maps_counters}->{realm} = [
{ label => 'current-in-sessions', set => {
key_values => [ { name => 'apSigRealmStatsCurrentActiveSessionsInbound' }, { name => 'display' } ],
output_template => 'Current Inbound Sessions : %s',
perfdatas => [
{ label => 'current_inbound_sessions', value => 'apSigRealmStatsCurrentActiveSessionsInbound_absolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'current-in-sessions-rate', set => {
key_values => [ { name => 'apSigRealmStatsCurrentSessionRateInbound' }, { name => 'display' } ],
output_template => 'Current Inbound Sessions Rate : %s/s',
perfdatas => [
{ label => 'current_inbound_sessions_rate', value => 'apSigRealmStatsCurrentSessionRateInbound_absolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'total-in-sessions', set => {
key_values => [ { name => 'apSigRealmStatsTotalSessionsInbound', diff => 1 }, { name => 'display' } ],
output_template => 'Total Inbound Sessions : %s',
perfdatas => [
{ label => 'total_inbound_sessions', value => 'apSigRealmStatsTotalSessionsInbound_absolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'current-out-sessions', set => {
key_values => [ { name => 'apSigRealmStatsCurrentActiveSessionsOutbound' }, { name => 'display' } ],
output_template => 'Current Outbound Sessions : %s',
perfdatas => [
{ label => 'current_outbound_sessions', value => 'apSigRealmStatsCurrentActiveSessionsOutbound_absolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'current-out-sessions-rate', set => {
key_values => [ { name => 'apSigRealmStatsCurrentSessionRateOutbound' }, { name => 'display' } ],
output_template => 'Current Outbound Sessions Rate : %s/s',
perfdatas => [
{ label => 'current_outbound_sessions_rate', value => 'apSigRealmStatsCurrentSessionRateOutbound_absolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'total-out-sessions', set => {
key_values => [ { name => 'apSigRealmStatsTotalSessionsOutbound', diff => 1 }, { name => 'display' } ],
output_template => 'Total Outbound Sessions : %s',
perfdatas => [
{ label => 'total_outbound_sessions', value => 'apSigRealmStatsTotalSessionsOutbound_absolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'avg-qos-rafctor', set => {
key_values => [ { name => 'apSigRealmStatsAverageQoSRFactor' }, { name => 'display' } ],
output_template => 'Average QoS RFactor : %s',
perfdatas => [
{ label => 'avg_qos_factor', value => 'apSigRealmStatsAverageQoSRFactor_absolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'total-rfactor', set => {
key_values => [ { name => 'apSigRealmStatsTotalMajorRFactorExceeded', diff => 1 }, { name => 'display' } ],
output_template => 'Total Rfactor Exceeded : %s',
perfdatas => [
{ label => 'total_rfactor', value => 'apSigRealmStatsTotalMajorRFactorExceededabsolute', template => '%s',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
];
}
sub prefix_realm_output {
my ($self, %options) = @_;
return "Realm '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
});
return $self;
}
my $oid_apSigRealmStatsRealmName = '.1.3.6.1.4.1.9148.3.2.1.2.4.1.2';
my $mapping = {
apSigRealmStatsCurrentActiveSessionsInbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.3' },
apSigRealmStatsCurrentSessionRateInbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.4' },
apSigRealmStatsCurrentActiveSessionsOutbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.5' },
apSigRealmStatsCurrentSessionRateOutbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.6' },
apSigRealmStatsTotalSessionsInbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.7' },
apSigRealmStatsTotalSessionsOutbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.11' },
apSigRealmStatsAverageQoSRFactor => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.24' },
apSigRealmStatsTotalMajorRFactorExceeded => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.4.1.27' },
};
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_table(oid => $oid_apSigRealmStatsRealmName, nothing_quit => 1);
$self->{realm} = {};
foreach my $oid (keys %{$snmp_result}) {
$oid =~ /\.(\d+)$/;
my $instance = $1;
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$snmp_result->{$oid} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping realm '" . $snmp_result->{$oid} . "'.", debug => 1);
next;
}
$self->{realm}->{$instance} = { display => $snmp_result->{$oid} };
}
$options{snmp}->load(oids => [$mapping->{apSigRealmStatsCurrentActiveSessionsInbound}->{oid}, $mapping->{apSigRealmStatsCurrentSessionRateInbound}->{oid},
$mapping->{apSigRealmStatsCurrentActiveSessionsOutbound}->{oid}, $mapping->{apSigRealmStatsCurrentSessionRateOutbound}->{oid},
$mapping->{apSigRealmStatsTotalSessionsInbound}->{oid}, $mapping->{apSigRealmStatsTotalSessionsOutbound}->{oid},
$mapping->{apSigRealmStatsAverageQoSRFactor}->{oid}, $mapping->{apSigRealmStatsTotalMajorRFactorExceeded}->{oid}
],
instances => [keys %{$self->{realm}}], instance_regexp => '^(.*)$');
$snmp_result = $options{snmp}->get_leef(nothing_quit => 1);
foreach (keys %{$self->{realm}}) {
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $_);
foreach my $name (keys %$mapping) {
$self->{realm}->{$_}->{$name} = $result->{$name};
}
}
if (scalar(keys %{$self->{realm}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No realm found.");
$self->{output}->option_exit();
}
$self->{cache_name} = "acmepacket_" . $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'));
}
1;
__END__
=head1 MODE
Check realm usage.
=over 8
=item B<--warning-*>
Threshold warning.
Can be: 'current-in-sessions', 'current-in-sessions-rate', 'total-in-sessions',
'current-out-sessions', 'current-out-sessions-rate', 'total-out-session',
'avg-qos-rafctor', 'total-rfactor'.
=item B<--critical-*>
Threshold critical.
Can be: 'current-in-sessions', 'current-in-sessions-rate', 'total-in-sessions',
'current-out-sessions', 'current-out-sessions-rate', 'total-out-session',
'avg-qos-rafctor', 'total-rfactor'.
=item B<--filter-name>
Filter by realm name (can be a regexp).
=back
=cut

View File

@ -0,0 +1,258 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::sipusage;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
my $instance_mode;
sub custom_status_threshold {
my ($self, %options) = @_;
my $status = 'ok';
my $message;
eval {
local $SIG{__WARN__} = sub { $message = $_[0]; };
local $SIG{__DIE__} = sub { $message = $_[0]; };
if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' &&
eval "$instance_mode->{option_results}->{critical_status}") {
$status = 'critical';
} elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' &&
eval "$instance_mode->{option_results}->{warning_status}") {
$status = 'warning';
}
};
if (defined($message)) {
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
}
return $status;
}
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'Status : ' . $self->{result_values}->{status};
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_apSipSAStatsSessionAgentStatus'};
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'sip', type => 1, cb_prefix_output => 'prefix_sip_output', message_multiple => 'All SIPs are ok' }
];
$self->{maps_counters}->{sip} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'apSipSAStatsSessionAgentStatus' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => $self->can('custom_status_threshold'),
}
},
{ label => 'in-sessions-rate', set => {
key_values => [ { name => 'apSipSAStatsTotalSessionsInbound', diff => 1 }, { name => 'display' } ],
output_template => 'Inbound Sessions Rate : %.2f/s',
per_second => 1,
perfdatas => [
{ label => 'inbound_sessions_rate', value => 'apSipSAStatsTotalSessionsInbound_per_second', template => '%.2f',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'out-sessions-rate', set => {
key_values => [ { name => 'apSipSAStatsTotalSessionsOutbound', diff => 1 }, { name => 'display' } ],
output_template => 'Outbound Sessions Rate : %.2f/s',
per_second => 1,
perfdatas => [
{ label => 'outbound_sessions_rate', value => 'apSipSAStatsTotalSessionsOutbound_per_second', template => '%.2f',
min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'latency', set => {
key_values => [ { name => 'apSipSAStatsAverageLatency' }, { name => 'display' } ],
output_template => 'Average Latency : %s ms',
perfdatas => [
{ label => 'avg_latency', value => 'apSipSAStatsAverageLatency_absolute', template => '%s',
unit => 'ms', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
{ label => 'asr', set => {
key_values => [ { name => 'apSipSAStatsPeriodASR' }, { name => 'display' } ],
output_template => 'Answer-to-seizure Ratio : %s %%',
perfdatas => [
{ label => 'asr', value => 'apSipSAStatsPeriodASR_absolute', template => '%s',
unit => '%', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
],
}
},
];
}
sub prefix_sip_output {
my ($self, %options) = @_;
return "SIP '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status', default => '' },
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /outOfService|constraintsViolation|inServiceTimedOut/i' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$instance_mode = $self;
$self->change_macros();
}
sub change_macros {
my ($self, %options) = @_;
foreach (('warning_status', 'critical_status')) {
if (defined($self->{option_results}->{$_})) {
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
}
}
}
my %map_status = (
0 => 'disabled', 1 => 'outOfService',
2 => 'standby', 3 => 'inService',
4 => 'constraintsViolation', 5 => 'inServiceTimedOut',
6 => 'oosprovisionedresponse',
);
my $oid_apSipSAStatsSessionAgentHostname = '.1.3.6.1.4.1.9148.3.2.1.2.2.1.2';
my $mapping = {
apSipSAStatsTotalSessionsInbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.2.1.8' },
apSipSAStatsTotalSessionsOutbound => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.2.1.12' },
apSipSAStatsPeriodASR => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.2.1.19' },
apSipSAStatsAverageLatency => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.2.1.20' },
apSipSAStatsSessionAgentStatus => { oid => '.1.3.6.1.4.1.9148.3.2.1.2.2.1.22', map => \%map_status },
};
sub manage_selection {
my ($self, %options) = @_;
my $snmp_result = $options{snmp}->get_table(oid => $oid_apSipSAStatsSessionAgentHostname, nothing_quit => 1);
$self->{sip} = {};
foreach my $oid (keys %{$snmp_result}) {
$oid =~ /\.(\d+)$/;
my $instance = $1;
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$snmp_result->{$oid} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping SIP '" . $snmp_result->{$oid} . "'.", debug => 1);
next;
}
$self->{sip}->{$instance} = { display => $snmp_result->{$oid} };
}
$options{snmp}->load(oids => [$mapping->{apSipSAStatsTotalSessionsInbound}->{oid}, $mapping->{apSipSAStatsTotalSessionsOutbound}->{oid},
$mapping->{apSipSAStatsPeriodASR}->{oid}, $mapping->{apSipSAStatsAverageLatency}->{oid},
$mapping->{apSipSAStatsSessionAgentStatus}->{oid}
],
instances => [keys %{$self->{sip}}], instance_regexp => '^(.*)$');
$snmp_result = $options{snmp}->get_leef(nothing_quit => 1);
foreach (keys %{$self->{sip}}) {
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $_);
foreach my $name (keys %$mapping) {
$self->{sip}->{$_}->{$name} = $result->{$name};
}
}
if (scalar(keys %{$self->{sip}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No SIP found.");
$self->{output}->option_exit();
}
$self->{cache_name} = "acmepacket_" . $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'));
}
1;
__END__
=head1 MODE
Check SIP usage.
=over 8
=item B<--warning-status>
Set warning threshold for status (Default: -).
Can used special variables like: %{status}
=item B<--critical-status>
Set critical threshold for status (Default: '%{status} =~ /outOfService|constraintsViolation|inServiceTimedOut/i').
Can used special variables like: %{status}
=item B<--warning-*>
Threshold warning.
Can be: 'in-sessions-rate', 'out-sessions-rate', 'latency', 'asr'.
=item B<--critical-*>
Threshold critical.
Can be: 'in-sessions-rate', 'out-sessions-rate', 'latency', 'asr'.
=item B<--filter-name>
Filter by SIP name (can be a regexp).
=back
=cut

View File

@ -0,0 +1,158 @@
#
# Copyright 2017 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::acmepacket::snmp::mode::systemusage;
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, message_separator => ' - ' },
];
$self->{maps_counters}->{global} = [
{ label => 'health-score', set => {
key_values => [ { name => 'health_score' } ],
output_template => 'Health Score : %.2f %%',
perfdatas => [
{ label => 'health_score', value => 'health_score_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
{ label => 'cpu-load', set => {
key_values => [ { name => 'cpu_load' } ],
output_template => 'Cpu Load : %.2f %%',
perfdatas => [
{ label => 'cpu_load', value => 'cpu_load_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
{ label => 'memory-usage', set => {
key_values => [ { name => 'memory_used' } ],
output_template => 'Memory Used : %.2f %%',
perfdatas => [
{ label => 'memory_used', value => 'memory_used_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
{ label => 'license-usage', set => {
key_values => [ { name => 'license_used' } ],
output_template => 'License Used : %.2f %%',
perfdatas => [
{ label => 'license_used', value => 'license_used_absolute', template => '%.2f',
min => 0, max => 100, unit => '%' },
],
}
},
{ label => 'current-sessions', set => {
key_values => [ { name => 'current_sessions' } ],
output_template => 'Current Sessions : %s',
perfdatas => [
{ label => 'current_sessions', value => 'current_sessions_absolute', template => '%s',
min => 0 },
],
}
},
{ label => 'current-calls', set => {
key_values => [ { name => 'current_calls' } ],
output_template => 'Current Calls : %s/s',
perfdatas => [
{ label => 'current_calls', value => 'current_calls_absolute', template => '%s',
unit => '/s', min => 0 },
],
}
},
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_apSysCPUUtil = '.1.3.6.1.4.1.9148.3.2.1.1.1.0';
my $oid_apSysMemoryUtil = '.1.3.6.1.4.1.9148.3.2.1.1.2.0';
my $oid_apSysHealthScore = '.1.3.6.1.4.1.9148.3.2.1.1.3.0';
my $oid_apSysGlobalConSess = '.1.3.6.1.4.1.9148.3.2.1.1.5.0';
my $oid_apSysGlobalCPS = '.1.3.6.1.4.1.9148.3.2.1.1.6.0';
my $oid_apSysLicenseCapacity = '.1.3.6.1.4.1.9148.3.2.1.1.10.0';
my $result = $options{snmp}->get_leef(oids => [
$oid_apSysCPUUtil, $oid_apSysMemoryUtil, $oid_apSysHealthScore,
$oid_apSysLicenseCapacity, $oid_apSysGlobalConSess, $oid_apSysGlobalCPS
],
nothing_quit => 1);
$self->{global} = { cpu_load => $result->{$oid_apSysCPUUtil},
memory_used => $result->{$oid_apSysMemoryUtil},
license_used => $result->{$oid_apSysLicenseCapacity},
health_score => $result->{$oid_apSysHealthScore},
current_sessions => $result->{$oid_apSysGlobalConSess},
current_calls => $result->{$oid_apSysGlobalCPS},
};
}
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-*>
Threshold warning.
Can be: 'license-usage' (%), 'memory-usage' (%), 'cpu-load' (%),
'health-score' (%), 'current-sessions', 'current-calls'.
=item B<--critical-*>
Threshold critical.
Can be: 'license-usage' (%), 'memory-usage' (%), 'cpu-load' (%),
'health-score' (%), 'current-sessions', 'current-calls'.
=back
=cut

View File

@ -0,0 +1,55 @@
#
# Copyright 2017 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::acmepacket::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->{version} = '1.0';
%{$self->{modes}} = (
'hardware' => 'network::acmepacket::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'list-realm' => 'network::acmepacket::snmp::mode::listrealm',
'list-sip' => 'network::acmepacket::snmp::mode::listsip',
'realm-usage' => 'network::acmepacket::snmp::mode::realmusage',
'sip-usage' => 'network::acmepacket::snmp::mode::sipusage',
'system-usage' => 'network::acmepacket::snmp::mode::systemusage',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Acme Packet equipments (Oracle SBC) in SNMP.
=cut