Skip to content

Commit 16cbac9

Browse files
committed
Added Profile handling and parameter documentation to Reporting Cmdlet
1 parent 10e0430 commit 16cbac9

1 file changed

Lines changed: 39 additions & 7 deletions

File tree

src/StorageGRID-Webscale.psm1

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15792,6 +15792,22 @@ function Global:Remove-SgwS3AccessKey {
1579215792
Get StorageGRID Report
1579315793
.DESCRIPTION
1579415794
Get StorageGRID Report
15795+
.PARAMETER Server
15796+
StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
15797+
.PARAMETER ProfileName
15798+
StorageGRID Profile to use for connection.
15799+
.PARAMETER Attribute
15800+
Attribute to report
15801+
.PARAMETER OID
15802+
Topology OID to create report for
15803+
.PARAMETER Site
15804+
Site to create report for
15805+
.PARAMETER Node
15806+
Node to create report for
15807+
.PARAMETER StartTime
15808+
Start Time (default: last hour)
15809+
.PARAMETER EndTime
15810+
End Time (default: current time)
1579515811
#>
1579615812
function Global:Get-SgwReport {
1579715813
[CmdletBinding(DefaultParameterSetName = "none")]
@@ -15801,36 +15817,50 @@ function Global:Get-SgwReport {
1580115817
Mandatory = $False,
1580215818
Position = 0,
1580315819
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
15820+
[parameter(Mandatory = $False,
15821+
Position = 1,
15822+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName,
1580415823
[parameter(
1580515824
Mandatory = $True,
15806-
Position = 1,
15807-
HelpMessage = "Attribut to report")][String][ValidateSet("Archive Nodes Installed (XANI)", "Archive Nodes Readable (XANR)", "Archive Nodes Writable (XANW)", "Awaiting - All (XQUZ)", "Awaiting - Client (XCQZ)", "Awaiting - Evaluation Rate (XEVT)", "CDMI - Ingested Bytes (XCRX) [Bytes]", "CDMI - Retrieved Bytes (XCTX) [Bytes]", "CDMI Ingest - Rate (XCIR) [MB/s]", "CDMI Operations - Failed (XCFA)", "CDMI Operations - Rate (XCRA) [Objects/s]", "CDMI Operations - Successful (XCSU)", "CDMI Retrieval - Rate (XCRR) [MB/s]", "Current ILM Activity (IQSZ)", "Installed Storage Capacity (XISC) [Bytes]", "Percentage Storage Capacity Used (PSCU)", "Percentage Usable Storage Capacity (PSCA)", "S3 - Ingested Bytes (XSRX) [Bytes]", "S3 - Retrieved Bytes (XSTX) [Bytes]", "S3 Ingest - Rate (XSIR) [MB/s]", "S3 Operations - Failed (XSFA)", "S3 Operations - Rate (XSRA) [Objects/s]", "S3 Operations - Successful (XSSU)", "S3 Operations - Unauthorized (XSUA)", "S3 Retrieval - Rate (XSRR) [MB/s]", "Scan Period - Estimated (XSCM) [us]", "Scan Rate (XSCT) [Objects/s]", "Storage Nodes Installed (XSNI)", "Storage Nodes Readable (XSNR)", "Storage Nodes Writable (XSNW)", "Swift - Ingested Bytes (XWRX) [Bytes]", "Swift - Retrieved Bytes (XWTX) [Bytes]", "Swift Ingest - Rate (XWIR) [MB/s]", "Swift Operations - Failed (XWFA)", "Swift Operations - Rate (XWRA) [Objects/s]", "Swift Operations - Successful (XWSU)", "Swift Operations - Unauthorized (XWUA)", "Swift Retrieval - Rate (XWRR) [MB/s]", "Total EC Objects (XECT)", "Total EC Reads - Failed (XERF)", "Total EC Reads - Successful (XERC)", "Total EC Writes - Failed (XEWF)", "Total EC Writes - Successful (XEWC)", "Total Objects Archived (XANO)", "Total Objects Deleted (XANP)", "Total Size of Archived Objects (XSAO)", "Total Size of Deleted Objects (XSAP)", "Usable Storage Capacity (XASC) [Bytes]", "Used Storage Capacity (XUSC) [Bytes]", "Used Storage Capacity for Data (XUSD) [Bytes]", "Used Storage Capacity for Metadata (XUDC) [Bytes]")]$Attribute,
15825+
Position = 2,
15826+
HelpMessage = "Attribute to report")][String][ValidateSet("Archive Nodes Installed (XANI)", "Archive Nodes Readable (XANR)", "Archive Nodes Writable (XANW)", "Awaiting - All (XQUZ)", "Awaiting - Client (XCQZ)", "Awaiting - Evaluation Rate (XEVT)", "CDMI - Ingested Bytes (XCRX) [Bytes]", "CDMI - Retrieved Bytes (XCTX) [Bytes]", "CDMI Ingest - Rate (XCIR) [MB/s]", "CDMI Operations - Failed (XCFA)", "CDMI Operations - Rate (XCRA) [Objects/s]", "CDMI Operations - Successful (XCSU)", "CDMI Retrieval - Rate (XCRR) [MB/s]", "Current ILM Activity (IQSZ)", "Installed Storage Capacity (XISC) [Bytes]", "Percentage Storage Capacity Used (PSCU)", "Percentage Usable Storage Capacity (PSCA)", "S3 - Ingested Bytes (XSRX) [Bytes]", "S3 - Retrieved Bytes (XSTX) [Bytes]", "S3 Ingest - Rate (XSIR) [MB/s]", "S3 Operations - Failed (XSFA)", "S3 Operations - Rate (XSRA) [Objects/s]", "S3 Operations - Successful (XSSU)", "S3 Operations - Unauthorized (XSUA)", "S3 Retrieval - Rate (XSRR) [MB/s]", "Scan Period - Estimated (XSCM) [us]", "Scan Rate (XSCT) [Objects/s]", "Storage Nodes Installed (XSNI)", "Storage Nodes Readable (XSNR)", "Storage Nodes Writable (XSNW)", "Swift - Ingested Bytes (XWRX) [Bytes]", "Swift - Retrieved Bytes (XWTX) [Bytes]", "Swift Ingest - Rate (XWIR) [MB/s]", "Swift Operations - Failed (XWFA)", "Swift Operations - Rate (XWRA) [Objects/s]", "Swift Operations - Successful (XWSU)", "Swift Operations - Unauthorized (XWUA)", "Swift Retrieval - Rate (XWRR) [MB/s]", "Total EC Objects (XECT)", "Total EC Reads - Failed (XERF)", "Total EC Reads - Successful (XERC)", "Total EC Writes - Failed (XEWF)", "Total EC Writes - Successful (XEWC)", "Total Objects Archived (XANO)", "Total Objects Deleted (XANP)", "Total Size of Archived Objects (XSAO)", "Total Size of Deleted Objects (XSAP)", "Usable Storage Capacity (XASC) [Bytes]", "Used Storage Capacity (XUSC) [Bytes]", "Used Storage Capacity for Data (XUSD) [Bytes]", "Used Storage Capacity for Metadata (XUDC) [Bytes]")]$Attribute,
1580815827
[parameter(
1580915828
Mandatory = $False,
15810-
Position = 1,
15829+
Position = 3,
1581115830
ParameterSetName = "oid",
1581215831
HelpMessage = "Topology OID to create report for")][String]$OID,
1581315832
[parameter(
1581415833
Mandatory = $False,
15815-
Position = 1,
15834+
Position = 4,
1581615835
ParameterSetName = "site",
1581715836
HelpMessage = "Site to create report for")][String]$Site,
1581815837
[parameter(
1581915838
Mandatory = $False,
15820-
Position = 1,
15839+
Position = 5,
1582115840
ParameterSetName = "node",
1582215841
HelpMessage = "Node to create report for")][String]$Node,
1582315842
[parameter(
1582415843
Mandatory = $False,
15825-
Position = 2,
15844+
Position = 6,
1582615845
HelpMessage = "Start Time (default: last hour)")][DateTime]$StartTime = (Get-Date).AddHours(-1),
1582715846
[parameter(
1582815847
Mandatory = $False,
15829-
Position = 3,
15848+
Position = 7,
1583015849
HelpMessage = "End Time (default: current time)")][DateTime]$EndTime = (Get-Date)
1583115850
)
1583215851

1583315852
Begin {
15853+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
15854+
$ProfileName = "default"
15855+
}
15856+
if ($ProfileName) {
15857+
$Profile = Get-SgwProfile -ProfileName $ProfileName
15858+
if (!$Profile.Name) {
15859+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
15860+
}
15861+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
15862+
}
15863+
1583415864
if (!$Server) {
1583515865
$Server = $Global:CurrentSgwServer
1583615866
}
@@ -15886,6 +15916,7 @@ function Global:Get-SgwReport {
1588615916
$Average = $Average -replace ",", "" -replace " ", ""
1588715917
$Minimum = $Minimum -replace ",", "" -replace " ", ""
1588815918
$Maximum = $Maximum -replace ",", "" -replace " ", ""
15919+
$Time = $Time + "Z"
1588915920
[PSCustomObject]@{ "Time Received" = [DateTime]$time; "Average $Attribute" = $Average; "Minimum $Attribute" = $Minimum; "Maximum $Attribute" = $Maximum }
1589015921
}
1589115922
}
@@ -15894,6 +15925,7 @@ function Global:Get-SgwReport {
1589415925
foreach ($Line in $Report) {
1589515926
$Time, $Value = $Line -split ';'
1589615927
$Value = $Value -replace ",", "" -replace " ", ""
15928+
$Time = $Time + "Z"
1589715929
[PSCustomObject]@{ "Time Received" = [DateTime]$time; $Attribute = $value }
1589815930
}
1589915931
}

0 commit comments

Comments
 (0)