Werk #18037: HW/SW Inventory: Add REST-API endpoint for fetching inventory trees
| Component | REST API | ||
| Title | HW/SW Inventory: Add REST-API endpoint for fetching inventory trees | ||
| Date | May 20, 2025 | ||
| Level | Trivial Change | ||
| Class | New Feature | ||
| Compatibility | Compatible - no manual interaction needed | ||
| Checkmk versions & editions |
|
This new endpoint is considered as unstable and might change in the future. It is available at
http[s]://<CHECKMK_SERVER>/<SITE>/check_mk/api/unstable/domain-types/inventory/collections/all.
See the following code template with Python's requests. The variable HOST_NAMES contains the
host names for which inventory trees are fetched.
import pprint
import requests
HOST_NAME = "checkmk_server"
SITE_NAME = "hostname"
PROTO = "http" # [http|https]
API_URL = f"{PROTO}://{HOST_NAME}/{SITE_NAME}/check_mk/api/unstable"
USERNAME = "automation"
PASSWORD = "..."
HOST_NAMES = ["hostname"]
session = requests.session()
session.headers["Authorization"] = f"Bearer {USERNAME} {PASSWORD}"
session.headers["Accept"] = "application/json"
resp = session.get(
f"{API_URL}/domain-types/inventory/collections/all",
params={"host_names": HOST_NAMES},
headers={"Content-Type": "application/json"},
)
if resp.status_code == 200:
pprint.pprint(resp.json())
else:
raise RuntimeError(pprint.pformat(resp.json()))
As soon as it's stable you'll find the documentation in the REST-API documentation below
Monitoring > HW/SW Inventory.
The HW/SW Inventory data contains static data of a host, eg. serial numbers of disks, which can be used for further processing, eg. add entries to CMDBs.
Please have a look at the related HW/SW Inventory documentation.