Question

AFS/Files Powershell Get-NTNXFsShareStat

  • 15 January 2019
  • 7 replies
  • 1950 views

Badge +6
Hi

I can use the command Get-NTNXAllFileServerShares to get a list of all the shares on a file server but how do I use Get-NTNXFsShareStat to get the usage of the share? I assume I need to user New-NTNXObject to build a list metrics but I dont know what metrics are available

This topic has been closed for comments

7 replies

Userlevel 6
Badge +5

@readuni1

Apologies for the much-delayed response.

Please look at this URL for details on the command parameters

https://portal.nutanix.com/#/page/docs/details?targetId=API-Ref-AOS-v510:ps-ps-FsShareStat-auto-r.html

Please let us know if you solved it already or if you still have further questions. Please also share the solution if you have found it already.

Userlevel 2
Badge +1

I have the same question. The documentation does not list the available metrics. What metrics can we use with this PowerShell CMDLET?

Userlevel 6
Badge +5

@readuni1 

@tburris48 

I see what is the difficulty is now. Please try metrics from the list below:

fs_metadata_iops
fs_metadata_latency
fs_overall_iops
fs_overall_latency
fs_overall_tput
fs_read_iops
fs_read_latency
fs_read_tput
fs_referenced_bytes
fs_used_space_bytes
fs_usedbydataset_bytes
fs_usedbysnapshots_bytes
fs_write_iops
fs_write_latency
fs_write_tput
share_available_bytes
share_metadata_iops
share_metadata_latency
share_overall_iops
share_overall_latency
share_overall_tput
share_read_iops
share_read_latency
share_read_tput
share_referenced_bytes
share_smb_connections
share_statvfs_f_ffree
share_statvfs_f_files
share_statvfs_files_used
share_used_bytes
share_usedbydataset_bytes
share_usedbysnapshots_bytes
share_write_iops
share_write_latency
share_write_tput
statvfs_f_ffree
statvfs_f_files
statvfs_files_used
total_available_space_bytes
total_smb_connections
total_space_used_bytes

Please note that for the command to return values there must be metric stats data available (otherwise you will get “no data available” message. Most importantly the UUID of the FS server must be used of the active FS server.

It is possible that not all of the mentioned above metrics work for you due to differences in AOS version.

Let me know how you go.

Userlevel 2
Badge +1

@Alona 

When I attempt to use the metrics above I am not getting any results. For example, I ran the following:
Get-NTNXFsShareStat -Uuid -ShareUuid -Metrics share_available_bytes

I get the following:

Get-NTNXFsShareStat : The operation has timed out
At line:1 char:1
+ Get-NTNXFsShareStat -Uuid 7ad3b3c5-2adb-4047-a0dd-b02e7fd3d775 -Share ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Nutanix.Prism.Common.NutanixCluster:NutanixCluster) [Get-NTNXFsShareStat], WebException
    + FullyQualifiedErrorId : Error,Nutanix.Prism.PS.Cmds.Minerva.GetFsShareStat

 

What am I missing?

Userlevel 6
Badge +5

I had the same issue to be honest. It took restarting the PowerShell itself to resolve the timeout.

Another thing to note is that it is essential to specify -startTimeInUsecs and -EndTimeInUsecs.
These two are in Unix epoch format and are referring to CVM time. It may be useful to leverage -IntervalInSecs parameter.

Let me know how you go.

FYI I am going to request improvement internally so that metric parameter accepts *(all) value. I can’t promise any ETA at this point as from what I am aware of at this point APIs is the vector forward.

Userlevel 2
Badge +1

When I dug a little deeper I discovered that statistics are only collected every 10 minutes. If the -StartTimeInUsecs smaller than 10 minutes you won’t get any data. I was able to reliably see this with several of the metrics.

Userlevel 6
Badge +5

Thank you for sharing your findings here.