Inventorying IMC servers via imcsdk
The 0.9.2.0
release of imcsdk
will add support for inventory
APIs.
The following output formats are supported -
- JSON (default)
- HTML
- CSV
Refer the API documentation for a list of components that can be inventoried. all
fetches inventory for all components.
Usage is shown below,
from imcsdk.apis.server.inventory import get_inventory
# Gets inventory of all components in JSON format
get_inventory(handle=handle)
# Gets inventory for all servers all components in JSON format
get_inventory(handle=[handle1, handle2, handle3])
# Gets inventory of one server all components in JSON format
get_inventory(handle=handle, component="all")
# Gets disks inventory of one server in JSON format
get_inventory(handle=handle, component="disks")
# Gets cpu and disks inventory for one server in JSON format
get_inventory(handle=handle, component=["cpu", "disks"])
# Gets cpu and disks inventory for one server in JSON format and writes to inventory.json file
get_inventory(handle=handle, component=["cpu", "disks"], file_format="json", file_name="inventory.json")
# Gets cpu and disks inventory for one server in CSV format and writes to inventory.csv fie
get_inventory(handle=handle, component=["cpu", "disks"], file_format="csv", file_name="inventory.csv")
# Gets cpu and disks inventory for one server in HTML format and writes to inventory.html
get_inventory(handle=handle, component=["cpu", "disks"], file_format="html", file_name="inventory.html")