Skip to main content

Read diagnostics

Diagnostics list the source records Census excluded and the values it could not use, each with the source reference needed to find and fix it in the source system. An administrator uses them after a configuration change; a consumer uses them to understand why an inventory is incomplete or why a field is null.

curl -s 'localhost:8080/v1/inventories/devices/diagnostics?kind=unmapped&kind=duplicate_hfid'
{
"items": [
{ "kind": "duplicate_hfid", "contribution": "infrahub", "hfid": "fw-01",
"source_ref": "1808d32d-a503-701a-d0eb-c51654327f06",
"native_id": "1808d32d-a503-701a-d0eb-c51654327f06", "object_type": "InfraDevice",
"references": [ … ] },
{ "kind": "unmapped", "contribution": "netbox", "hfid": "sw-07", "field": "status",
"original": "retired", "path": "status.value",
"source_ref": "https://netbox.example.net/api/dcim/devices/9/", "native_id": "9",
"object_type": "dcim/devices", "references": [ … ] }
],
"total": 2,
"next_cursor": null
}

Kinds of diagnostics​

kindWhat it reportsMakes the inventory incomplete
missing_hfidA record with no HFID. It takes no part in any entity.Yes
duplicate_hfidA record that shares its HFID with another record of the same contribution. Both take no part in that entity.Yes
unmappedA value with no mapping in the field's vocabulary, and no default. Also a location that matches no declared location, with the field location.No
wrong_typeA value whose JSON type is not the field's type.No
ambiguous_locationA location that matches several declared locations.No

field, original and path are present for value diagnostics. For a location, original holds the name of each level and path lists the path of each level, for example rack=rack.name,site=site.slug.

source_ref identifies the source object: the NetBox API URL, or the Infrahub node id. object_type is the NetBox API path or the Infrahub node kind, and references lists the links to the object, as in full detail.

Parameters​

ParameterMeaning
kindOnly these kinds. Repeat it for several. Default: every kind.
contributionOnly this contribution's records.
branchDiagnostics of a branch view.
limitPage size, 1 to 1,000. Default 100.
cursorThe next_cursor of the previous page.

An unknown kind, or a contribution the inventory does not have, returns 400 invalid-query.

Fix what diagnostics report​

kindFix
missing_hfid, duplicate_hfidCorrect the HFID field of the object in the source. The next refresh or webhook makes the record eligible again.
unmappedAdd the value to the contribution's values table, or to the field's vocabulary, and restart Census. Census recomputes the inventory from stored data.
wrong_typeCorrect the value in the source, or change the field's type or the source path.
ambiguous_locationMap more levels in the contribution's location table, so that the source's names match one location.