Scripts

Welcome to the Nutanix NEXT community. To get started please read our short welcome post. Thanks!

cancel
Showing results for 
Search instead for 
Did you mean: 

What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

Adventurer

What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

Trying to figure out how to automate getting cluster IOPS and latency stats via powershell.  so far it looks like get-ntnxclusterstat is the cmdlet to do that but I can't crack the code and there is NO document I can find anywhere that gives real examples of how to provide the names for the -metrics parameter that each of the get-ntnx*stat cmdlets require.  

 

I see that when you call get-cluster, the cluster object has a .stats property, which lists name-value pairs for the current 30 second interval, but trying to use any of those names such as 'num_iops' or 'num_read_iops' returns a failure

successful            : False

message              : Invalid stats field name specified

startTimeInUsecs : 0

intervalInSecs      : 0

metric                   : System.String[]

values                  : {}

 

So where is the super-secret list of metrics names?  * doesn't work either, and not providing the Metrics parameter is not allowed.

 

 

23 REPLIES
Moderator Moderator
Moderator

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

Good question, I dont know offhand, I'll ask internally to see what I can find.

Jon Kohler | Principal Architect, Nutanix | Nutanix NPX #003, VCDX #116 | @JonKohler
Please Kudos if useful!
Moderator Moderator
Moderator

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

I'll admit, the metric switches are very poorly documented for this. I've opened an internal engineering ticket to get it all formally documented, but that may take some time.

 

If you've got a pressing need, we're always happy to help through SLA based support, by filing a ticket on portal.nutanix.com if you are NX or SX customer, or through your respective OEM partner for HX or XC gear. They can dig in and collaborate with engineering real time to pull out what you need.

Jon Kohler | Principal Architect, Nutanix | Nutanix NPX #003, VCDX #116 | @JonKohler
Please Kudos if useful!
Adventurer

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

Could you give me a hint about the basic syntax?  Is it possible to figure out the valid names based on already available information?  I appreciate the need for full documentation, but I'd rather be able to actually use the cmdlets right now.

Adventurer

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

any updates yet?

Nutanix Employee

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

Hi @geoffd

 

Please find the below commands to get the list of available stats.

 

(Get-NTNXCluster -Servers "server/ip").usagestats

(Get-NTNXCluster -Servers "server/ip").stats

 

Regards,

Sandeep MP

Adventurer

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

@sandeepmp

 

Thanks for the reply.  I'l looking for the following stats:

Cluster Disk IO latency

Cluster Disk IOPS

Host Disk IO Latency

Host Disk IOPS

 

I pulled the list of stats from (get-ntnxcluster -Server '<myserver>').stats and decided to try 'avg_io_latency_usecs' in hopes it will correspond to 'Cluster Disk IO Latency'

My powershell session has an active connection following Connect-NTNXCluster

I created a start datetime $start = get-date '2/22/2017 10:00 AM', and an end datetime $stop = get-date '2/22/2017 11:00 AM'

I ran the following cmd:

get-ntnxclusterstat -Metrics 'avg_io_latency_usecs' -starttimeinusecs $start.ticks -endtimeinusecs $stop.ticks -IntervalInSecs 60

 

the result is 

successful            :  False

message              :  Invalid stats field name specified

startTimeInUsecs :  0

endTimeInUsecs  :  0

metric                   :  System.String[]

values                   :  {}

 

So what an I doing wrong?

Nutanix Employee

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

Hi geoffd,

 

StartTimeInUsecs value should be in "microseconds". So we need to convert the time to microseconds.

 

Please follow the below to do the same

 

#date input section

-----------------------

$epoch = Get-Date -Date "01/01/1970" #donot change this line

 

 

$startdate = get-date 'Provide date here'
$enddate = get-date 'provide date here'

 

#convert time to Microseconds
=============================

[int64]$date_start = ((New-TimeSpan -Start $epoch -End $startdate).TotalMilliseconds)*1000
[int64]$date_end = ((New-TimeSpan -Start $epoch -End $enddate).TotalMilliseconds)*1000

 

#Script

=======

 

get-ntnxclusterstat -Metrics 'avg_io_latency_usecs' -starttimeinusecs $date_start -endtimeinusecs $date_end -IntervalInSecs 60

 

Regards,

Sandeep MP

 

Adventurer

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

@sandeepmp

 

OK, tried that configuration, but I'm still getting the same error about the invalid stats field name.  are you able to get data using the 'avg_io_latency_usecs' metric?  Could I have a version mismatch?

 

Adventurer

Re: What are valid names for the -metrics parameter in the get-ntnxclusterstat cmdlet

I am running version 4.7.3.1 starter license.  NutanixCmdlets are version 1.7