You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# helper function to convert unix timestamp to datetime
115
+
functionConvertFrom-UnixTimestamp {
116
+
[CmdletBinding()]
117
+
118
+
PARAM (
119
+
[parameter(Mandatory=$True,
120
+
Position=0,
121
+
ValueFromPipeline=$True,
122
+
ValueFromPipelineByPropertyName=$True,
123
+
HelpMessage="Timestamp to be converted.")][String]$Timestamp,
124
+
[parameter(Mandatory=$True,
125
+
Position=0,
126
+
ValueFromPipeline=$True,
127
+
ValueFromPipelineByPropertyName=$True,
128
+
HelpMessage="Unit of timestamp.")][ValidateSet("Seconds","Milliseconds")][String]$Unit="Milliseconds",
129
+
[parameter(Mandatory=$False,
130
+
Position=1,
131
+
HelpMessage="Optional Timezone to be used as basis for Timestamp. Default is system Timezone.")][System.TimeZoneInfo]$Timezone=[System.TimeZoneInfo]::Local
@@ -3684,6 +3744,114 @@ function Global:Update-SGWLicense {
3684
3744
3685
3745
## metrics ##
3686
3746
3747
+
<#
3748
+
.SYNOPSIS
3749
+
Retrieves the metric names
3750
+
.DESCRIPTION
3751
+
Retrieves the metric names
3752
+
#>
3753
+
functionGlobal:Get-SGWMetricNames {
3754
+
[CmdletBinding()]
3755
+
3756
+
PARAM (
3757
+
[parameter(Mandatory=$False,
3758
+
Position=0,
3759
+
HelpMessage="StorageGRID Webscale Management Server object. If not specified, global CurrentSGWServer object will be used.")][PSCustomObject]$Server
3760
+
)
3761
+
3762
+
Begin {
3763
+
if (!$Server) {
3764
+
$Server=$Global:CurrentSGWServer
3765
+
}
3766
+
if (!$Server) {
3767
+
Throw"No StorageGRID Webscale Management Server management server found. Please run Connect-SGWServer to continue."
3768
+
}
3769
+
if ($Server.AccountId) {
3770
+
Throw"Operation not supported when connected as tenant. Use Connect-SgwServer without the AccountId parameter to connect as grid administrator and then rerun this command."
HelpMessage="Query start, default current time (date-time).")][DateTime]$Time,
3809
+
[parameter(Mandatory=$False,
3810
+
Position=2,
3811
+
HelpMessage="Timeout in seconds.")][Int]$Timeout=120
3812
+
)
3813
+
3814
+
Begin {
3815
+
if (!$Server) {
3816
+
$Server=$Global:CurrentSGWServer
3817
+
}
3818
+
if (!$Server) {
3819
+
Throw"No StorageGRID Webscale Management Server management server found. Please run Connect-SGWServer to continue."
3820
+
}
3821
+
if ($Server.AccountId) {
3822
+
Throw"Operation not supported when connected as tenant. Use Connect-SgwServer without the AccountId parameter to connect as grid administrator and then rerun this command."
3823
+
}
3824
+
}
3825
+
3826
+
Process {
3827
+
$Uri=$Server.BaseURI+"/grid/metric-query"
3828
+
$Method="GET"
3829
+
3830
+
$Uri+="?query=$Query"
3831
+
3832
+
if ($Time) {
3833
+
$Uri+="&time=$(Get-Date-Format o $Time.ToUniversalTime())"
0 commit comments