Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Script to check if Windows DeDuplication is enabled for all fixed Disks except C: and to Summarize the Savings of Windows DeDuplication Might be helpfull if you are running your calssic windows fileserver with enabled deduplication should be called via NRPE/NSClient++
Current Version
1.0
Last Release Date
2020-12-13
Owner
Peter Luetke-Bexten
License
GPL
Compatible With
################################################################################## # # NAME: check_win_dedup_status.ps1 # # AUTHOR: Peter Luetke-Bexten # EMAIL: peter.luetke-bexten (at) benteler.com # # COMMENT: # Script to check if Windows DeDuplication is enabled for all fixed Disks except C: # and to Summarize the Savings of Windows DeDuplication # Might be helpfull if you are running your calssic windows fileserver with enabled deduplication # should be called via NRPE/NSClient++ # # Return Values for NRPE: # DeDup is enabled for all Volumes - OK (0) # DeDup on some Volumes not enabled - WARNING (1) # DeDup is not enabled for any Volume - WARNING (1) # DeDup Feature is not enabled - UNKNOWN (3) # Script errors - UNKNOWN (3) # # NSCLIENT.ini: # check_win_dedup_status = cmd /c echo scriptspowershellcheck_win_dedup_status.ps1 ; exit($lastexitcode) | "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" -noninteractive -noprofile -ExecutionPolicy unrestricted -command - # # NRPE Check: # check_nrpe -H Targethost -p 5666 -t 120 -u -c check_win_dedup_status # # CHANGELOG: # 1.0 20201211 - initial version # ##################################################################################
# Nagios return States $returnStateOK = 0 $returnStateWarning = 1 $returnStateCritical = 2 $returnStateUnknown = 3
# Check DedupFeature if (!((Get-WindowsFeature -Name FS-Data-Deduplication).InstallState -eq "Installed")) { Write-Host "FS-Data-Deduplication Feature is not enabled" exit $returnStateUnknown }
if (!(Get-Command Get-DedupStatus -errorAction SilentlyContinue)) { Write-Host "Get-DedupStatus is not available on this System" exit $returnStateUnknown }
# Get local Disk Infos $DiskswoOS=Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType = ""3""" | Where-Object {$_.DeviceID -ne ‘C:’} | Select-Object -Property DeviceID, DriveType, VolumeName, @{L='FreeSpaceGB';E={"{0:N2}" -f ($_.FreeSpace /1GB)}}, @{L="CapacityGB";E={"{0:N2}" -f ($_.Size/1GB)}}
# Check if there are DataVolumes (every local disk excl. Drive C:) if ($DiskswoOS -eq $Null) { Write-Host "No DataVolumes available" exit $returnStateUnknown }
# Get DeDup Status $DisksDeDup=Get-Dedupstatus | Select-Object -Property Volume, @{L='FreeSpaceGB';E={"{0:N2}" -f ($_.FreeSpace /1GB)}}, @{L="SavedSpaceGB";E={"{0:N2}" -f ($_.SavedSpace/1GB)}}
# Check if no Deduplication is available for anyo DataVolumes if ($DisksDeDup -eq $Null) { Write-Host "No Deduplication enabled for any of the DataVolumes" exit $returnStateUnknown }
# Compare lokal Disk Info with DedupStatus Info $Comparsion=Compare-Object -ReferenceObject $DiskswoOS -DifferenceObject $DisksDeDup -PassThru
# If DedupStatus differs with lokal Disk Info display the Disk(s) without DDP enabled and also summarize if ($Comparsion -ne $Null) { foreach ($Object in $Comparsion) { Write-Host "Drive $($Object.DeviceID) has no DeDuplication enabled" } $SavingsTotalGB = 0 foreach ($Object in $DisksDeDup) { $SavingsTotalGB += $($Object.SavedSpaceGB) } Write-Host "Warning - not all Drives have DeDup enabled| 'DedDup Savings Total GB'=$($SavingsTotalGB)" exit $returnStateWarning }
# If DedupStatus has same Volumes as lokal Disk printout the DeDup Savings per Volume if ($Comparsion -eq $Null) { $SavingsTotalGB = 0 foreach ($Object in $DisksDeDup) { $SavingsTotalGB += $($Object.SavedSpaceGB) } Write-Host "OK - DeDup Savings Total $($SavingsTotalGB) GB| 'DedDup Savings Total GB'=$($SavingsTotalGB)" exit $returnStateOK }
# if we are here, something went wrong exit $returnStateCritical
You must be logged in to submit a review.
To:
From: