python 使用wsman控制dell服务器

安装

pip install wsman
yum install -y wsmancli

简单实例

from wsman import WSMan
from wsman.provider.remote import Remote
from wsman.transport.process import Subprocess

wsman = WSMan(transport=Subprocess())
remote = Remote(host, user, passwd)
refs = wsman.enumerate_keys("DICIM_ComputerSystem", "root/dcim", remote=remote)

for ref in refs:
    resp = wsman.get(ref, "", remote=remote)
    print(dict(zip(resp.keys, resp.values)))

硬件系统信息

...
refs = wsman.enumerate_keys("DICIM_ComputerSystem", "root/dcim", remote=remote)
...
  • DICIM_ComputerSystem

  • DCIM_iDRACCardView

  • DCIM_FanView

  • DCIM_PowerSupplyView

  • DCIM_CPUView

  • DCIM_MemoryView

  • DCIM_NICView

  • DCIM_PhysicalDiskView

Last updated

Was this helpful?