Getting the status of a hypervisor inventory job¶
You can get status information about a currently running inventory job and the previous one.
Method and URI¶
To get information about the present and previous hypervisor inventory jobs, use a GET method and a URI, where {jobId}
is the ID for the hypervisor inventory job:
GET https://{hostname|IP}/endeavour/job/{jobId}
Parameters¶
None.
Example: Get status of a hypervisor inventory job¶
Assume that the {jobId}
of the hypervisor inventory job is 1003.
A Python snippet that is similar to the following example can be used to get status information about the present and previous hypervisor inventory job:
job_id = "1003" # Hypervisor Inventory
requests.get('https://' + spp_ipv4 + '/api/endeavour/job/' + job_id,
headers={...}, verify=...)
Assume that you ran an inventory job for virtualized systems and send the request to see the status of it. Normally, the inventory job takes a few minutes to complete and so you should see the running status. In your browser, the blue Run Inventory button has been grayed out and reading Inventory In Progress. Here is an example response with the HTTP status code of 200 (OK).
{
"links": {...},
"name": "Hypervisor Inventory",
"description": null,
"policyId": "1003",
"policyName": "Hypervisor Inventory",
"type": "catalog",
"typeDisplayName": "Catalog",
"subType": "hypervisor",
"subTypeDisplayName": "Hypervisor",
"serviceId": "serviceprovider.catalog.hypervisor",
"displayName": "Hypervisor Inventory",
"status": "RUNNING",
"statusDisplayName": "Running",
"lastSessionStatus": "PARTIAL",
"lastSessionStatusDisplayName": "Partial",
"triggerIds": [
"1003"
],
"triggerData": [
{
"triggerId": "1003",
"triggerInfo": null
}
],
"lastRunTime": 1578679221737,
"nextFireTime": 1578729600000,
"lastSessionDuration": 685498,
"tenantId": 1000,
"actions": null,
"statistics": null,
"lastrun": {
"sessionId": "1578679221158",
"jobName": "Hypervisor Inventory",
"type": "catalog",
"subType": "hypervisor",
"serviceId": "serviceprovider.catalog.hypervisor",
"start": 1578679221737,
"end": 1578679907235,
"duration": 685498,
"status": "PARTIAL",
"results": "Started",
"properties": null,
"numTasks": 4,
"previousLastTask": 0,
"lastUpdate": 1578679907240,
"percent": 100,
"policySnapshot": null
},
"id": "1003"
}
In the example response above, the status
value reads RUNNING
which means the hypervisor inventory job was running at the time you sent the request. You can also see the information about the previous hypervisor inventory job.
A few minutes later, you send the same request again to see the status. At this time, the button in the browser comes back to the original, blue Run Inventory button. Here is an example response with the HTTP status code 200 (OK). As you see, the status
value reads IDLE
.
{
"links": {...},
...
"status": "IDLE",
"statusDisplayName": "Idle",
"lastSessionStatus": "PARTIAL",
"lastSessionStatusDisplayName": "Partial",
"triggerIds": [
"1003"
],
"triggerData": [
{
"triggerId": "1003",
"triggerInfo": null
}
],
"lastRunTime": 1578681060744,
"nextFireTime": 1578729600000,
"lastSessionDuration": 529178,
"tenantId": 1000,
"actions": null,
"statistics": null,
"lastrun": {...},
...
}
Restriction: Do not determine the status of the hypervisor inventory jobs by referring to the HTTP status code in a response. This request will generate a response with the HTTP status code of 200 (OK) regardless of the status. Instead, refer to the relevant key-value pairs in the response to check the status.