解决了

想要得到“打开连接”的文件通过命令或REST API

  • 2020年1月31日
  • 2回答
  • 1749的浏览量

徽章

问题1:让“OpenConnection”做什么?

问题2:“Open Connections”是文件的会话数吗?

谢谢你!

图标

最佳答案JeremyJ2020年2月6日,21:19

If I understand correctly, you\u2019re wanting to get the \u201cOpen Connections\u201d 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.\u00a0
You\u2019d 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\u2019d recommend\u00a0to 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<\/a>\u00a0<\/p>

From your question though, it sounds like you\u2019re wanting something you could script.\u00a0I\u2019m not sure of your use case but maybe one of these options\u00a0will help.

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

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

2. If you\u2019re looking to pull this stat through the REST API, you\u2019ll 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 \u201cOpen Connections\u201d value in Prism is from the one of\u00a0the metrics collected with the V1 API call \u201cvfilers\/<uuid>\/stats\u201d. If I understand what you\u2019re asking for, the metric for this is \u201ctotal_smb_connections\u201d. 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\u2019s also a powershell commandlet you could use to get Files server stats and information, so that may be worth looking into as well.
reference:\u00a0
https:\/\/portal.nutanix.com\/#\/page\/docs\/details?targetId==API-Ref-AOS-v510:API-Ref-AOS-v510<\/a>\u00a0

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

查看原始

2回答

Userlevel 3
徽章 + 4

如果我理解正确,您想要获得“打开连接”的统计,这是一个给定的文件服务器或共享的Prism可见,并且您想要获取这个使用REST API调用或命令。
您还需要验证这是否告诉您Files服务器打开的会话数。

对于日常的人机交互操作,我建议为Nutanix Files使用MMC Snap-In,它包含列出和管理SMB连接的功能。
https://portal.nutanix.com/#/page/docs/details?targetId=Files-MMC-Plugin-v3:Files-MMC-Plugin-v3

从你的问题中,听起来你想要一些你可以编写的东西。我不确定你的用例,但也许这些选项中的一个会有帮助。

1.在CVM命令行中,“ncli file-server list”命令将详细列出集群中的文件服务器。该输出的一部分是“总SMB连接”统计信息。
如果你只想要一个Files服务器的详细信息,你可以使用' get '命令而不是list。
命令格式:ncli file-server get uuid=
你可以在AOS的命令参考文档中找到这个和其他NCLI命令的详细信息。

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

2.如果您希望通过REST API来获取此数据,您可能需要使用Prism中可用的REST API Explorer。当你点击右上角的用户名时,可以从下拉菜单中访问。Prism中的“Open Connections”值来自V1 API调用“vfilers//stats”所收集的指标之一。如果我理解了您的要求,那么它的度量是“total_smb_connections”。您可以从Prism中可用的REST资源管理器中尝试这一点,并获得一个格式化的URL字符串,您可以重用它来获得这些信息。

还有一个powershell命令让你可以使用它来获取Files服务器的统计数据和信息,所以这可能也值得一看。
参考:https://portal.nutanix.com/#/page/docs/details?targetId==API-Ref-AOS-v510:API-Ref-AOS-v510

3.我从Nutanix支持门户网站上的一篇关于识别和清除挂起会话的知识库文章中找到了另一个选项:https://portal.nutanix.com/kb/7491
如果您可以通过SSH访问Files服务器,那么您可以使用那里描述的命令来使用和管理当前的SMB连接。

徽章

杰里米

我想要得到rest api的开放连接数

我可以继续调查了,谢谢,D

回复


Learn more about our cookies.<\/a>","cookiepolicy.button":"Accept cookies","cookiepolicy.button.deny":"Deny all","cookiepolicy.link":"Cookie settings","cookiepolicy.modal.title":"Cookie settings","cookiepolicy.modal.content":"We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.<\/a>","cookiepolicy.modal.level1":"Basic
Functional","cookiepolicy.modal.level2":"Normal
Functional + analytics","cookiepolicy.modal.level3":"Complete
Functional + analytics + social media + embedded videos"}}}">
Baidu