From 6e83c1d639b34d08902d257cba00e852067825a7 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 1 Sep 2020 10:20:40 +0200 Subject: [PATCH] fix some counters + enhance indent --- .../polycom/hdx/snmp/mode/viewstationstats.pm | 17 ++--- hardware/devices/polycom/hdx/snmp/plugin.pm | 4 +- .../polycom/rprm/snmp/mode/clusterstatus.pm | 21 ++---- .../devices/polycom/rprm/snmp/mode/license.pm | 11 +--- .../polycom/rprm/snmp/mode/provisioning.pm | 21 ++---- .../polycom/rprm/snmp/mode/sitelinks.pm | 64 +++++++------------ .../devices/polycom/rprm/snmp/mode/sites.pm | 55 +++++++--------- .../devices/polycom/rprm/snmp/mode/updates.pm | 21 ++---- hardware/devices/polycom/rprm/snmp/plugin.pm | 4 +- 9 files changed, 73 insertions(+), 145 deletions(-) diff --git a/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm b/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm index c16835a48..4e03d44e4 100644 --- a/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm +++ b/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm @@ -34,29 +34,26 @@ sub set_counters { $self->{maps_counters}->{global} = [ { label => 'h323-packet-loss', nlabel => 'viewstation.h323.packet.loss.percentage', set => { - key_values => [ { name => 'polycomVSPercentPacketLoss' }, { name => 'display' } ], + key_values => [ { name => 'polycomVSPercentPacketLoss' } ], output_template => 'H323 Packet Loss %.2f %%', perfdatas => [ - { value => 'polycomVSPercentPacketLoss', template => '%.2f', - min => 0, max => 100, unit => '%' } + { template => '%.2f', min => 0, max => 100, unit => '%' } ] } }, { label => 'h323-jitter', nlabel => 'viewstation.h323.jitter.milliseconds', set => { - key_values => [ { name => 'polycomVSJitter' }, { name => 'display' } ], + key_values => [ { name => 'polycomVSJitter' } ], output_template => 'H323 (audio/video) Jitter %.2f ms', perfdatas => [ - { value => 'polycomVSJitter', template => '%.2f', - min => 0, unit => 'ms' } + { template => '%.2f', min => 0, unit => 'ms' } ] } }, { label => 'h323-latency', nlabel => 'viewstation.h323.latency.count', set => { - key_values => [ { name => 'polycomVSLatency' }, { name => 'display' } ], + key_values => [ { name => 'polycomVSLatency' }], output_template => 'H323 (audio/video) Latency %.2f', perfdatas => [ - { value => 'polycomVSLatency', template => '%.2f', - min => 0, unit => '' } + { template => '%.2f', min => 0 } ] } } @@ -128,4 +125,4 @@ Possible values are: h323-packet-loss, h323-jitter, h323-latency =back -=cut \ No newline at end of file +=cut diff --git a/hardware/devices/polycom/hdx/snmp/plugin.pm b/hardware/devices/polycom/hdx/snmp/plugin.pm index 11c44b068..45c463d37 100644 --- a/hardware/devices/polycom/hdx/snmp/plugin.pm +++ b/hardware/devices/polycom/hdx/snmp/plugin.pm @@ -30,14 +30,14 @@ sub new { bless $self, $class; $self->{version} = '1.0'; - %{$self->{modes}} = ( + $self->{modes} = { 'cpu-detailed' => 'snmp_standard::mode::cpudetailed', 'interfaces' => 'snmp_standard::mode::interfaces', 'load' => 'snmp_standard::mode::loadaverage', 'memory' => 'snmp_standard::mode::memory', 'uptime' => 'snmp_standard::mode::uptime', 'viewstation-stats' => 'hardware::devices::polycom::hdx::snmp::mode::viewstationstats' - ); + }; return $self; } diff --git a/hardware/devices/polycom/rprm/snmp/mode/clusterstatus.pm b/hardware/devices/polycom/rprm/snmp/mode/clusterstatus.pm index e934d787c..4da247188 100644 --- a/hardware/devices/polycom/rprm/snmp/mode/clusterstatus.pm +++ b/hardware/devices/polycom/rprm/snmp/mode/clusterstatus.pm @@ -34,14 +34,14 @@ sub set_counters { ]; $self->{maps_counters}->{global} = [ - { label => 'cluster-status', threshold => 0, set => { + { label => 'cluster-status', type => 2, critical_default => '%{cluster_status} =~ /outOfService/i', 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 => { + { label => 'cluster-change-cause', type => 2, set => { key_values => [ { name => 'cluster_change_cause' } ], output_template => 'Last change cause: %s', closure_custom_perfdata => sub { return 0; }, @@ -57,25 +57,12 @@ sub prefix_global_output { 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 => '' } + $options{options}->add_options(arguments => { }); return $self; @@ -87,7 +74,7 @@ sub manage_selection { 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 %cluster_status = ( 1 => 'inService', 2 => 'busyOut', 3 => 'outOfService' ); my $result = $options{snmp}->get_leef( oids => [ diff --git a/hardware/devices/polycom/rprm/snmp/mode/license.pm b/hardware/devices/polycom/rprm/snmp/mode/license.pm index efe1a19f3..85f15584e 100644 --- a/hardware/devices/polycom/rprm/snmp/mode/license.pm +++ b/hardware/devices/polycom/rprm/snmp/mode/license.pm @@ -37,19 +37,19 @@ sub set_counters { { 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' } ] + perfdatas => [ { 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' } ] + perfdatas => [ { 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' } ] + perfdatas => [ { template => '%d', max => 'video_license_capability' } ] } } ]; @@ -67,11 +67,6 @@ sub custom_license_output { ); } -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); diff --git a/hardware/devices/polycom/rprm/snmp/mode/provisioning.pm b/hardware/devices/polycom/rprm/snmp/mode/provisioning.pm index a043d2f8a..2acd16f5d 100644 --- a/hardware/devices/polycom/rprm/snmp/mode/provisioning.pm +++ b/hardware/devices/polycom/rprm/snmp/mode/provisioning.pm @@ -34,7 +34,7 @@ sub set_counters { ]; $self->{maps_counters}->{global} = [ - { label => 'provisioning-status', threshold => 0, set => { + { label => 'provisioning-status', type => 2, critical_default => '%{provisioning_status} =~ /failed/i', set => { key_values => [ { name => 'provisioning_status' } ], closure_custom_output => $self->can('custom_provisioning_status_output'), closure_custom_perfdata => sub { return 0; }, @@ -45,8 +45,7 @@ sub set_counters { key_values => [ { name => 'provisioning_failed' } ], output_template => 'Failed last 60m: %s', perfdatas => [ - { value => 'provisioning_failed', template => '%s', - min => 0, unit => '' } + { template => '%s', min => 0, unit => '' } ] } }, @@ -54,8 +53,7 @@ sub set_counters { key_values => [ { name => 'provisioning_success' } ], output_template => 'Successed last 60m: %s', perfdatas => [ - { value => 'provisioning_success', template => '%s', - min => 0, unit => '' } + { template => '%s', min => 0, unit => '' } ] } } @@ -74,23 +72,12 @@ sub prefix_global_output { 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' }, + $options{options}->add_options(arguments => { }); return $self; diff --git a/hardware/devices/polycom/rprm/snmp/mode/sitelinks.pm b/hardware/devices/polycom/rprm/snmp/mode/sitelinks.pm index 8cd3fd5ee..dd6c5876d 100644 --- a/hardware/devices/polycom/rprm/snmp/mode/sitelinks.pm +++ b/hardware/devices/polycom/rprm/snmp/mode/sitelinks.pm @@ -38,103 +38,85 @@ 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 => '%s', min => 0 } ] + perfdatas => [ { template => '%s', min => 0 } ] } } ]; $self->{maps_counters}->{sitelink} = [ - { label => 'sitelink-status', threshold => 0, set => { - key_values => [ { name => 'sitelink_status' }, { name => 'display'} ], + { label => 'sitelink-status', type => 2, critical_default => '%{sitelink_status} =~ /failed/i', 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', + 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 } + { template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { 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 %%', + 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 } + { unit => '%', template => '%.2f', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'sitelink-bandwidth-total', nlabel => 'rprm.sitelink.bandwidth.total.bytespersecond', set => { - key_values => [ { name => 'sitelink_bandwidth_total' }, { name => 'display'} ], + 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 } + { template => '%.2f', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'sitelink-callbitrate', nlabel => 'rprm.sitelink.callbitrate.average.ratio', set => { - key_values => [ { name => 'sitelink_callbitrate' }, { name => 'display'} ], - output_template => 'Average call bit rate : %.2f', + 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 } + { template => '%.2f', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'sitelink-packetloss-prct', nlabel => 'rprm.sitelink.packetloss.average.percentage', set => { - key_values => [ { name => 'sitelink_packetloss_prct' }, { name => 'display'} ], - output_template => 'Average packetloss : %.2f %%', + 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 } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'sitelink-jitter', nlabel => 'rprm.sitelink.jitter.average.milliseconds', set => { - key_values => [ { name => 'sitelink_jitter' }, { name => 'display'} ], - output_template => 'Average jitter time : %.2f ms', + 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 } + { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'sitelink-delay', nlabel => 'rprm.sitelink.delay.average.milliseconds', set => { key_values => [ { name => 'sitelink_delay' }, { name => 'display'} ], - output_template => 'Average delay time : %.2f ms', + output_template => 'Average delay time: %.2f ms', perfdatas => [ - { value => 'sitelink_delay', label_extra_instance => 1, unit => 'ms', - instance_use => 'display', template => '%.2f', min => 0 } + { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' } ] } } ]; } -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' } + 'filter-sitelink:s' => { name => 'filter_sitelink' } }); return $self; diff --git a/hardware/devices/polycom/rprm/snmp/mode/sites.pm b/hardware/devices/polycom/rprm/snmp/mode/sites.pm index 250e27c8a..8390f88e1 100644 --- a/hardware/devices/polycom/rprm/snmp/mode/sites.pm +++ b/hardware/devices/polycom/rprm/snmp/mode/sites.pm @@ -36,73 +36,66 @@ sub set_counters { $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 } ] + output_template => 'Total sites: %s', + perfdatas => [ { 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', + 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 } + { template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { 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 %%', + 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 } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'site-bandwidth-total', nlabel => 'rprm.site.bandwidth.total.bytespersecond', set => { - key_values => [ { name => 'site_bandwidth_total' }, { name => 'display'} ], + 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 } + { template => '%.2f', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'site-callbitrate', nlabel => 'rprm.site.callbitrate.average.ratio', set => { - key_values => [ { name => 'site_callbitrate' }, { name => 'display'} ], - output_template => 'Average call bit rate : %.2f', + 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 } + { template => '%.2f', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'site-packetloss-prct', nlabel => 'rprm.site.packetloss.average.percentage', set => { - key_values => [ { name => 'site_packetloss_prct' }, { name => 'display'} ], - output_template => 'Average packetloss : %.2f %%', + 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 } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'site-jitter', nlabel => 'rprm.site.jitter.average.milliseconds', set => { - key_values => [ { name => 'site_jitter' }, { name => 'display'} ], - output_template => 'Average jitter time : %.2f ms', + 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 } + { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'site-delay', nlabel => 'rprm.site.delay.average.milliseconds', set => { - key_values => [ { name => 'site_delay' }, { name => 'display'} ], - output_template => 'Average delay time : %.2f ms', + 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 } + { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' } ] } } @@ -115,7 +108,7 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - 'filter-site:s' => { name => 'filter_site' }, + 'filter-site:s' => { name => 'filter_site' } }); return $self; @@ -146,7 +139,7 @@ sub manage_selection { 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' }, + 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'; diff --git a/hardware/devices/polycom/rprm/snmp/mode/updates.pm b/hardware/devices/polycom/rprm/snmp/mode/updates.pm index 85cf6e072..ace40ccaf 100644 --- a/hardware/devices/polycom/rprm/snmp/mode/updates.pm +++ b/hardware/devices/polycom/rprm/snmp/mode/updates.pm @@ -34,7 +34,7 @@ sub set_counters { ]; $self->{maps_counters}->{global} = [ - { label => 'updates-status', threshold => 0, set => { + { label => 'updates-status', type => 2, critical_default => '%{updates_status} =~ /failed/i',set => { key_values => [ { name => 'updates_status' } ], closure_custom_output => $self->can('custom_updates_status_output'), closure_custom_perfdata => sub { return 0; }, @@ -45,8 +45,7 @@ sub set_counters { key_values => [ { name => 'updates_failed' } ], output_template => 'Failed last 60m: %s', perfdatas => [ - { value => 'updates_failed', template => '%s', - min => 0, unit => '' } + { template => '%s', min => 0 } ] } }, @@ -54,8 +53,7 @@ sub set_counters { key_values => [ { name => 'updates_success' } ], output_template => 'Successed last 60m: %s', perfdatas => [ - { value => 'updates_success', template => '%s', - min => 0, unit => '' } + { template => '%s', min => 0 } ] } } @@ -74,23 +72,12 @@ sub prefix_global_output { 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' }, + $options{options}->add_options(arguments => { }); return $self; diff --git a/hardware/devices/polycom/rprm/snmp/plugin.pm b/hardware/devices/polycom/rprm/snmp/plugin.pm index 4ce44682b..bc9e8456d 100644 --- a/hardware/devices/polycom/rprm/snmp/plugin.pm +++ b/hardware/devices/polycom/rprm/snmp/plugin.pm @@ -30,14 +30,14 @@ sub new { bless $self, $class; $self->{version} = '1.0'; - %{$self->{modes}} = ( + $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; }