PowerShell Discussions

Inconsistency with Get-NcQuotaReport between REST and ONTAPI in PSTK

TheGoat
417 Views

Trying to update all of our Powershell scripts using the PSTK to use REST, and ran across the following inconsitency:

Get-NcQuotaReport is returning KiloByte Values when making a Ontapi call, yet it returns Byte values when making a REST call. And this is a problem, as ocassionally it will silently fallback to using Ontapi if not disabled.

PS d:\pstkscripts> get-NaToolkitVersion

Major Minor Build Revision
----- ----- ----- --------
9 18 1 2601

PS d:\pstkscripts> Get-NcQuotareport

QuotaType QuotaTarget Volume Qtree DiskUsed FilesUsed Vserver
--------- ----------- ------ ----- -------- --------- -------
tree     adglbnpmshrd pilotosm 170196221952 200344 filer1d
tree     adukrpweb1 rpweb 4977668096 7201 filer1d
tree     afidubfs1 profiles 4326468419584 15963217 filer1f

PS d:\pstkscripts> Get-NcQuotareport -ontapi

QuotaType QuotaTarget Volume Qtree DiskUsed FilesUsed Vserver
--------- ----------- ------ ----- -------- --------- -------
tree /vol/adglbnpmshrd/pilotosm adglbnpmshrd pilotosm 166207252 200344 filer1d
tree /vol/adukrpweb1/rpweb adukrpweb1 rpweb 4861020 7201 filer1d
tree /vol/afidubfs1/profiles afidubfs1 profiles 4225067908 15963222 filer1f

1 REPLY 1

sanmonkey
348 Views

We have a PS script that gathers volume, qtree, and aggregate space across 3 clusters, then exports results to a CSV to send to Xymon (aka Big Brother) monitoring system where it's sorted and presented on a unified webpage. Our operators use that to monitor space and send Servicenow tickets to the on-call person rather than having AIQUM spam everyone with alerts at night. I've been working on modifying the script to not use ONTAPI switch since that's being deprecated. I haven't experienced the problem you've described, but below is the qtree portion of the script. I do the math to get the units we prefer. They did change the units and I had to change my math to get the desired results.

# All we care about is Name, Allocated (GB), Free (GB), % Full, and Vserver.  A lot of what we do is driven by local Xymon expertise, so we don't get too complicated. Xymon works off percent full and sorts on that and is either green (<95), yellow (95-97), or red (>98). Pretty simple and no login required for our ops. I'm using the same PSTK version, but ONTAP 9.16.1P10. Due to some hardware EOS we can't go to 9.17 or above until later this year. Running PS 5.1. Hope this helps.

# Begin

$qtrees = Get-NcQuotaReport -Vserver * -Qtree * -QuotaType tree |
Where-Object { $_.DiskLimit -gt 0 } |
Select-Object @{
N="Name";E={$_.Qtree}
}, @{
N="Allocated (GB)";E={[math]::Round($_.DiskLimit/1.024GB)}
}, @{
N="Free (GB)";E={
$limit = [math]::Round($_.DiskLimit/1.024GB)
$used = [math]::Round($_.DiskUsed/1.024GB)
$limit - $used
}
}, @{
N="% Full";E={$_.DiskUsedPercentFileLimit}
}, @{
N="Vserver";E={$_.Vserver}
}

# End

Public