diff --git a/centreon/common/powershell/dell/compellent/volumeusage.pm b/centreon/common/powershell/dell/compellent/volumeusage.pm index fc06d1a84..c8bd176e0 100644 --- a/centreon/common/powershell/dell/compellent/volumeusage.pm +++ b/centreon/common/powershell/dell/compellent/volumeusage.pm @@ -53,11 +53,17 @@ Function display_volume_information { '; } - $ps .= ' + $ps .= ' foreach ($sc in $storageCenters) { $volumeList = Get-DellScVolume -ConnectionName $connName -StorageCenter $sc foreach ($vol in $volumeList) { - $volusage = Get-DellScVolumeStorageUsageAssociation -ConnectionName $connName -Instance $vol +'; + if (defined($options{filter_vol}) && $options{filter_vol} ne '') { + $ps .= 'if (-Not ($vol -match "' . $options{filter_vol} . '")) { continue } +'; + } + + $ps .= '$volusage = Get-DellScVolumeStorageUsageAssociation -ConnectionName $connName -Instance $vol $usage = Get-DellScVolumeStorageUsage -ConnectionName $connName -Instance $volusage write-host ("[sc={0}]" -f $sc.Name) -NoNewline @@ -69,8 +75,14 @@ Function display_volume_information { write-host ("[totalDiskSpace={0}]" -f $usage.TotalDiskSpace.GetByteSize()) -NoNewline write-host ("[replaySpace={0}]" -f $usage.replaySpace.GetByteSize()) } - - $diskList = Get-DellScDisk -ConnectionName $connName -StorageCenter $sc +'; + + if (defined($options{filter_vol}) && $options{filter_vol} ne '') { + $ps .= 'continue +'; + } + + $ps .= '$diskList = Get-DellScDisk -ConnectionName $connName -StorageCenter $sc foreach ($disk in $diskList) { $diskusage = Get-DellScDiskStorageUsageAssociation -ConnectionName $connName -Instance $disk $usage = Get-DellScDiskStorageUsage -ConnectionName $connName -Instance $diskusage diff --git a/storage/dell/compellent/local/mode/volumeusage.pm b/storage/dell/compellent/local/mode/volumeusage.pm index 8da5629ab..b7062968f 100644 --- a/storage/dell/compellent/local/mode/volumeusage.pm +++ b/storage/dell/compellent/local/mode/volumeusage.pm @@ -31,7 +31,7 @@ sub set_counters { my ($self, %options) = @_; $self->{maps_counters_type} = [ - { name => 'sc', type => 1, cb_prefix_output => 'prefix_sc_output', message_multiple => 'All storage centers are ok' }, + { name => 'sc', type => 1, cb_prefix_output => 'prefix_sc_output', message_multiple => 'All storage centers are ok', cb_init => 'sc_init' }, { name => 'volume', type => 1, cb_prefix_output => 'prefix_volume_output', message_multiple => 'All volumes are ok' } ]; $self->{maps_counters}->{sc} = [ @@ -89,6 +89,15 @@ sub prefix_volume_output { return "Volume '" . $options{instance_value}->{display} . "' "; } +sub sc_init { + my ($self, %options) = @_; + + if (defined($self->{option_results}->{ps_sc_volume}) && $self->{option_results}->{ps_sc_volume} ne '') { + return 1; + } + return 0; +} + my $instance_mode; sub custom_usage_perfdata { @@ -182,6 +191,7 @@ sub new { "no-ps" => { name => 'no_ps' }, "ps-exec-only" => { name => 'ps_exec_only' }, "ps-sc-filter:s" => { name => 'ps_sc_filter' }, + "ps-sc-volume:s" => { name => 'ps_sc_volume' }, "units:s" => { name => 'units', default => '%' }, "free" => { name => 'free' }, }); @@ -310,6 +320,10 @@ Print powershell output. Filter Storage Center (only wilcard '*' can be used. In Powershell). +=item B<--ps-sc-volume> + +Filter Volume Name to display. + =item B<--units> Units of thresholds (Default: '%') ('%', 'B').