diff --git a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/alerts.pm b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/alerts.pm index 24b33df9e..b1df50d63 100644 --- a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/alerts.pm +++ b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/alerts.pm @@ -31,9 +31,10 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold) sub custom_status_output { my ($self, %options) = @_; - my $msg = sprintf("alarm [code: %s] [severity: %s] [description: %s] %s", $self->{result_values}->{code}, - $self->{result_values}->{severity}, $self->{result_values}->{description}, $self->{result_values}->{timestamp}); - return $msg; + return sprintf( + "alarm [code: %s] [severity: %s] [description: %s] %s", $self->{result_values}->{code}, + $self->{result_values}->{severity}, $self->{result_values}->{description}, $self->{result_values}->{timestamp} + ); } sub custom_status_calc { @@ -47,7 +48,6 @@ sub custom_status_calc { return 0; } - sub set_counters { my ($self, %options) = @_; @@ -76,10 +76,10 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - "filter-msg:s" => { name => 'filter_msg' }, - "warning-status:s" => { name => 'warning_status', default => '%{severity} =~ /warn/i' }, - "critical-status:s" => { name => 'critical_status', default => '%{severity} =~ /severe/i' }, - "memory" => { name => 'memory' } + 'filter-msg:s' => { name => 'filter_msg' }, + 'warning-status:s' => { name => 'warning_status', default => '%{severity} =~ /warn/i' }, + 'critical-status:s' => { name => 'critical_status', default => '%{severity} =~ /severe/i' }, + 'memory' => { name => 'memory' } }); centreon::plugins::misc::mymodule_load( @@ -126,7 +126,7 @@ sub manage_selection { my $last_time; if (defined($self->{option_results}->{memory})) { - $self->{statefile_cache}->read(statefile => "cache_polycom_dma_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port(). '_' . $self->{mode}); + $self->{statefile_cache}->read(statefile => 'cache_polycom_dma_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port(). '_' . $self->{mode}); $last_time = $self->{statefile_cache}->get(name => 'last_time'); } diff --git a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/clusters.pm b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/clusters.pm index 223fbf6d3..2e30582ec 100644 --- a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/clusters.pm +++ b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/clusters.pm @@ -38,20 +38,30 @@ sub set_counters { { label => 'dma-total-clusters', nlabel => 'dma.clusters.total.count', set => { key_values => [ { name => 'clusters_count' } ], output_template => 'Total clusters : %s', - perfdatas => [ { value => 'clusters_count', template => '%d', min => 0 } ] + perfdatas => [ { template => '%d', min => 0 } ] } }, ]; $self->{maps_counters}->{cluster} = [ - { label => 'cluster-status', threshold => 0, display_ok => 0, set => { + { + label => 'cluster-status', + type => 2, + critical_default => '%{cluster_status} =~ /outOfService/i', + display_ok => 0, + set => { key_values => [ { name => 'cluster_status' }, { name => 'display' } ], closure_custom_output => $self->can('custom_cluster_status_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold } }, - { label => 'license-status', threshold => 0, display_ok => 0, set => { + { + label => 'license-status', + type => 2, + critical_default => '%{license_status} =~ /invalid/i', + display_ok => 0, + set => { key_values => [ { name => 'license_status' }, { name => 'display' } ], closure_custom_output => $self->can('custom_license_status_output'), closure_custom_perfdata => sub { return 0; }, @@ -59,29 +69,26 @@ sub set_counters { } }, { label => 'cluster-active-calls', nlabel => 'dma.cluster.activecalls.count', set => { - key_values => [ { name => 'active_calls' }, { name => 'licenses_total'}, { name => 'display'} ], + key_values => [ { name => 'active_calls' }, { name => 'licenses_total' }, { name => 'display' } ], output_template => 'Active calls : %s', perfdatas => [ - { value => 'active_calls', label_extra_instance => 1, - instance_use => 'display', template => '%s', max => 'licenses_total' } + { template => '%s', max => 'licenses_total', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-license-usage-free', nlabel => 'dma.cluster.licenses.free.count', set => { - key_values => [ { name => 'licenses_free' }, { name => 'display'} ], + key_values => [ { name => 'licenses_free' }, { name => 'display' } ], output_template => 'Free licenses : %s', perfdatas => [ - { value => 'licenses_free', label_extra_instance => 1, - instance_use => 'display', template => '%s', min => 0 } + { template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-license-usage-prct', nlabel => 'dma.cluster.licenses.usage.percentage', set => { - key_values => [ { name => 'licenses_used_prct' }, { name => 'display'} ], + key_values => [ { name => 'licenses_used_prct' }, { name => 'display' } ], output_template => 'Licenses percentage usage : %.2f%%', perfdatas => [ - { value => 'licenses_used_prct', label_extra_instance => 1, unit => '%', - instance_use => 'display', template => '%.2f', min => 0 } + { template => '%.2f', min => 0, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } } @@ -106,32 +113,21 @@ sub custom_license_status_output { return sprintf('License status: %s', $self->{result_values}->{license_status}); } -sub check_options { - my ($self, %options) = @_; - $self->SUPER::check_options(%options); - - $self->change_macros(macros => ['warning_cluster_status', 'critical_cluster_status','warning_license_status', 'critical_license_status']); -} - 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-cluster:s' => { name => 'filter_cluster' }, - 'warning-cluster-status:s' => { name => 'warning_cluster_status', default => '' }, - 'critical-cluster-status:s' => { name => 'critical_cluster_status', default => '%{cluster_status} =~ /outOfService/i' }, - 'warning-license-status:s' => { name => 'warning_license_status', default => '' }, - 'critical-license-status:s' => { name => 'critical_license_status', default => '%{license_status} =~ /invalid/i' }, + 'filter-cluster:s' => { name => 'filter_cluster' } }); + return $self; } my %map_cluster_status = (1 => 'inService', 2 => 'busyOut', 3 => 'outOfService'); my %map_licensing_status = (1 => 'valid', 2 => 'invalid', 3 => 'notInstalled'); - my $mapping_status = { stClClusterName => { oid => '.1.3.6.1.4.1.13885.13.2.2.3.2.1.2' }, stClClusterStatus => { oid => '.1.3.6.1.4.1.13885.13.2.2.3.2.1.3', map => \%map_cluster_status } @@ -144,20 +140,18 @@ my $mapping_licenses = { stLicCallserverActiveCalls => { oid => '.1.3.6.1.4.1.13885.13.2.2.3.3.1.5' } }; - my $oid_stClustersEntry = '.1.3.6.1.4.1.13885.13.2.2.3.2.1'; my $oid_stLicensesEntry = '.1.3.6.1.4.1.13885.13.2.2.3.3.1'; my $oid_stClustersCount = '.1.3.6.1.4.1.13885.13.2.2.3.1.0'; #global - sub manage_selection { my ($self, %options) = @_; my $global_result = $options{snmp}->get_leef( oids => [ $oid_stClustersCount ], nothing_quit => 1 - ); + ); $self->{global} = { clusters_count => $global_result->{$oid_stClustersCount} }; @@ -196,7 +190,6 @@ sub manage_selection { licenses_used_prct => ( $licenses_used * 100 ) / $licenses_total }; } - } 1; diff --git a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/conferencemanager.pm b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/conferencemanager.pm index b7f5202e8..fcb2573d4 100644 --- a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/conferencemanager.pm +++ b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/conferencemanager.pm @@ -28,27 +28,27 @@ use warnings; sub custom_video_port_output { my ($self, %options) = @_; - my $msg = sprintf("video ports [total: %s used: %s (%.2f%%) free: %s (%.2f%%)]", + return sprintf( + 'video ports [total: %s used: %s (%.2f%%) free: %s (%.2f%%)]', $self->{result_values}->{vp_total}, $self->{result_values}->{vp_used}, $self->{result_values}->{vp_prct_used}, $self->{result_values}->{vp_free}, $self->{result_values}->{vp_prct_free} ); - return $msg; } sub custom_voice_port_output { my ($self, %options) = @_; - my $msg = sprintf("voice ports [total: %s used: %s (%.2f%%) free: %s (%.2f%%)]", + return sprintf( + 'voice ports [total: %s used: %s (%.2f%%) free: %s (%.2f%%)]', $self->{result_values}->{vop_total}, $self->{result_values}->{vop_used}, $self->{result_values}->{vop_prct_used}, $self->{result_values}->{vop_free}, $self->{result_values}->{vop_prct_free} ); - return $msg; } sub set_counters { @@ -64,8 +64,7 @@ sub set_counters { key_values => [ { name => 'useConfMgrUsageCount' } ], output_template => 'Total conferences : %s', perfdatas => [ - { label => 'conferences', value => 'useConfMgrUsageCount', template => '%d', min => 0, - instance_use => 'display', template => '%d', min => 0 } + { template => '%d', min => 0, instance_use => 'display', template => '%d', min => 0 } ] } } @@ -73,96 +72,94 @@ sub set_counters { $self->{maps_counters}->{cluster} = [ { label => 'cluster-conferences', nlabel => 'dma.cluster.conferences.active.count', set => { - key_values => [ { name => 'useCMUsageActiveConfs' }, { name => 'display'} ], + key_values => [ { name => 'useCMUsageActiveConfs' }, { name => 'display' } ], output_template => 'current conferences : %s', perfdatas => [ - { label => 'conferences_active', value => 'useCMUsageActiveConfs', label_extra_instance => 1, - instance_use => 'display', template => '%d', min => 0 } + { template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-participants', nlabel => 'dma.cluster.participants.active.count', set => { - key_values => [ { name => 'useCMUsageActiveParts' }, { name => 'display'} ], + key_values => [ { name => 'useCMUsageActiveParts' }, { name => 'display' } ], output_template => 'current participants : %s', perfdatas => [ - { label => 'participants', value => 'useCMUsageActiveParts',label_extra_instance => 1, - instance_use => 'display', template => '%d', min => 0 } + { template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-local-users', nlabel => 'dma.cluster.local.database.users.count', set => { - key_values => [ { name => 'useCMUsageLocalUsers' }, { name => 'display'} ], + key_values => [ { name => 'useCMUsageLocalUsers' }, { name => 'display' } ], output_template => 'local users : %s', perfdatas => [ - { label => 'local_users', value => 'useCMUsageLocalUsers', label_extra_instance => 1, - instance_use => 'display', template => '%d', min => 0 } + { template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-custom-rooms', nlabel => 'dma.cluster.custom.conference.rooms.count', set => { - key_values => [ { name => 'useCMUsageCustomConfRooms' }, { name => 'display'} ], + key_values => [ { name => 'useCMUsageCustomConfRooms' }, { name => 'display' } ], output_template => 'custom conference rooms : %s', perfdatas => [ - { label => 'custom_rooms', value => 'useCMUsageCustomConfRooms', label_extra_instance => 1, - instance_use => 'display', template => '%d', min => 0 } + { template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-video-ports-usage', nlabel => 'dma.cluster.video.port.usage.count', set => { - key_values => [ { name => 'vp_used' }, { name => 'vp_free' }, { name => 'vp_prct_used' }, - { name => 'vp_prct_free' }, { name => 'vp_total' }, { name => 'display'} ], + key_values => [ + { name => 'vp_used' }, { name => 'vp_free' }, { name => 'vp_prct_used' }, + { name => 'vp_prct_free' }, { name => 'vp_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_video_port_output'), perfdatas => [ - { value => 'vp_used', template => '%d', instance_use => 'display', label_extra_instance => 1, - instance_use => 'display', template => '%d', min => 0, max => 'total', cast_int => 1 } + { template => '%d', min => 0, max => 'total', cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-video-ports-free', display_ok => 0, nlabel => 'dma.cluster.video.port.free.count', set => { - key_values => [ { name => 'vp_free' }, { name => 'vp_used' }, { name => 'vp_prct_used' }, - { name => 'vp_prct_free' }, { name => 'vp_total' }, { name => 'display'} ], + key_values => [ + { name => 'vp_free' }, { name => 'vp_used' }, { name => 'vp_prct_used' }, + { name => 'vp_prct_free' }, { name => 'vp_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_video_port_output'), perfdatas => [ - { value => 'vp_free', template => '%d', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 'total', cast_int => 1 } + { template => '%d', min => 0, max => 'total', cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-video-ports-prct', display_ok => 0, nlabel => 'dma.cluster.video.port.percentage', set => { - key_values => [ { name => 'vp_prct_used' }, { name => 'display'} ], + key_values => [ { name => 'vp_prct_used' }, { name => 'display' } ], output_template => 'video ports used: %.2f %%', perfdatas => [ - { value => 'vp_prct_used', template => '%.2f', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 100, unit => '%' } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-voice-ports-usage', nlabel => 'dma.cluster.voice.port.usage.count', set => { - key_values => [ { name => 'vop_used' }, { name => 'vop_free' }, { name => 'vop_prct_used' }, - { name => 'vop_prct_free' }, { name => 'vop_total' }, { name => 'display'} ], + key_values => [ + { name => 'vop_used' }, { name => 'vop_free' }, { name => 'vop_prct_used' }, + { name => 'vop_prct_free' }, { name => 'vop_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_voice_port_output'), perfdatas => [ - { value => 'vop_used', template => '%d', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 'total', cast_int => 1 } + { template => '%d', min => 0, max => 'total', cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-voice-ports-free', display_ok => 0, nlabel => 'dma.cluster.voice.port.free.count', set => { - key_values => [ { name => 'vop_free' }, { name => 'vop_used' }, { name => 'vop_prct_used' }, - { name => 'vop_prct_free' }, { name => 'vop_total' }, { name => 'display'} ], + key_values => [ + { name => 'vop_free' }, { name => 'vop_used' }, { name => 'vop_prct_used' }, + { name => 'vop_prct_free' }, { name => 'vop_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_voice_port_output'), perfdatas => [ - { value => 'vop_free', template => '%d', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 'total', cast_int => 1 } + { template => '%d', min => 0, max => 'total', cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-voice-ports-prct', display_ok => 0, nlabel => 'dma.cluster.voice.port.percentage', set => { - key_values => [ { name => 'vop_prct_used' }, { name => 'display'} ], + key_values => [ { name => 'vop_prct_used' }, { name => 'display' } ], output_template => 'voice ports used: %.2f %%', perfdatas => [ - { value => 'vop_prct_used', template => '%.2f', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 100, unit => '%' } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } } @@ -175,7 +172,7 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - 'filter-cluster:s' => { name => 'filter_cluster' }, + 'filter-cluster:s' => { name => 'filter_cluster' } }); return $self; diff --git a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/deviceregistrations.pm b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/deviceregistrations.pm index c5680932e..1a1f27f0e 100644 --- a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/deviceregistrations.pm +++ b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/deviceregistrations.pm @@ -38,8 +38,7 @@ sub set_counters { key_values => [ { name => 'useDevRegistrationsCount' } ], output_template => 'Total registrations : %s', perfdatas => [ - { label => 'dma_registrations', value => 'useDevRegistrationsCount', label_extra_instance => 1, - instance_use => 'display', template => '%d', min => 0 } + { template => '%d', min => 0 } ] } } @@ -48,19 +47,17 @@ sub set_counters { $self->{maps_counters}->{cluster} = [ { label => 'cluster-endpoint-active-registration', nlabel => 'dma.cluster.endpoint.registrations.active.count', set => { key_values => [ { name => 'useDevRegActiveEndpointReg' }, { name => 'display'} ], - output_template => 'endpoint active registrations : %s', + output_template => 'endpoint active registrations: %s', perfdatas => [ - { label => 'endpoint_registration_active', value => 'useDevRegActiveEndpointReg', label_extra_instance => 1, - instance_use => 'display', template => '%d', min => 0 } + { template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'cluster-endpoint-inactive-registration', nlabel => 'dma.cluster.endpoint.registrations.inactive.count', set => { key_values => [ { name => 'useDevRegInactiveEndpointReg' }, { name => 'display'} ], - output_template => 'endpoint inactive registrations : %s', + output_template => 'endpoint inactive registrations: %s', perfdatas => [ - { label => 'endpoint_registration_inactive', value => 'useDevRegInactiveEndpointReg', label_extra_instance => 1, - instance_use => 'display',template => '%d', min => 0 } + { template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' } ] } } @@ -126,7 +123,6 @@ sub manage_selection { %$result }; } - } 1; diff --git a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/serversusage.pm b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/serversusage.pm index c8d6e5b22..da5925e56 100644 --- a/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/serversusage.pm +++ b/centreon-plugins/hardware/devices/polycom/dma/snmp/mode/serversusage.pm @@ -28,53 +28,53 @@ use warnings; sub custom_memory_output { my ($self, %options) = @_; - my $msg = sprintf("Memory Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)", + return sprintf( + 'Memory Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)', $self->{perfdata}->change_bytes(value => $self->{result_values}->{memory_total}), $self->{perfdata}->change_bytes(value => $self->{result_values}->{memory_used}), $self->{result_values}->{memory_prct_used}, $self->{perfdata}->change_bytes(value => $self->{result_values}->{memory_free}), $self->{result_values}->{memory_prct_free} ); - return $msg; } sub custom_swap_output { my ($self, %options) = @_; - my $msg = sprintf("Swap Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)", + return sprintf( + 'Swap Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)', $self->{perfdata}->change_bytes(value => $self->{result_values}->{swap_total}), $self->{perfdata}->change_bytes(value => $self->{result_values}->{swap_used}), $self->{result_values}->{swap_prct_used}, $self->{perfdata}->change_bytes(value => $self->{result_values}->{swap_free}), $self->{result_values}->{swap_prct_free} ); - return $msg; } sub custom_disk_output { my ($self, %options) = @_; - my $msg = sprintf("Disk Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)", + return sprintf( + 'Disk Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)', $self->{perfdata}->change_bytes(value => $self->{result_values}->{disk_total}), $self->{perfdata}->change_bytes(value => $self->{result_values}->{disk_used}), $self->{result_values}->{disk_prct_used}, $self->{perfdata}->change_bytes(value => $self->{result_values}->{disk_free}), $self->{result_values}->{disk_prct_free} ); - return $msg; } sub custom_logs_output { my ($self, %options) = @_; - my $msg = sprintf("Logs Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)", + return sprintf( + 'Logs Total: %s %s, Used: %s %s (%.2f%%), Free: %s %s (%.2f%%)', $self->{perfdata}->change_bytes(value => $self->{result_values}->{logs_total}), $self->{perfdata}->change_bytes(value => $self->{result_values}->{logs_used}), $self->{result_values}->{logs_prct_used}, $self->{perfdata}->change_bytes(value => $self->{result_values}->{logs_free}), $self->{result_values}->{logs_prct_free} ); - return $msg; } sub set_counters { @@ -87,134 +87,136 @@ sub set_counters { $self->{maps_counters}->{server} = [ { label => 'server-cpu-usage', nlabel => 'dma.server.cpu.utilization.percentage', set => { key_values => [ { name => 'stRsrcCPUUsageCPUUtilizationPct' }, { name => 'display'} ], - output_template => 'CPU Utilization : %.2f %%', + output_template => 'CPU Utilization: %.2f %%', perfdatas => [ - { label => 'cpu_utilization', value => 'stRsrcCPUUsageCPUUtilizationPct', template => '%d', - label_extra_instance => 1, instance_use => 'display', min => 0, max => 100, unit => '%' } + { template => '%d', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, # Memory counters { label => 'server-memory-usage', nlabel => 'dma.server.memory.usage.bytes', set => { - key_values => [ { name => 'memory_used' }, { name => 'memory_free' }, { name => 'memory_prct_used' }, - { name => 'memory_prct_free' }, { name => 'memory_total' }, { name => 'display'} ], + key_values => [ + { name => 'memory_used' }, { name => 'memory_free' }, { name => 'memory_prct_used' }, + { name => 'memory_prct_free' }, { name => 'memory_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_memory_output'), perfdatas => [ - { value => 'memory_used', template => '%d', label_extra_instance => 1, instance_use => 'display', - cast_int => 1, min => 0, max => 'total' } + { template => '%d', cast_int => 1, min => 0, max => 'memory_total', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'server-memory-free', display_ok => 0, nlabel => 'dma.server.memory.free.bytes', set => { - key_values => [ { name => 'memory_free' }, { name => 'memory_used' }, { name => 'memory_prct_used' }, - { name => 'memory_prct_free' }, { name => 'memory_total' } ], + key_values => [ + { name => 'memory_free' }, { name => 'memory_used' }, { name => 'memory_prct_used' }, + { name => 'memory_prct_free' }, { name => 'memory_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_memory_output'), perfdatas => [ - { value => 'memory_free', template => '%d', label_extra_instance => 1, instance_use => 'display', - cast_int => 1, min => 0, max => 'total' } + { template => '%d', cast_int => 1, min => 0, max => 'memory_total', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'server-memory-prct', display_ok => 0, nlabel => 'dma.server.memory.usage.percentage', set => { - key_values => [ { name => 'memory_prct_used' } ], + key_values => [ { name => 'memory_prct_used' }, { name => 'display' } ], output_template => 'RAM used: %.2f %%', perfdatas => [ - { value => 'memory_prct_used', template => '%.2f', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 100, unit => '%' } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, # Swap counters { label => 'server-swap-usage', nlabel => 'dma.server.swap.usage.percentage', set => { - key_values => [ { name => 'swap_used' }, { name => 'swap_free' }, { name => 'swap_prct_used' }, - { name => 'swap_prct_free' }, { name => 'swap_total' } ], + key_values => [ + { name => 'swap_used' }, { name => 'swap_free' }, { name => 'swap_prct_used' }, + { name => 'swap_prct_free' }, { name => 'swap_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_swap_output'), perfdatas => [ - { value => 'swap_used', template => '%d', label_extra_instance => 1, instance_use => 'display', - cast_int => 1, min => 0, max => 'total' } + { template => '%d', cast_int => 1, min => 0, max => 'swap_total', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'server-swap-free', display_ok => 0, nlabel => 'dma.server.swap.free.bytes', set => { - key_values => [ { name => 'swap_free' }, { name => 'swap_used' }, { name => 'swap_prct_used' }, - { name => 'swap_prct_free' }, { name => 'swap_total' } ], + key_values => [ + { name => 'swap_free' }, { name => 'swap_used' }, { name => 'swap_prct_used' }, + { name => 'swap_prct_free' }, { name => 'swap_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_swap_output'), perfdatas => [ - { value => 'swap_free', template => '%d', min => 0, max => 'total', - cast_int => 1, min => 0, max => 'total' } + { template => '%d', cast_int => 1, min => 0, max => 'swap_total', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'server-swap-prct', display_ok => 0, nlabel => 'dma.server.swap.usage.percentage', set => { - key_values => [ { name => 'swap_prct_used' } ], - output_template => 'RAM used: %.2f %%', + key_values => [ { name => 'swap_prct_used' }, { name => 'display' } ], + output_template => 'swap used: %.2f %%', perfdatas => [ - { value => 'swap_prct_used', template => '%.2f', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 100, unit => '%' } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, # Disk counters { label => 'server-disk-usage', nlabel => 'dma.server.disk.usage.bytes', set => { - key_values => [ { name => 'disk_used' }, { name => 'disk_free' }, { name => 'disk_prct_used' }, - { name => 'disk_prct_free' }, { name => 'disk_total' } ], + key_values => [ + { name => 'disk_used' }, { name => 'disk_free' }, { name => 'disk_prct_used' }, + { name => 'disk_prct_free' }, { name => 'disk_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_disk_output'), perfdatas => [ - { value => 'disk_used', template => '%d', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 'total', - cast_int => 1 } + { template => '%d', min => 0, max => 'disk_total', cast_int => 1, label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'server-disk-free', display_ok => 0, nlabel => 'dma.server.disk.free.bytes', set => { - key_values => [ { name => 'disk_free' }, { name => 'disk_used' }, { name => 'disk_prct_used' }, - { name => 'disk_prct_free' }, { name => 'disk_total' } ], + key_values => [ + { name => 'disk_free' }, { name => 'disk_used' }, { name => 'disk_prct_used' }, + { name => 'disk_prct_free' }, { name => 'disk_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_disk_output'), perfdatas => [ - { value => 'disk_free', template => '%d', label_extra_instance => 1, instance_use => 'display', - cast_int => 1, min => 0, max => 'total' } + { template => '%d', cast_int => 1, min => 0, max => 'disk_total', label_extra_instance => 1, instance_use => 'display', } ] } }, { label => 'server-disk-prct', display_ok => 0, nlabel => 'dma.server.disk.usage.percentage', set => { - key_values => [ { name => 'disk_prct_used' } ], - output_template => 'RAM used: %.2f %%', + key_values => [ { name => 'disk_prct_used' }, { name => 'display' } ], + output_template => 'disk used: %.2f %%', perfdatas => [ - { value => 'disk_prct_used', template => '%.2f', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 100, unit => '%' } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } }, # Log counters { label => 'server-logs-usage', nlabel => 'dma.server.logs.usage.bytes', set => { - key_values => [ { name => 'logs_used' }, { name => 'logs_free' }, { name => 'logs_prct_used' }, - { name => 'logs_prct_free' }, { name => 'logs_total' } ], + key_values => [ + { name => 'logs_used' }, { name => 'logs_free' }, { name => 'logs_prct_used' }, + { name => 'logs_prct_free' }, { name => 'logs_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_logs_output'), perfdatas => [ - { value => 'logs_used', template => '%d', label_extra_instance => 1, instance_use => 'display', - cast_int => 1, min => 0, max => 'total' } + { template => '%d', cast_int => 1, min => 0, max => 'logs_total', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'server-logs-free', display_ok => 0, nlabel => 'dma.server.logs.free.bytes', set => { - key_values => [ { name => 'logs_free' }, { name => 'logs_used' }, { name => 'logs_prct_used' }, - { name => 'logs_prct_free' }, { name => 'logs_total' } ], + key_values => [ + { name => 'logs_free' }, { name => 'logs_used' }, { name => 'logs_prct_used' }, + { name => 'logs_prct_free' }, { name => 'logs_total' }, { name => 'display' } + ], closure_custom_output => $self->can('custom_logs_output'), perfdatas => [ - { value => 'logs_free', template => '%d', label_extra_instance => 1, instance_use => 'display', - cast_int => 1, min => 0, max => 'total' } + { template => '%d', cast_int => 1, min => 0, max => 'logs_total', label_extra_instance => 1, instance_use => 'display' } ] } }, { label => 'server-logs-prct', display_ok => 0, nlabel => 'dma.server.logs.usage.percentage', set => { - key_values => [ { name => 'logs_prct_used' } ], - output_template => 'RAM used: %.2f %%', + key_values => [ { name => 'logs_prct_used' }, { name => 'display' } ], + output_template => 'logs used: %.2f %%', perfdatas => [ - { value => 'logs_prct_used', template => '%.2f', label_extra_instance => 1, instance_use => 'display', - min => 0, max => 100, unit => '%' } + { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' } ] } - }, + } ]; } @@ -224,7 +226,7 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - 'filter-server:s' => { name => 'filter_server' }, + 'filter-server:s' => { name => 'filter_server' } }); return $self; @@ -276,28 +278,27 @@ my $oid_stRsrcLogSpaceEntry = '.1.3.6.1.4.1.13885.13.2.2.1.4.5.1'; sub manage_selection { my ($self, %options) = @_; - $self->{server} = {}; - - $self->{server_result} = $options{snmp}->get_multiple_table( + my $snmp_result = $options{snmp}->get_multiple_table( oids => [ { oid => $oid_stRsrcCPUUsageEntry }, { oid => $oid_stRsrcMemoryUsageEntry }, { oid => $oid_stRsrcSwapUsageEntry }, { oid => $oid_stRsrcDiskSpaceEntry }, - { oid => $oid_stRsrcLogSpaceEntry }, + { oid => $oid_stRsrcLogSpaceEntry } ], nothing_quit => 1 ); - foreach my $oid (keys %{$self->{server_result}->{$oid_stRsrcCPUUsageEntry}}) { + $self->{server} = {}; + foreach my $oid (keys %{$snmp_result->{$oid_stRsrcCPUUsageEntry}}) { next if ($oid !~ /^$mapping_cpu->{stRsrcCPUUsageHostName}->{oid}\.(.*)$/); my $instance = $1; - my $result_cpu = $options{snmp}->map_instance(mapping => $mapping_cpu, results => $self->{server_result}->{$oid_stRsrcCPUUsageEntry}, instance => $instance); - my $result_memory = $options{snmp}->map_instance(mapping => $mapping_memory, results => $self->{server_result}->{$oid_stRsrcMemoryUsageEntry}, instance => $instance); - my $result_swap = $options{snmp}->map_instance(mapping => $mapping_swap, results => $self->{server_result}->{$oid_stRsrcSwapUsageEntry}, instance => $instance); - my $result_disk = $options{snmp}->map_instance(mapping => $mapping_disk, results => $self->{server_result}->{$oid_stRsrcDiskSpaceEntry}, instance => $instance); - my $result_logs = $options{snmp}->map_instance(mapping => $mapping_logs, results => $self->{server_result}->{$oid_stRsrcLogSpaceEntry}, instance => $instance); + my $result_cpu = $options{snmp}->map_instance(mapping => $mapping_cpu, results => $snmp_result->{$oid_stRsrcCPUUsageEntry}, instance => $instance); + my $result_memory = $options{snmp}->map_instance(mapping => $mapping_memory, results => $snmp_result->{$oid_stRsrcMemoryUsageEntry}, instance => $instance); + my $result_swap = $options{snmp}->map_instance(mapping => $mapping_swap, results => $snmp_result->{$oid_stRsrcSwapUsageEntry}, instance => $instance); + my $result_disk = $options{snmp}->map_instance(mapping => $mapping_disk, results => $snmp_result->{$oid_stRsrcDiskSpaceEntry}, instance => $instance); + my $result_logs = $options{snmp}->map_instance(mapping => $mapping_logs, results => $snmp_result->{$oid_stRsrcLogSpaceEntry}, instance => $instance); $result_cpu->{stRsrcCPUUsageHostName} = centreon::plugins::misc::trim($result_cpu->{stRsrcCPUUsageHostName}); if (defined($self->{option_results}->{filter_server}) && $self->{option_results}->{filter_server} ne '' && diff --git a/centreon-plugins/hardware/devices/polycom/dma/snmp/plugin.pm b/centreon-plugins/hardware/devices/polycom/dma/snmp/plugin.pm index d2cdcaf2d..b14dd5c05 100644 --- a/centreon-plugins/hardware/devices/polycom/dma/snmp/plugin.pm +++ b/centreon-plugins/hardware/devices/polycom/dma/snmp/plugin.pm @@ -30,7 +30,7 @@ sub new { bless $self, $class; $self->{version} = '1.0'; - %{$self->{modes}} = ( + $self->{modes} = { 'alerts' => 'hardware::devices::polycom::dma::snmp::mode::alerts', 'clusters' => 'hardware::devices::polycom::dma::snmp::mode::clusters', 'cpu' => 'snmp_standard::mode::cpu', @@ -43,8 +43,8 @@ sub new { 'servers-usage' => 'hardware::devices::polycom::dma::snmp::mode::serversusage', 'storage' => 'snmp_standard::mode::storage', 'swap' => 'snmp_standard::mode::swap', - 'uptime' => 'snmp_standard::mode::uptime', - ); + 'uptime' => 'snmp_standard::mode::uptime' + }; return $self; } diff --git a/centreon-plugins/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm b/centreon-plugins/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm index c16835a48..4e03d44e4 100644 --- a/centreon-plugins/hardware/devices/polycom/hdx/snmp/mode/viewstationstats.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/hdx/snmp/plugin.pm b/centreon-plugins/hardware/devices/polycom/hdx/snmp/plugin.pm index 11c44b068..45c463d37 100644 --- a/centreon-plugins/hardware/devices/polycom/hdx/snmp/plugin.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/clusterstatus.pm b/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/clusterstatus.pm index e934d787c..4da247188 100644 --- a/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/clusterstatus.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/license.pm b/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/license.pm index efe1a19f3..85f15584e 100644 --- a/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/license.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/provisioning.pm b/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/provisioning.pm index a043d2f8a..2acd16f5d 100644 --- a/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/provisioning.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/sitelinks.pm b/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/sitelinks.pm index 8cd3fd5ee..dd6c5876d 100644 --- a/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/sitelinks.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/sites.pm b/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/sites.pm index 250e27c8a..8390f88e1 100644 --- a/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/sites.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/updates.pm b/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/updates.pm index 85cf6e072..ace40ccaf 100644 --- a/centreon-plugins/hardware/devices/polycom/rprm/snmp/mode/updates.pm +++ b/centreon-plugins/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/centreon-plugins/hardware/devices/polycom/rprm/snmp/plugin.pm b/centreon-plugins/hardware/devices/polycom/rprm/snmp/plugin.pm index 4ce44682b..bc9e8456d 100644 --- a/centreon-plugins/hardware/devices/polycom/rprm/snmp/plugin.pm +++ b/centreon-plugins/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; }