Merge pull request #2160 from centreon/tibs_poly_rprm

add(plugin): Polycom RPRM SNMP
This commit is contained in:
pkriko 2020-08-21 09:38:40 +02:00 committed by GitHub
commit 43dfbe6848
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1129 additions and 5 deletions

View File

@ -47,7 +47,7 @@ sub set_counters {
output_template => 'H323 (audio/video) Jitter %.2f ms',
perfdatas => [
{ value => 'polycomVSJitter', template => '%.2f',
min => 0, max => 100, unit => 'ms' }
min => 0, unit => 'ms' }
]
}
},
@ -55,8 +55,8 @@ sub set_counters {
key_values => [ { name => 'polycomVSLatency' }, { name => 'display' } ],
output_template => 'H323 (audio/video) Latency %.2f',
perfdatas => [
{ label => 'vs_latency', value => 'polycomVSLatency', template => '%.2f',
min => 0, max => 100, unit => '' }
{ value => 'polycomVSLatency', template => '%.2f',
min => 0, unit => '' }
]
}
}
@ -69,12 +69,19 @@ sub prefix_global_output {
return "View Station Phone Number: '" . $options{instance_value}->{display} . "' Stats: ";
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
return $self;
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {});
$options{options}->add_options();
return $self;
}

View File

@ -0,0 +1,139 @@
#
# Copyright 2020 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 hardware::devices::polycom::rprm::snmp::mode::clusterstatus;
use base qw(centreon::plugins::templates::counter);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' }
];
$self->{maps_counters}->{global} = [
{ label => 'cluster-status', threshold => 0, set => {
key_values => [ { name => 'cluster_status' } ],
output_template => 'Current status %s',
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
},
{ label => 'cluster-change-cause', threshold => 0, set => {
key_values => [ { name => 'cluster_change_cause' } ],
output_template => 'Last change cause: %s',
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
}
];
}
sub prefix_global_output {
my ($self, %options) = @_;
return 'RPRM HA Super Cluster: ';
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_cluster_status', 'critical_cluster_status', 'warning_cluster_change_cause', 'critical_cluster_change_cause' ]);
return $self;
}
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 => {
'warning-cluster-status:s' => { name => 'warning_cluster_status', default => '' },
'critical-cluster-status:s' => { name => 'critical_cluster_status', default => '%{cluster_status} =~ /outOfService/i' },
'warning-cluster-change-cause:s' => { name => 'warning_cluster_change_cause', default => '' },
'critical-cluster-change-cause:s' => { name => 'critical_cluster_change_cause', default => '' }
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_serviceHASuperClstrStatus = '.1.3.6.1.4.1.13885.102.1.2.16.1.0';
my $oid_serviceHAStatusChgReason = '.1.3.6.1.4.1.13885.102.1.2.16.2.0';
my %cluster_status = ( 1 => 'inService', 2 => 'busyOut', 3 => 'outOfService' );
my $result = $options{snmp}->get_leef(
oids => [
$oid_serviceHASuperClstrStatus,
$oid_serviceHAStatusChgReason
],
nothing_quit => 1
);
$self->{global} = {
cluster_status => $cluster_status{$result->{$oid_serviceHASuperClstrStatus}},
cluster_change_cause => $result->{$oid_serviceHAStatusChgReason}
};
}
1;
__END__
=head1 MODE
Check Polycom HA SuperCluster status
=over 8
=item B<--warning-cluster-status>
Custom Warning threshold of the cluster state (Default: none)
Syntax: --warning-cluster-status='%{cluster_status} =~ /busyOut/i'
=item B<--critical-cluster-status>
Custom Critical threshold of the cluster state
(Default: '%{cluster_status} =~ /outOfService/i' )
Syntax: --critical-cluster-status='%{cluster_status} =~ /failed/i'
=item B<--warning-cluster-change-cause>
Custom Warning threshold of the cluster state change cause (Default: none)
Syntax: --warning-cluster-change-cause='%{cluster_change_cause} =~ /manualFailover/i'
=item B<--critical-cluster-change-cause>
Custom Critical threshold of the cluster state change cause (Default: none)
Syntax: --critical-cluster-change-cause='%{cluster_change_cause} =~ /manualFailover/i'
=back
=cut

View File

@ -0,0 +1,146 @@
#
# Copyright 2020 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 hardware::devices::polycom::rprm::snmp::mode::license;
use base qw(centreon::plugins::templates::counter);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 }
];
$self->{maps_counters}->{global} = [
{ label => 'total-license-usage', nlabel => 'rprm.license.total.usage.count', set => {
key_values => [ { name => 'total_license_usage' }, { name => 'total_license_capability' }, { name => 'total_license_usage_prct' }, { name => 'license_mode' } ],
closure_custom_output => $self->can('custom_license_output'),
perfdatas => [ { value => 'total_license_usage', template => '%d', max => 'total_license_capability' } ]
}
},
{ label => 'audio-license-usage', nlabel => 'rprm.license.audio.usage.count', set => {
key_values => [ { name => 'audio_license_usage' }, { name => 'audio_license_capability' }, { name => 'audio_license_usage_prct' } ],
output_template => 'Audio licenses used: %s',
perfdatas => [ { value => 'audio_license_usage', template => '%d', max => 'audio_license_capability' } ]
}
},
{ label => 'video-license-usage', nlabel => 'rprm.license.video.usage.count', set => {
key_values => [ { name => 'video_license_usage' }, { name => 'video_license_capability' }, { name => 'video_license_usage_prct' } ],
output_template => 'Video licenses used: %s',
perfdatas => [ { value => 'video_license_usage', template => '%d', max => 'video_license_capability' } ]
}
}
];
}
sub custom_license_output {
my ($self, %options) = @_;
return sprintf(
'Current license usage (mode: "%s"): Total %s of %s (%.2f%%)',
$self->{result_values}->{license_mode},
$self->{result_values}->{total_license_usage},
$self->{result_values}->{total_license_capability},
$self->{result_values}->{total_license_usage_prct}
);
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options();
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my %license_mode = (0 => 'user', 1 => 'device');
my $oid_serviceLicenseCapability = '.1.3.6.1.4.1.13885.102.1.2.20.1.0';
my $oid_serviceLicenseUsage = '.1.3.6.1.4.1.13885.102.1.2.20.2.0';
my $oid_serviceLicenseMode = '.1.3.6.1.4.1.13885.102.1.2.20.3.0';
my $oid_serviceAudioEPLicenseCapability = '.1.3.6.1.4.1.13885.102.1.2.23.1.0';
my $oid_serviceAudioEPLicenseUsage = '.1.3.6.1.4.1.13885.102.1.2.23.2.0';
my $oid_serviceVideoEPLicenseCapability = '.1.3.6.1.4.1.13885.102.1.2.24.1.0';
my $oid_serviceVideoEPLicenseUsage = '.1.3.6.1.4.1.13885.102.1.2.24.2.0';
my $result = $options{snmp}->get_leef(
oids => [
$oid_serviceLicenseCapability,
$oid_serviceLicenseUsage,
$oid_serviceLicenseMode,
$oid_serviceAudioEPLicenseCapability,
$oid_serviceAudioEPLicenseUsage,
$oid_serviceVideoEPLicenseCapability,
$oid_serviceVideoEPLicenseUsage
],
nothing_quit => 1
);
my $total_license_usage_prct = defined($result->{$oid_serviceLicenseCapability}) && $result->{$oid_serviceLicenseCapability} != '0' ? ($result->{$oid_serviceLicenseUsage} * 100 / $result->{$oid_serviceLicenseCapability}) : 0;
my $audio_license_usage_prct = defined($result->{$oid_serviceAudioEPLicenseCapability}) && $result->{$oid_serviceAudioEPLicenseCapability} != '0' ? ($result->{$oid_serviceAudioEPLicenseUsage} * 100 / $result->{$oid_serviceAudioEPLicenseCapability}) : 0;
my $video_license_usage_prct = defined($result->{$oid_serviceVideoEPLicenseCapability}) && $result->{$oid_serviceVideoEPLicenseCapability} != '0' ? ($result->{$oid_serviceVideoEPLicenseUsage} * 100 / $result->{$oid_serviceVideoEPLicenseCapability}) : 0;
$self->{global} = {
total_license_usage => $result->{$oid_serviceLicenseUsage},
total_license_capability => $result->{$oid_serviceLicenseCapability},
total_license_usage_prct => $total_license_usage_prct,
license_mode => $license_mode{$result->{$oid_serviceLicenseMode}},
audio_license_usage => $result->{$oid_serviceAudioEPLicenseUsage},
audio_license_capability => $result->{$oid_serviceAudioEPLicenseCapability},
audio_license_usage_prct => $audio_license_usage_prct,
video_license_usage => $result->{$oid_serviceVideoEPLicenseUsage},
video_license_capability => $result->{$oid_serviceVideoEPLicenseCapability},
video_license_usage_prct => $video_license_usage_prct
};
}
1;
__END__
=head1 MODE
Check licenses statistics of Polycom RPRM devices.
=over 8
=item B<--warning-* --critical-*>
Warning & Critical Thresholds for the collected metrics. Possible values:
total-license-usage, audio-license-usage, video-license-usage.
=back
=cut

View File

@ -0,0 +1,152 @@
#
# Copyright 2020 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 hardware::devices::polycom::rprm::snmp::mode::provisioning;
use base qw(centreon::plugins::templates::counter);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' }
];
$self->{maps_counters}->{global} = [
{ label => 'provisioning-status', threshold => 0, set => {
key_values => [ { name => 'provisioning_status' } ],
closure_custom_output => $self->can('custom_provisioning_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
},
{ label => 'provisioning-failed', nlabel => 'rprm.provisioning.failed.count', set => {
key_values => [ { name => 'provisioning_failed' } ],
output_template => 'Failed last 60m: %s',
perfdatas => [
{ value => 'provisioning_failed', template => '%s',
min => 0, unit => '' }
]
}
},
{ label => 'provisioning-success', nlabel => 'rprm.provisioning.success.count', set => {
key_values => [ { name => 'provisioning_success' } ],
output_template => 'Successed last 60m: %s',
perfdatas => [
{ value => 'provisioning_success', template => '%s',
min => 0, unit => '' }
]
}
}
];
}
sub custom_provisioning_status_output {
my ($self, %options) = @_;
return sprintf('Current status: "%s"', $self->{result_values}->{provisioning_status});
}
sub prefix_global_output {
my ($self, %options) = @_;
return 'RPRM Provisioning jobs stats: ';
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_provisioning_status', 'critical_provisioning_status' ]);
return $self;
}
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 => {
'warning-provisioning-status:s' => { name => 'warning_provisioning_status', default => '' },
'critical-provisioning-status:s' => { name => 'critical_provisioning_status', default => '%{provisioning_status} =~ /failed/i' },
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_serviceProvisioningStatus = '.1.3.6.1.4.1.13885.102.1.2.2.1.0';
my $oid_serviceProvisioningFailuresLast60Mins = '.1.3.6.1.4.1.13885.102.1.2.2.2.0';
my $oid_serviceProvisioningSuccessLast60Mins = '.1.3.6.1.4.1.13885.102.1.2.2.3.0';
my %provisioning_status = ( 0 => 'clear', 2 => 'in-progress', 3 => 'success', 4 => 'failed' );
my $result = $options{snmp}->get_leef(
oids => [
$oid_serviceProvisioningStatus,
$oid_serviceProvisioningFailuresLast60Mins,
$oid_serviceProvisioningSuccessLast60Mins
],
nothing_quit => 1
);
$self->{global} = {
provisioning_status => $provisioning_status{$result->{$oid_serviceProvisioningStatus}},
provisioning_failed => $result->{$oid_serviceProvisioningFailuresLast60Mins},
provisioning_success => $result->{$oid_serviceProvisioningSuccessLast60Mins}
};
}
1;
__END__
=head1 MODE
Check Polycom RPRM provisioning jobs
=over 8
=item B<--warning-provisioning-status>
Custom Warning threshold of the provisioning state (Default: none)
Syntax: --warning-provisioning-status='%{provisioning_status} =~ /clear/i'
=item B<--critical-provisioning-status>
Custom Critical threshold of the provisioning state
(Default: '%{provisioning_status} =~ /failed/i' )
Syntax: --critical-provisioning-status='%{provisioning_status} =~ /failed/i'
=item B<--warning-* --critical-*>
Warning and Critical thresholds.
Possible values are: provisioning-failed, provisioning-success
=back
=cut

View File

@ -0,0 +1,257 @@
#
# Copyright 2020 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 hardware::devices::polycom::rprm::snmp::mode::sitelinks;
use base qw(centreon::plugins::templates::counter);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'sitelink', type => 1, cb_prefix_output => 'prefix_sitelink_output', message_multiple => 'All SiteLinks are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'rprm-total-sitelinks', nlabel => 'rprm.sitelinks.total.count', set => {
key_values => [ { name => 'sitelinks_count' } ],
output_template => 'Total sitelinks : %s',
perfdatas => [ { value => 'sitelinks_count', template => '%s', min => 0 } ]
}
}
];
$self->{maps_counters}->{sitelink} = [
{ label => 'sitelink-status', threshold => 0, set => {
key_values => [ { name => 'sitelink_status' }, { name => 'display'} ],
closure_custom_output => $self->can('custom_sitelink_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
},
{ label => 'sitelink-active-calls', nlabel => 'rprm.sitelink.calls.active.count', set => {
key_values => [ { name => 'sitelink_active_calls' }, { name => 'display'} ],
output_template => 'current active calls : %s',
perfdatas => [
{ value => 'sitelink_active_calls', label_extra_instance => 1,
instance_use => 'display', template => '%s', min => 0 }
]
}
},
{ label => 'sitelink-bandwidth-used-prct', nlabel => 'rprm.sitelink.bandwidth.used.percentage', set => {
key_values => [ { name => 'sitelink_bandwidth_used_prct' }, { name => 'display'} ],
output_template => 'current bandwidth usage : %.2f %%',
perfdatas => [
{ value => 'sitelink_bandwidth_used_prct', label_extra_instance => 1, unit => '%',
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
]
}
},
{ label => 'sitelink-bandwidth-total', nlabel => 'rprm.sitelink.bandwidth.total.bytespersecond', set => {
key_values => [ { name => 'sitelink_bandwidth_total' }, { name => 'display'} ],
closure_custom_output => $self->can('custom_bandwidth_total_output'),
perfdatas => [
{ value => 'sitelink_bandwidth_total', label_extra_instance => 1, unit => 'B/s',
instance_use => 'display', template => '%.2f', min => 0 }
]
}
},
{ label => 'sitelink-callbitrate', nlabel => 'rprm.sitelink.callbitrate.average.ratio', set => {
key_values => [ { name => 'sitelink_callbitrate' }, { name => 'display'} ],
output_template => 'Average call bit rate : %.2f',
perfdatas => [
{ value => 'sitelink_callbitrate', label_extra_instance => 1,
instance_use => 'display', template => '%.2f', min => 0 }
]
}
},
{ label => 'sitelink-packetloss-prct', nlabel => 'rprm.sitelink.packetloss.average.percentage', set => {
key_values => [ { name => 'sitelink_packetloss_prct' }, { name => 'display'} ],
output_template => 'Average packetloss : %.2f %%',
perfdatas => [
{ value => 'sitelink_packetloss_prct', label_extra_instance => 1, unit => '%',
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
]
}
},
{ label => 'sitelink-jitter', nlabel => 'rprm.sitelink.jitter.average.milliseconds', set => {
key_values => [ { name => 'sitelink_jitter' }, { name => 'display'} ],
output_template => 'Average jitter time : %.2f ms',
perfdatas => [
{ value => 'sitelink_jitter', label_extra_instance => 1, unit => 'ms',
instance_use => 'display', template => '%.2f', min => 0 }
]
}
},
{ label => 'sitelink-delay', nlabel => 'rprm.sitelink.delay.average.milliseconds', set => {
key_values => [ { name => 'sitelink_delay' }, { name => 'display'} ],
output_template => 'Average delay time : %.2f ms',
perfdatas => [
{ value => 'sitelink_delay', label_extra_instance => 1, unit => 'ms',
instance_use => 'display', template => '%.2f', min => 0 }
]
}
}
];
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_sitelink_status', 'critical_sitelink_status' ]);
return $self;
}
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-sitelink:s' => { name => 'filter_sitelink' },
'warning-sitelink-status:s' => { name => 'warning_sitelink_status', default => '' },
'critical-sitelink-status:s' => { name => 'critical_sitelink_status', default => '%{sitelink_status} =~ /failed/i' }
});
return $self;
}
sub custom_sitelink_status_output {
my ($self, %options) = @_;
return sprintf('Current status: "%s"', $self->{result_values}->{sitelink_status});
}
sub prefix_sitelink_output {
my ($self, %options) = @_;
return "SiteLink '" . $options{instance_value}->{display} . "' ";
}
sub custom_bandwidth_total_output {
my ($self, %options) = @_;
my ($bandwidth, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{sitelink_bandwidth_total}, network => 1);
return sprintf("Total allowed bandwidth: %.2f %s/s", $bandwidth, $unit);
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
serviceTopologySiteLinkName => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.3' },
serviceTopologySiteLinkStatus => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.4' },
serviceTopologySiteLinkCallCount => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.7' },
serviceTopologySiteLinkBandwidthUsed => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.8' },
serviceTopologySiteLinkBandwidthTotal => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.9' },
serviceTopologySiteLinkAverageCallBitRate => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.10' },
serviceTopologySiteLinkPacketLoss => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.11' },
serviceTopologySiteLinkAverageJitter => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.12' },
serviceTopologySiteLinkAverageDelay => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.6.1.13' },
};
my %sitelink_status = ( 1 => 'disabled', 2 => 'ok', 3 => 'failed' );
my $oid_serviceTopologySiteLinkEntry = '.1.3.6.1.4.1.13885.102.1.2.14.6.1';
my $oid_serviceTopologySiteLinkCount = '.1.3.6.1.4.1.13885.102.1.2.14.5.0';
my $global_result = $options{snmp}->get_leef(oids => [$oid_serviceTopologySiteLinkCount], nothing_quit => 1);
$self->{global} = { sitelinks_count => $global_result->{$oid_serviceTopologySiteLinkCount} };
my $sitelink_result = $options{snmp}->get_table(
oid => $oid_serviceTopologySiteLinkEntry,
nothing_quit => 1
);
foreach my $oid (keys %{$sitelink_result}) {
next if ($oid !~ /^$mapping->{serviceTopologySiteLinkName}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $sitelink_result, instance => $instance);
$result->{serviceTopologySiteLinkName} = centreon::plugins::misc::trim($result->{serviceTopologySiteLinkName});
if (defined($self->{option_results}->{filter_sitelink}) && $self->{option_results}->{filter_sitelink} ne '' &&
$result->{serviceTopologySiteLinkName} !~ /$self->{option_results}->{filter_sitelink}/) {
$self->{output}->output_add(long_msg => "skipping '" . $result->{serviceTopologySiteLinkName} . "': no matching filter.", debug => 1);
next;
}
my $sitelink_bandwidth_total = $result->{serviceTopologySiteLinkBandwidthTotal} * 1000000 ; #Mbps
$result->{serviceTopologySiteLinkName} =~ s/\ /\_/g; #instance perfdata compat
$self->{sitelink}->{$instance} = {
display => $result->{serviceTopologySiteLinkName},
sitelink_status => $sitelink_status{$result->{serviceTopologySiteLinkStatus}},
sitelink_active_calls => $result->{serviceTopologySiteLinkCallCount},
sitelink_bandwidth_used_prct => $result->{serviceTopologySiteLinkBandwidthUsed},
sitelink_bandwidth_total => $sitelink_bandwidth_total,
sitelink_callbitrate => $result->{serviceTopologySiteLinkAverageCallBitRate},
sitelink_packetloss_prct => $result->{serviceTopologySiteLinkPacketLoss},
sitelink_jitter => $result->{serviceTopologySiteLinkAverageJitter},
sitelink_delay => $result->{serviceTopologySiteLinkAverageDelay}
};
}
}
1;
__END__
=head1 MODE
Check Polycom RPRM SiteLinks.
=over 8
=item B<--filter-sitelink>
Filter on one or several SiteLinks (POSIX regexp)
=item B<--warning-sitelink-status>
Custom Warning threshold of the SiteLink state (Default: none)
Syntax: --warning-sitelink-status='%{sitelink_status} =~ /disabled/i'
=item B<--critical-sitelink-status>
Custom Critical threshold of the SiteLink state
(Default: '%{sitelink_status} =~ /failed/i' )
Syntax: --critical-sitelink-status='%{sitelink_status} =~ /failed/i'
=item B<--warning-* --critical-*>
Warning & Critical Thresholds. Possible values:
[GLOBAL] rprm-total-sitelinks
[SITE] sitelink-active-calls, sitelink-bandwidth-used-prct,
sitelink-bandwidth-total, sitelink-callbitrate, sitelink-packetloss-prct,
sitelink-jitter, sitelink-delay
=back
=cut

View File

@ -0,0 +1,218 @@
#
# Copyright 2020 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 hardware::devices::polycom::rprm::snmp::mode::sites;
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 },
{ name => 'site', type => 1, cb_prefix_output => 'prefix_site_output', message_multiple => 'All sites are ok', skipped_code => { -10 => 1 } }
];
$self->{maps_counters}->{global} = [
{ label => 'rprm-total-sites', nlabel => 'rprm.sites.total.count', set => {
key_values => [ { name => 'sites_count' } ],
output_template => 'Total sites : %s',
perfdatas => [ { value => 'sites_count', template => '%d', min => 0 } ]
}
}
];
$self->{maps_counters}->{site} = [
{ label => 'site-active-calls', nlabel => 'rprm.site.calls.active.count', set => {
key_values => [ { name => 'site_active_calls' }, { name => 'display'} ],
output_template => 'current active calls : %s',
perfdatas => [
{ value => 'site_active_calls', label_extra_instance => 1,
instance_use => 'display', template => '%s', min => 0 }
]
}
},
{ label => 'site-bandwidth-used-prct', nlabel => 'rprm.site.bandwidth.used.percentage', set => {
key_values => [ { name => 'site_bandwidth_used_prct' }, { name => 'display'} ],
output_template => 'current bandwidth usage : %.2f %%',
perfdatas => [
{ value => 'site_bandwidth_used_prct', label_extra_instance => 1, unit => '%',
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
]
}
},
{ label => 'site-bandwidth-total', nlabel => 'rprm.site.bandwidth.total.bytespersecond', set => {
key_values => [ { name => 'site_bandwidth_total' }, { name => 'display'} ],
closure_custom_output => $self->can('custom_bandwidth_total_output'),
perfdatas => [
{ value => 'site_bandwidth_total', label_extra_instance => 1, unit => 'B/s',
instance_use => 'display', template => '%.2f', min => 0 }
]
}
},
{ label => 'site-callbitrate', nlabel => 'rprm.site.callbitrate.average.ratio', set => {
key_values => [ { name => 'site_callbitrate' }, { name => 'display'} ],
output_template => 'Average call bit rate : %.2f',
perfdatas => [
{ value => 'site_callbitrate', label_extra_instance => 1,
instance_use => 'display', template => '%.2f', min => 0 }
]
}
},
{ label => 'site-packetloss-prct', nlabel => 'rprm.site.packetloss.average.percentage', set => {
key_values => [ { name => 'site_packetloss_prct' }, { name => 'display'} ],
output_template => 'Average packetloss : %.2f %%',
perfdatas => [
{ value => 'site_packetloss_prct', label_extra_instance => 1, unit => '%',
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
]
}
},
{ label => 'site-jitter', nlabel => 'rprm.site.jitter.average.milliseconds', set => {
key_values => [ { name => 'site_jitter' }, { name => 'display'} ],
output_template => 'Average jitter time : %.2f ms',
perfdatas => [
{ value => 'site_jitter', label_extra_instance => 1, unit => 'ms',
instance_use => 'display', template => '%.2f', min => 0 }
]
}
},
{ label => 'site-delay', nlabel => 'rprm.site.delay.average.milliseconds', set => {
key_values => [ { name => 'site_delay' }, { name => 'display'} ],
output_template => 'Average delay time : %.2f ms',
perfdatas => [
{ value => 'site_delay', label_extra_instance => 1, unit => 'ms',
instance_use => 'display', template => '%.2f', min => 0 }
]
}
}
];
}
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-site:s' => { name => 'filter_site' },
});
return $self;
}
sub prefix_site_output {
my ($self, %options) = @_;
return "Site '" . $options{instance_value}->{display} . "' ";
}
sub custom_bandwidth_total_output {
my ($self, %options) = @_;
my ($bandwidth, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{site_bandwidth_total}, network => 1);
return sprintf("Total allowed bandwidth: %.2f %s/s", $bandwidth, $unit);
}
sub manage_selection {
my ($self, %options) = @_;
my $mapping = {
serviceTopologySiteName => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.2' },
serviceTopologySiteTerritoryId => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.3' },
serviceTopologySiteCallCount => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.4' },
serviceTopologySiteBandwidthUsed => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.5' },
serviceTopologySiteBandwidthTotal => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.6' },
serviceTopologySiteAverageCallBitRate => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.7' },
serviceTopologySitePacketLoss => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.8' },
serviceTopologySiteAverageJitter => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.9' },
serviceTopologySiteAverageDelay => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.10' },
};
my $oid_serviceTopologySiteEntry = '.1.3.6.1.4.1.13885.102.1.2.14.4.1';
my $oid_serviceTopologySiteCount = '.1.3.6.1.4.1.13885.102.1.2.14.3.0';
my $global_result = $options{snmp}->get_leef(oids => [$oid_serviceTopologySiteCount], nothing_quit => 1);
$self->{global} = { sites_count => $global_result->{$oid_serviceTopologySiteCount} };
my $site_result = $options{snmp}->get_table(
oid => $oid_serviceTopologySiteEntry,
nothing_quit => 1
);
foreach my $oid (keys %{$site_result}) {
next if ($oid !~ /^$mapping->{serviceTopologySiteName}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $site_result, instance => $instance);
$result->{serviceTopologySiteName} = centreon::plugins::misc::trim($result->{serviceTopologySiteName});
if (defined($self->{option_results}->{filter_site}) && $self->{option_results}->{filter_site} ne '' &&
$result->{serviceTopologySiteName} !~ /$self->{option_results}->{filter_site}/) {
$self->{output}->output_add(long_msg => "skipping '" . $result->{serviceTopologySiteName} . "': no matching filter.", debug => 1);
next;
}
my $site_bandwidth_total = $result->{serviceTopologySiteBandwidthTotal} * 1000000 ; #Mbps
$result->{serviceTopologySiteName} =~ s/\ /\_/g; #instance perfdata compat
$self->{site}->{$instance} = {
display => $result->{serviceTopologySiteName},
site_active_calls => $result->{serviceTopologySiteCallCount},
site_bandwidth_used_prct => $result->{serviceTopologySiteBandwidthUsed},
site_bandwidth_total => $site_bandwidth_total,
site_callbitrate => $result->{serviceTopologySiteAverageCallBitRate},
site_packetloss_prct => $result->{serviceTopologySitePacketLoss},
site_jitter => $result->{serviceTopologySiteAverageJitter},
site_delay => $result->{serviceTopologySiteAverageDelay}
};
}
}
1;
__END__
=head1 MODE
Check Polycom RPRM sites.
=over 8
=item B<--filter-site>
Filter on one or several site (POSIX regexp)
=item B<--warning-* --critical-*>
Warning & Critical Thresholds. Possible values:
[GLOBAL] rprm-total-sites
[SITE] site-active-calls, site-bandwidth-used-prct,
site-bandwidth-total, site-callbitrate, site-packetloss-prct,
site-jitter, site-delay
=back
=cut

View File

@ -0,0 +1,152 @@
#
# Copyright 2020 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 hardware::devices::polycom::rprm::snmp::mode::updates;
use base qw(centreon::plugins::templates::counter);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' }
];
$self->{maps_counters}->{global} = [
{ label => 'updates-status', threshold => 0, set => {
key_values => [ { name => 'updates_status' } ],
closure_custom_output => $self->can('custom_updates_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
}
},
{ label => 'updates-failed', nlabel => 'rprm.updates.failed.count', set => {
key_values => [ { name => 'updates_failed' } ],
output_template => 'Failed last 60m: %s',
perfdatas => [
{ value => 'updates_failed', template => '%s',
min => 0, unit => '' }
]
}
},
{ label => 'updates-successed', nlabel => 'rprm.updates.successed.count', set => {
key_values => [ { name => 'updates_success' } ],
output_template => 'Successed last 60m: %s',
perfdatas => [
{ value => 'updates_success', template => '%s',
min => 0, unit => '' }
]
}
}
];
}
sub custom_updates_status_output {
my ($self, %options) = @_;
return sprintf('Current status: "%s"', $self->{result_values}->{updates_status});
}
sub prefix_global_output {
my ($self, %options) = @_;
return 'RPRM Updates jobs stats: ';
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_updates_status', 'critical_updates_status' ]);
return $self;
}
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 => {
'warning-updates-status:s' => { name => 'warning_updates_status', default => '' },
'critical-updates-status:s' => { name => 'critical_updates_status', default => '%{updates_status} =~ /failed/i' },
});
return $self;
}
sub manage_selection {
my ($self, %options) = @_;
my $oid_serviceSoftwareUpdateStatus = '.1.3.6.1.4.1.13885.102.1.2.3.1.0';
my $oid_serviceSoftwareUpdateFailuresLast60Mins = '.1.3.6.1.4.1.13885.102.1.2.3.2.0';
my $oid_serviceSoftwareUpdateSuccessLast60Mins = '.1.3.6.1.4.1.13885.102.1.2.3.3.0';
my %updates_status = ( 1 => 'disabled', 2 => 'ok', 3 => 'failed' );
my $result = $options{snmp}->get_leef(
oids => [
$oid_serviceSoftwareUpdateStatus,
$oid_serviceSoftwareUpdateFailuresLast60Mins,
$oid_serviceSoftwareUpdateSuccessLast60Mins
],
nothing_quit => 1
);
$self->{global} = {
updates_status => $updates_status{$result->{$oid_serviceSoftwareUpdateStatus}},
updates_failed => $result->{$oid_serviceSoftwareUpdateFailuresLast60Mins},
updates_success => $result->{$oid_serviceSoftwareUpdateSuccessLast60Mins}
};
}
1;
__END__
=head1 MODE
Check Polycom RPRM updates jobs
=over 8
=item B<--warning-updates-status>
Custom Warning threshold of the updates state (Default: none)
Syntax: --warning-updates-status='%{updates_status} =~ /clear/i'
=item B<--critical-updates-status>
Custom Critical threshold of the updates state
(Default: '%{updates_status} =~ /failed/i' )
Syntax: --critical-updates-status='%{updates_status} =~ /failed/i'
=item B<--warning-* --critical-*>
Warning and Critical thresholds.
Possible values are: updates-failed, updates-successed
=back
=cut

View File

@ -0,0 +1,53 @@
#
# Copyright 2020 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 hardware::devices::polycom::rprm::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}} = (
'cluster-status' => 'hardware::devices::polycom::rprm::snmp::mode::clusterstatus',
'license' => 'hardware::devices::polycom::rprm::snmp::mode::license',
'provisioning' => 'hardware::devices::polycom::rprm::snmp::mode::provisioning',
'sitelinks' => 'hardware::devices::polycom::rprm::snmp::mode::sitelinks',
'sites' => 'hardware::devices::polycom::rprm::snmp::mode::sites',
'updates' => 'hardware::devices::polycom::rprm::snmp::mode::updates'
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Polycom RealPresence Resource Manager (RPRM) Devices in SNMP.
=cut