enh(plugin): misc fixes

This commit is contained in:
thibaults-centreon 2020-08-20 10:40:31 +02:00
parent df0fb0e136
commit 52635c817c
6 changed files with 53 additions and 67 deletions

View File

@ -57,7 +57,6 @@ sub prefix_global_output {
return 'RPRM HA Super Cluster: ';
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
@ -103,33 +102,37 @@ sub manage_selection {
cluster_change_cause => $result->{$oid_serviceHAStatusChgReason}
};
}
1;
__END__
=head1 MODE
Check Polycom RPRM updates jobs
Check Polycom HA SuperCluster status
=over 8
=item B<--warning-updates-status>
=item B<--warning-cluster-status>
Custom Warning threshold of the updates state (Default: none)
Syntax: --warning-updates-status='%{updates_status} =~ /clear/i'
Custom Warning threshold of the cluster state (Default: none)
Syntax: --warning-cluster-status='%{cluster_status} =~ /busyOut/i'
=item B<--critical-cluster-status>
=item B<--critical-updates-status>
Custom Critical threshold of the cluster state
(Default: '%{cluster_status} =~ /outOfService/i' )
Syntax: --critical-cluster-status='%{cluster_status} =~ /failed/i'
Custom Critical threshold of the updates state
(Default: '%{updates_status} =~ /failed/i' )
Syntax: --critical-updates-status='%{updates_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<--warning-* --critical-*>
=item B<--critical-cluster-change-cause>
Warning and Critical thresholds.
Possible values are: updates-failed, updates-successed
Custom Critical threshold of the cluster state change cause (Default: none)
Syntax: --critical-cluster-change-cause='%{cluster_change_cause} =~ /manualFailover/i'
=back

View File

@ -74,7 +74,6 @@ sub prefix_global_output {
return 'RPRM Provisioning jobs stats: ';
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
@ -121,6 +120,7 @@ sub manage_selection {
provisioning_success => $result->{$oid_serviceProvisioningSuccessLast60Mins}
};
}
1;
__END__
@ -136,14 +136,12 @@ Check Polycom RPRM provisioning jobs
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.

View File

@ -26,7 +26,6 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold)
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
@ -39,14 +38,14 @@ sub set_counters {
{ 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 => '%d', min => 0 } ]
perfdatas => [ { value => 'sitelinks_count', template => '%s', min => 0 } ]
}
}
];
$self->{maps_counters}->{sitelink} = [
{ label => 'sitelink-status', threshold => 0, set => {
key_values => [ { name => 'sitelink_status' } ],
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
@ -72,7 +71,6 @@ sub set_counters {
},
{ label => 'sitelink-bandwidth-total', nlabel => 'rprm.sitelink.bandwidth.total.bytespersecond', set => {
key_values => [ { name => 'sitelink_bandwidth_total' }, { name => 'display'} ],
#output_template => 'Total allowed bandwidth : %.2f b/s',
closure_custom_output => $self->can('custom_bandwidth_total_output'),
perfdatas => [
{ value => 'sitelink_bandwidth_total', label_extra_instance => 1, unit => 'B/s',
@ -134,7 +132,7 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-sitelink:s' => { name => 'filter_sitelink' },
'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' }
});
@ -158,36 +156,33 @@ 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
);
return sprintf("Total allowed bandwidth: %.2f %s/s", $bandwidth, $unit);
}
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';
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} };
$self->{sitelink} = {};
my $sitelink_result = $options{snmp}->get_table(
oid => $oid_serviceTopologySiteLinkEntry,
nothing_quit => 1
@ -220,7 +215,6 @@ sub manage_selection {
sitelink_delay => $result->{serviceTopologySiteLinkAverageDelay}
};
}
}
1;
@ -229,7 +223,7 @@ __END__
=head1 MODE
Check Polycom RPRM sitelinks.
Check Polycom RPRM SiteLinks.
=over 8
@ -242,14 +236,12 @@ Filter on one or several SiteLinks (POSIX regexp)
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:
@ -260,7 +252,6 @@ Warning & Critical Thresholds. Possible values:
sitelink-bandwidth-total, sitelink-callbitrate, sitelink-packetloss-prct,
sitelink-jitter, sitelink-delay
=back
=cut

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub set_counters {
my ($self, %options) = @_;
@ -64,7 +63,6 @@ sub set_counters {
},
{ label => 'site-bandwidth-total', nlabel => 'rprm.site.bandwidth.total.bytespersecond', set => {
key_values => [ { name => 'site_bandwidth_total' }, { name => 'display'} ],
#output_template => 'Total allowed bandwidth : %.2f b/s',
closure_custom_output => $self->can('custom_bandwidth_total_output'),
perfdatas => [
{ value => 'site_bandwidth_total', label_extra_instance => 1, unit => 'B/s',
@ -136,29 +134,28 @@ sub custom_bandwidth_total_output {
return sprintf("Total allowed bandwidth: %.2f %s/s", $bandwidth, $unit);
}
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';
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} };
$self->{site} = {};
my $site_result = $options{snmp}->get_table(
oid => $oid_serviceTopologySiteEntry,
nothing_quit => 1
@ -216,7 +213,6 @@ Warning & Critical Thresholds. Possible values:
site-bandwidth-total, site-callbitrate, site-packetloss-prct,
site-jitter, site-delay
=back
=cut

View File

@ -74,7 +74,6 @@ sub prefix_global_output {
return 'RPRM Updates jobs stats: ';
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
@ -121,6 +120,7 @@ sub manage_selection {
updates_success => $result->{$oid_serviceSoftwareUpdateSuccessLast60Mins}
};
}
1;
__END__
@ -136,14 +136,12 @@ Check Polycom RPRM updates jobs
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.

View File

@ -36,7 +36,7 @@ sub new {
'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',
'updates' => 'hardware::devices::polycom::rprm::snmp::mode::updates'
);
return $self;