want to get "Open Connection" of Files by command or REST API | Nutanix Community
Skip to main content

question1: What get "OpenConnection" to do how?

question2: Is "Open Connections" the number of sessions for Files?

thank you. 

If I understand correctly, you’re wanting to get the “Open Connections” stat which is visible from Prism for a given File Server or share, and you want to fetch this using a REST API call or command. 
You’d also like to verify if this tells you the number of open sessions for a Files server.

For day to day human-interactive operations, I’d recommend to use the MMC Snap-In for Nutanix Files, which includes the capability to list and manage SMB connections.
https://portal.nutanix.com/#/page/docs/details?targetId=Files-MMC-Plugin-v3:Files-MMC-Plugin-v3 

From your question though, it sounds like you’re wanting something you could script. I’m not sure of your use case but maybe one of these options will help.

1. Working from the CVM CLI, the command “ncli file-server list” will list Files servers on the cluster in detail. Part of this output is the “Total SMB Connections” stat. 
If you want details for just one Files server, you can use the ‘get’ command instead of list.
syntax: ncli file-server get uuid=<uuid> 
You can find this and other NCLI commands detailed in the Command Reference document for AOS.

https://portal.nutanix.com/#/page/docs/details?targetId=Command-Ref-AOS-v510:acl-ncli-file-server-auto-r.html 

2. If you’re looking to pull this stat through the REST API, you’ll probably want to use the REST API Explorer available in Prism. Access this from the dropdown menu that appears when you click on your username in the top right corner. That “Open Connections” value in Prism is from the one of the metrics collected with the V1 API call “vfilers/<uuid>/stats”. If I understand what you’re asking for, the metric for this is “total_smb_connections”. You can try this out from the REST explorer available in Prism and get a formatted URL string you could reuse to get this information.

There’s also a powershell commandlet you could use to get Files server stats and information, so that may be worth looking into as well.
reference: https://portal.nutanix.com/#/page/docs/details?targetId==API-Ref-AOS-v510:API-Ref-AOS-v510 

3. One more option I found, from a knowledge base article on the Nutanix support portal about identifying and clearing a hung session: https://portal.nutanix.com/kb/7491 
If you have SSH access to the Files server, you can use the commands described there to use and manage the current SMB connections. 


Jeremy

 

I was want to get open connections counts for rest api

I can proceed with the investigation, thank you:D