Advertisement
FloSChn

Equallogic SAN-HQ warnining percent

Sep 1st, 2015
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #for explanation go to http://en.community.dell.com/support-forums/storage/f/3775/t/19641253?pi21859=2
  2. #by Florian Schneider
  3. ### set Values here ###
  4. $GroupIP = "127.0.0.1"
  5. $GroupUserName = "youruser"
  6. $GroupPassword = "yourpass"
  7. $desiredpercentfree = "87"
  8.  
  9. cls
  10. $starttime = Get-Date
  11.  
  12. Function do-log {
  13. param([Parameter(ValueFromPipeline=$true)]$pip, $par)
  14. $logtime = (get-date) - $starttime
  15. Write-Host $logtime $pip -ForegroundColor Yellow
  16. }
  17.  
  18. Import-Module "c:\program files\EqualLogic\bin\EqlPSTools.dll"
  19. Connect-EqlGroup -GroupAddress $GroupIP -UserName $GroupUserName -Password $GroupPassword -IgnoreSavedCredentials
  20.  
  21. "getting Volumes" | do-log
  22. $volumes = Get-EqlVolume
  23.  
  24. $volumes.Count.ToString() + " Volumes Found, removing " + ($volumes | where ISThinProvision -eq $False).count + " none thin Volumes" | do-log
  25. $volumes = $volumes | where ISThinProvision -eq $true
  26.  
  27. Function EQL-SetNewThinPercent {
  28. "Starting Calculate" | do-log
  29. $actualpercent = [int]$vol.ThinProvisionMinReservePercent
  30.  
  31.     do {
  32.     "recalculateing" | do-log
  33.     #$vol.VolumeName
  34.     [string]$actualpercent + " set, trying " + ([int]$actualpercent+1) | do-log
  35.     $actualpercent = [int]$actualpercent+1
  36.     "new warninig percent would be: " + [math]::Round($vol.AllocatedMB *100 / ($vol.VolumeSizeMB * ($actualpercent/100)),2) | do-log
  37.     }
  38.     until ($vol.AllocatedMB *100 / ($vol.VolumeSizeMB * ($actualpercent/100)) -lt $desiredpercentfree)
  39. "Found new percentage, setting: " + $actualpercent + " instead of: " + $vol.ThinProvisionMinReservePercent | do-log
  40.  
  41. #uncomment this line to automatically set the calculated percentage
  42. #Set-EqlVolume -VolumeName $vol.VolumeName -ThinProvisionMinReservePercent $actualpercent
  43. }
  44.  
  45.  
  46. foreach ($vol in $volumes){
  47. $vol.VolumeName | do-log
  48. "Now Percent set: " + $vol.ThinProvisionMinReservePercent | do-log
  49. $warningpercent = [math]::Round($vol.AllocatedMB *100 / $vol.DynamicThinReserveMB,2)
  50. "Reseve Percent = " + $warningpercent | do-log
  51.  
  52. if ($warningpercent -gt 90) {
  53.     "! Warning over 90% !" | do-log
  54.     EQL-SetNewThinPercent
  55.     }else{
  56.     "OK under 90 %" | do-log
  57.     }
  58. Write-Host ""
  59. }
  60.  
  61. Disconnect-EqlGroup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement