mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* clean up all but header incrementing in Creating-Transport.md * make Device-Dependencies.md mdl happy * make Entities.md as mdl happy as possible... one long table line left * make mdl as happy as possible for index.md * clean up Introduction.md as much as possible * minor formatting cleanup... move each icon onto its own row * make ack and notes the same style * clean Macros.md up * clean Rules.md up as much as possible * tweak one line a bit to get it to format a bit nicer * a bit more format tweaking, making sure it does not sure with > * clean up as much as possible for Templates.md * make Testing.md as mdl happy as possibly * clean Transports.md up as much as possible * clean as many issues as possible for Alerts.md * clean up as much of ARP.md as possible * clean up as much as possible for Bills.md * make DeviceGroups.md as mdl happy as possible * cleanup Devices.md * make as mdl happy as possible Inventory.md and index.md * mdl cleanup for Logs.md and PortGroups.md * make Ports.md and Routing.md as happy as possible * clean up Services.md, Switching.md, and Systems.md as much as possible * more markup cleanup * lots more md cleanup udner Devloping/ * reapply bits from #10343 that accidentally got removed when merging
2.2 KiB
2.2 KiB
source: API/Inventory.md path: blob/master/doc/
get_inventory
Retrieve the inventory for a device. If you call this without any parameters then you will only get part of the inventory. This is because a lot of devices nest each component, for instance you may initially have the chassis, within this the ports - 1 being an sfp cage, then the sfp itself. The way this API call is designed is to enable a recursive lookup. The first call will retrieve the root entry, included within this response will be entPhysicalIndex, you can then call for entPhysicalContainedIn which will then return the next layer of results.
Route: /api/v0/inventory/:hostname
- hostname can be either the device hostname or the device id
Input:
- entPhysicalClass: This is used to restrict the class of the inventory, for example you can specify chassis to only return items in the inventory that are labelled as chassis.
- entPhysicalContainedIn: This is used to retrieve items within the inventory assigned to a previous component, for example specifying the chassis (entPhysicalIndex) will retrieve all items where the chassis is the parent.
Example:
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/inventory/localhost?entPhysicalContainedIn=65536
Output:
{
"status": "ok",
"message": "",
"count": 1,
"inventory": [
{
"entPhysical_id": "2",
"device_id": "32",
"entPhysicalIndex": "262145",
"entPhysicalDescr": "Linux 3.3.5 ehci_hcd RB400 EHCI",
"entPhysicalClass": "unknown",
"entPhysicalName": "1:1",
"entPhysicalHardwareRev": "",
"entPhysicalFirmwareRev": "",
"entPhysicalSoftwareRev": "",
"entPhysicalAlias": "",
"entPhysicalAssetID": "",
"entPhysicalIsFRU": "false",
"entPhysicalModelName": "0x0002",
"entPhysicalVendorType": "zeroDotZero",
"entPhysicalSerialNum": "rb400_usb",
"entPhysicalContainedIn": "65536",
"entPhysicalParentRelPos": "-1",
"entPhysicalMfgName": "0x1d6b",
"ifIndex": "0"
}
]
}