Inventory Metric
Retrieve and view inventory metrics to monitor system performance and resource utilization.
Base URL: https://control.zequenze.com/api/v1
Authentication: All endpoints require a Bearer token:
Authorization: Bearer <your-api-token>
Endpoints
GET /inventory_metric/
Retrieve a paginated list of inventory metrics with optional filtering by metric name.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| name | string | query | No | Filter by metric's 'name' field |
| limit | integer | query | No | Number of results to return per page |
| offset | integer | query | No | The initial index from which to return the results |
Example Request:
GET /api/v1/inventory_metric/?name=cpu_usage&limit=20&offset=0
Example Response:
{
"count": 45,
"next": "https://control.zequenze.com/api/v1/inventory_metric/?limit=20&offset=20",
"previous": null,
"results": [
{
"id": 1,
"name": "cpu_usage",
"value": 78.5,
"unit": "percent",
"timestamp": "2023-10-15T14:30:00Z",
"device_id": 123,
"description": "CPU utilization percentage"
},
{
"id": 2,
"name": "memory_usage",
"value": 4.2,
"unit": "GB",
"timestamp": "2023-10-15T14:30:00Z",
"device_id": 124,
"description": "Memory usage in gigabytes"
}
]
}
| Status | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized |
GET /inventory_metric/{id}/
Retrieve detailed information for a specific inventory metric by its ID.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | The unique identifier of the inventory metric |
| name | string | query | No | Filter by metric's 'name' field |
Example Request:
GET /api/v1/inventory_metric/1/?name=cpu_usage
Example Response:
{
"id": 1,
"name": "cpu_usage",
"value": 78.5,
"unit": "percent",
"timestamp": "2023-10-15T14:30:00Z",
"device_id": 123,
"device_name": "server-01",
"description": "CPU utilization percentage",
"threshold_warning": 80.0,
"threshold_critical": 95.0,
"status": "normal",
"tags": ["performance", "system"]
}
| Status | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized |
| 404 | Metric not found |
Best Practices
- Use the
nameparameter to filter metrics by type (e.g., cpu_usage, memory_usage, disk_space) - Implement pagination using
limitandoffsetparameters for large metric datasets - Monitor API response times when retrieving metrics for multiple devices
- Cache metric data appropriately to avoid excessive API calls
- Consider the timestamp field when analyzing metric trends over time
- Use the threshold fields to implement alerting based on metric values