Skip to content

Commit

Permalink
Merge pull request #256 from JCoreMS/main
Browse files Browse the repository at this point in the history
JCore-AVDPattern-Fix-Issue-221
  • Loading branch information
JoeyBarnes authored Jun 28, 2024
2 parents 8dbab6e + 04221b9 commit 7e11357
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
3 changes: 2 additions & 1 deletion docs/content/patterns/specialized/avd/Known-Issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ geekdocCollapseSection: true
weight: 100
---

## None at this time
## Remaining Storage Calculation always 99.xx% / INCORRECT
Prior to 6/29/2024

12 changes: 9 additions & 3 deletions docs/content/patterns/specialized/avd/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ weight: 10

For information on what's new please refer to the [Releases](https://github.com/Azure/azure-monitor-baseline-alerts/releases) page.

To update your current deployment with the content from the latest release, please refer to the [Update to new release](../Update-to-new-Release) page.
To update your current deployment with the content from the latest release, please refer to the [Update to new release](Update-to-new-Release.md) page.

## 2024-01-25
### New features
Initial relocation from the Azure AVD Accelerator Brownfield with AVD specific Alerts on a per Host Pool basis.
Initial relocation from the Azure AVD Accelerator Brownfield with AVD specific Alerts on a per Host Pool basis.
- Session Host monitoring both on performance, AVD agent health, storage, and fslogix profiles

### Bug fixes
No new bug fixes at this time.
#### ISSUE #221
(Fixed on 6/28/2024)

Storage calculation script in the runbook which was yielding a much higher remaining value than truly existed. Values were in the 99.xx% range vs actual for remaining meaning the alert may never trigger when remaining storage is truly low.

Runbook: AvdStorageLogData
Script: Get-StorAcctInfo.ps1 line 46

Was --- $RemainingPercent = 100 - ($shareUsageInGB / $shareQuota)
New --- $RemainingPercent = 100 - ($shareUsageInGB / $shareQuota * 100)
24 changes: 12 additions & 12 deletions patterns/avd/scripts/Get-StorAcctInfo.ps1
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Deployed from resources.bicep
# Deployed from resources.bicep
# Code for Runbook associated with Action Account deployment
# Collects Azure Files Storage data and writes output in following format:
# AzFiles, Subscription ,RG ,StorAcct ,Share ,Quota ,GB Used ,%Available

<#
//Kusto Query for Log Analtyics
AzureDiagnostics
AzureDiagnostics
| where Category has "JobStreams"
| where StreamType_s has "Output"
| extend Results=split(ResultDescription,',')
#>

[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[string]$CloudEnvironment,
[Parameter(Mandatory)]
[array]$StorageAccountResourceIDs
[string]$CloudEnvironment,
[Parameter(Mandatory)]
[array]$StorageAccountResourceIDs
)

Connect-AzAccount -Identity -Environment $CloudEnvironment | Out-Null
Expand All @@ -27,13 +27,13 @@ $SubName = (Get-azSubscription -SubscriptionId ($StorageAccountResourceIDs -spli

# Foreach storage account
Foreach ($storageAcct in $storageAccountResourceIDs) {

$resourceGroup = ($storageAcct -split '/')[4]
$storageAcctName = ($storageAcct -split '/')[8]
#Write-Host "Working on Storage:" $storageAcctName "in" $resourceGroup

# $shares = Get-AzStorageShare -ResourceGroupName $resourceGroup -StorageAccountName $storageAcctName -Name 'profiles' -GetShareUsage
$shares = Get-AzRmStorageShare -ResourceGroupName $ResourceGroup -StorageAccountName $storageAcctName
$shares = Get-AzRmStorageShare -ResourceGroupName $ResourceGroup -StorageAccountName $storageAcctName

# Foreach Share
Foreach ($share in $shares) {
Expand All @@ -42,13 +42,13 @@ Foreach ($storageAcct in $storageAccountResourceIDs) {
#Write-Host "Share: " $shareName
$shareQuota = $share.QuotaGiB #GB
$shareUsageInGB = $share.ShareUsageBytes / 1073741824 # Bytes to GB
$RemainingPercent = 100 - ($shareUsageInGB / $shareQuota)

$RemainingPercent = 100 - ($shareUsageInGB / $shareQuota * 100)
#Write-Host "..." $shareUsageInGB "of" $shareQuota "GB used"
#Write-Host "..." $RemainingPercent "% Available"
# Add file share resource Id
$shareResourceId = $share.Id
# Compile results
# Compile results
# AzFiles / Subscription / RG / StorAcct / Share / Quota / GB Used / %Available
$Data = @('AzFiles', $SubName, $resourceGroup, $storageAcctName, $shareName, $shareQuota.ToString(), $shareUsageInGB.ToString(), $RemainingPercent.ToString(), $shareResourceId)
$i = 0
Expand All @@ -66,4 +66,4 @@ Foreach ($storageAcct in $storageAccountResourceIDs) {
$Data = $Null
} # end for each share

} # end for each storage acct
} # end for each storage acct

0 comments on commit 7e11357

Please sign in to comment.