Número del artículo: 000145895
wsman invoke -a EnumerateClassNames --hostname=test_host --port=5985 --username=abc --password=password http://schemas.openwsman.org/wbem/wscim/1/instrinsic --namespace=root/cimv2
<s:Body> <n1:EnumerateClassNames> <n1:name>root/cimv2:CIM_Service</n1:name> <n1:name>root/cimv2:Syslog_RecordInLog</n1:name> <n1:name>root/cimv2:Linux_SambaValidUsersForShare</n1:name> <n1:name>root/cimv2:Linux_BaseBoard</n1:name> <n1:name>root/cimv2:Linux_SambaForceUserForShare</n1:name> <n1:name>root/cimv2:Linux_Processor</n1:name> <n1:name>root/cimv2:CIM_RecordForLog</n1:name> <n1:name>root/cimv2:Linux_SambaShareForService</n1:name> <n1:name>root/cimv2:Linux_SambaServiceConfigurationForService</n1:name> <n1:name>root/cimv2:Linux_SambaHostsForService</n1:name> <n1:name>root/cimv2:Linux_SambaForceUserForGlobal</n1:name> <n1:name>root/cimv2:CIM_OSProcess</n1:name> <n1:name>root/cimv2:CIM_RunningOS</n1:name>...................
输出如上所示,表明在命名空间 root/cimv2 中,Linux_Processor 是已注册的类之一。当您在 root/cimv2 命名空间中注册新类时,会有许多 CIM 类继承下来,而且上述命令也将列出所有这些类的名称。通常,您可以忽略所有带 CIM_ 前缀的类。所有带 Linux_ 前缀的类都是由 Linux 系统上安装的提供程序注册的类。在使用戴尔的 idrac 时,您将主要对带 DCIM_ 前缀的类感兴趣。
wsman invoke -a GetClass --hostname=test_host --port=5985 --username=abc --password=password http://schemas.openwsman.org/wbem/wscim/1/intrinsic/Linux_Processor --namespace=root/cimv2
以上命令将列出在 Linux_Processor 中本地定义的所有属性。这意味着当前实现中没有列出从其他 CIM_* 类继承的任何属性。通常,从类的定义中,您就可以知道类中定义了哪些方法,需要将哪些参数传递给这些方法,以及类的哪些属性是关键属性等。但是,由于上述命令只返回本地属性,因此无法确定类中的关键属性。这目前同样是 wsmancli 中的实现的某个局限性。
wsman enumerate -M epr http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor -h test_host-P 5985 -u abc -p password -O out <?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <s:Header> <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To> <wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse</wsa:Action> <wsa:RelatesTo>uuid:ca52c9e9-cd47-1d47-8003-a52924d9bed4</wsa:RelatesTo> <wsa:MessageID>uuid:ca622bb3-cd47-1d47-8097-a52924d9bed4</wsa:MessageID> </s:Header> <s:Body> <wsen:PullResponse> <wsen:EnumerationContext>ca4fdd21-cd47-1d47-8095-a52924d9bed4</wsen:EnumerationContext> <wsen:Items> <wsa:EndpointReference> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address> <wsa:ReferenceParameters> <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor</wsman:ResourceURI> <wsman:SelectorSet> <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector> <wsman:Selector Name="SystemCreationClassName">Linux_ComputerSystem</wsman:Selector> <wsman:Selector Name="SystemName">localhost.localdomain</wsman:Selector> <wsman:Selector Name="CreationClassName">Linux_Processor</wsman:Selector> <wsman:Selector Name="DeviceID">0</wsman:Selector> </wsman:SelectorSet> </wsa:ReferenceParameters> </wsa:EndpointReference> </wsen:Items> </wsen:PullResponse> </s:Body> </s:Envelope>
以上输出只有目标系统的所有处理器中的一个处理器的输出。在输出中,resourceURI 列示为 http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor,而 SelectorSet 列出了 __cimnamespace、SystemCreationClassName、SystemName、CreationClassName 和 DeviceID 的值。这意味着,在 Linux_Processor 类的所有继承和本地定义的属性中,这些属性可用于唯一地标识实例。
wsman get http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor?SystemCreationClassName="Linux_ComputerSystem",SystemName="localhost.localdomain",CreationClassName="Linux_Processor",DeviceID="3",__cimnamespace="root/cimv2" -h test_host -P 5985 -u abc -p password -O get
如果上述请求中使用了其他任何属性,则后端的 CIMOM 将无法唯一地标识实例。同样,如果有一些需要在实例中运行的自定义方法,则可以使用类的 EPR 来标识用于调用方法的关键属性。
wsman enumerate -M epr http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_CSProcessor -h test_host -P 5985 -u abc -p password -O out <?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <s:Header> <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To> <wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse</wsa:Action> <wsa:RelatesTo>uuid:2efbfcad-cd4b-1d4b-8003-a52924d9bed4</wsa:RelatesTo> <wsa:MessageID>uuid:2efc1c6f-cd4b-1d4b-80b3-a52924d9bed4</wsa:MessageID> </s:Header> <s:Body> <wsen:PullResponse> <wsen:EnumerationContext>2ef7f6f5-cd4b-1d4b-80b1-a52924d9bed4</wsen:EnumerationContext> <wsen:Items> <wsa:EndpointReference> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address> <wsa:ReferenceParameters> <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_CSProcessor</wsman:ResourceURI> <wsman:SelectorSet> <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector> <wsman:Selector Name="GroupComponent"> <wsa:EndpointReference> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address> <wsa:ReferenceParameters> <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_ComputerSystem</wsman:ResourceURI> <wsman:SelectorSet> <wsman:Selector Name="CreationClassName">Linux_ComputerSystem</wsman:Selector> <wsman:Selector Name="Name">localhost.localdomain</wsman:Selector> <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector> </wsman:SelectorSet> </wsa:ReferenceParameters> </wsa:EndpointReference> </wsman:Selector> <wsman:Selector Name="PartComponent"> <wsa:EndpointReference> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address> <wsa:ReferenceParameters> <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor</wsman:ResourceURI> <wsman:SelectorSet> <wsman:Selector Name="SystemCreationClassName">Linux_ComputerSystem</wsman:Selector> <wsman:Selector Name="SystemName">localhost.localdomain</wsman:Selector> <wsman:Selector Name="CreationClassName">Linux_Processor</wsman:Selector> <wsman:Selector Name="DeviceID">0</wsman:Selector> <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector> </wsman:SelectorSet> </wsa:ReferenceParameters> </wsa:EndpointReference> </wsman:Selector> </wsman:SelectorSet> </wsa:ReferenceParameters> </wsa:EndpointReference> </wsen:Items> </wsen:PullResponse> </s:Body> </s:Envelope>Linux_CSProcessor 是 Linux_ComputerSystem 类和 Linux_Processor 类之间的关联,建立了处理器包含在计算机系统中的关系,因此 GroupComponent 和 PartComponent 部分也是如此。
Ubuntu Server LTS
11 jun 2024
4
Solution