Skip to main content

Inventory Metric Log

The Inventory Metric Log API endpoints provide access to historical metric data collected from devices in your inventory. These endpoints allow you to retrieve and filter metric logs to analyze device performance, monitor trends, and generate reports based on collected measurement data.

Base URL: https://control.zequenze.com/api/v1

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Overview

The Inventory Metric Log API category provides comprehensive access to historical metric data collected from your inventory devices. These endpoints are essential for monitoring device performance, analyzing trends, and generating detailed reports based on collected measurement data.

Key Concepts:

  • Metric Logs: Historical records of measurements taken from devices, including values, timestamps, and metadata
  • Device Association: Each metric is linked to a specific device in your inventory
  • Parameter Tracking: Metrics are organized by parameters (what is being measured) with support for multiple naming conventions
  • Origin Tracking: Each metric entry records how the data was collected (automatic, manual, API, etc.)

Common Use Cases:

  • Performance monitoring and trend analysis
  • Historical data retrieval for reporting
  • Device health assessments
  • Compliance auditing and data validation
  • Integration with monitoring dashboards and alerting systems

The API supports powerful filtering capabilities to help you retrieve exactly the data you need, with pagination for handling large datasets efficiently.


Endpoints

GET /inventory_metric_log/

Description: Retrieves a paginated list of inventory metric logs with comprehensive filtering options. This endpoint is ideal for querying historical metric data across multiple devices and parameters, making it perfect for dashboard creation, trend analysis, and bulk data exports.

Use Cases:

  • Building monitoring dashboards with historical data
  • Generating performance reports for specific time periods
  • Analyzing device trends across multiple parameters
  • Exporting metric data for external analysis tools
  • Creating alerts based on historical patterns

Full URL Example:

https://control.zequenze.com/api/v1/inventory_metric_log/?datetime__gte=2024-01-01&device__name=server-01&limit=50

Parameters:

Parameter Type In Required Description
datetime__gte string query No Filter metrics from this date/time onwards. Supports ISO format: 2000-01-01, 2000-01-01 00:01:00, 2000-01-01 00:01:00+00:00
datetime__lte string query No Filter metrics up to this date/time. Supports ISO format: 2000-01-01, 2000-01-01 00:01:00, 2000-01-01 00:01:00+00:00
device__name string query No Filter metrics by device name
metric__name string query No Filter by metric name
parameter__name string query No Filter by parameter name
parameter__short_name string query No Filter by parameter short name
parameter__variable_name string query No Filter by parameter variable name
cursor string query No Pagination cursor for retrieving next page of results
limit integer query No Number of results per page (recommended: 50-100 for optimal performance)
metric_name string query No Alternative filter for metric parameter name
parameter_name string query No Alternative filter for metric parameter name

cURL Example:

curl -X GET "https://control.zequenze.com/api/v1/inventory_metric_log/?datetime__gte=2024-01-01T00:00:00Z&device__name=web-server-01&parameter__name=cpu_usage&limit=100" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Example Response:

{
  "next": "https://control.zequenze.com/api/v1/inventory_metric_log/?cursor=eyJkYXRldGltZSI6IjIwMjQtMDEtMTVUMTA6MzA6MDBaIiwiaWQiOjEwMH0%3D",
  "previous": null,
  "results": [
    {
      "id": 1245,
      "datetime": "2024-01-15T10:30:00Z",
      "device_name": "web-server-01",
      "parameter_name": "CPU Usage",
      "metric_name": "cpu_usage",
      "origin": "au",
      "value": 85.7,
      "result": 85.7,
      "original_value": "85.7%"
    },
    {
      "id": 1244,
      "datetime": "2024-01-15T10:25:00Z",
      "device_name": "web-server-01",
      "parameter_name": "Memory Usage",
      "metric_name": "memory_usage",
      "origin": "au",
      "value": 72.3,
      "result": 72.3,
      "original_value": "72.3%"
    },
    {
      "id": 1243,
      "datetime": "2024-01-15T10:20:00Z",
      "device_name": "web-server-01",
      "parameter_name": "Disk Usage",
      "metric_name": "disk_usage",
      "origin": "sc",
      "value": 45.8,
      "result": 45.8,
      "original_value": "45.8 GB"
    }
  ]
}

Response Codes:

Status Description
200 Success - Returns paginated metric log data
401 Unauthorized - Invalid or missing API token
400 Bad Request - Invalid query parameters or date format
429 Too Many Requests - Rate limit exceeded

GET /inventory_metric_log/{id}/

Description: Retrieves a specific inventory metric log entry by its unique ID. This endpoint provides detailed information about a single metric measurement, including all metadata and filtering capabilities for related queries.

Use Cases:

  • Investigating specific metric anomalies or alerts
  • Retrieving detailed information for audit trails
  • Accessing specific measurements for debugging purposes
  • Building drill-down interfaces from summary views

Full URL Example:

https://control.zequenze.com/api/v1/inventory_metric_log/1245/

Parameters:

Parameter Type In Required Description
id integer path Yes Unique identifier of the metric log entry
datetime__gte string query No Additional filter by datetime (greater than or equal)
datetime__lte string query No Additional filter by datetime (less than or equal)
device__name string query No Additional filter by device name
metric_name string query No Additional filter by parameter name
parameter_name string query No Additional filter by parameter name
parameter__variable_name string query No Additional filter by parameter variable name

cURL Example:

curl -X GET "https://control.zequenze.com/api/v1/inventory_metric_log/1245/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Example Response:

{
  "id": 1245,
  "datetime": "2024-01-15T10:30:00Z",
  "device_name": "web-server-01",
  "parameter_name": "CPU Usage",
  "metric_name": "cpu_usage",
  "origin": "au",
  "value": 85.7,
  "result": 85.7,
  "original_value": "85.7%"
}

Response Codes:

Status Description
200 Success - Returns the specific metric log entry
401 Unauthorized - Invalid or missing API token
404 Not Found - Metric log entry with specified ID does not exist
403 Forbidden - Access denied to this metric log entry

Common Use Cases

Use Case 1: Performance Monitoring Dashboard

Retrieve recent CPU and memory metrics for all web servers to display current system health status.

Approach: Use the list endpoint with device name filtering and datetime range to get recent metrics across multiple parameters.

Use Case 2: Historical Trend Analysis

Generate monthly performance reports by querying metric data for specific time periods and parameters.

Approach: Use datetime filtering with parameter-specific queries to collect data for trend analysis and reporting.

Use Case 3: Anomaly Investigation

Investigate specific performance incidents by examining detailed metric logs around the time of an alert.

Approach: Use the detail endpoint to examine specific metric entries, combined with datetime filtering to see surrounding data points.

Use Case 4: Automated Alerting System

Build monitoring systems that check recent metric values against thresholds and trigger alerts.

Approach: Regularly poll the list endpoint with recent datetime filters and parameter-specific queries to monitor critical metrics.

Use Case 5: Compliance Reporting

Generate audit reports showing metric collection history and data sources for compliance purposes.

Approach: Query metric logs with origin filtering to show how data was collected (automatic vs manual) for audit trails.


Best Practices

Pagination Management:

  • Use reasonable limit values (50-100) to balance performance and data volume
  • Implement cursor-based pagination for consistent results when data changes frequently
  • Store cursor values for resuming interrupted data collection processes

Efficient Filtering:

  • Always use datetime filters to limit query scope and improve performance
  • Combine device and parameter filters to reduce unnecessary data transfer
  • Use specific parameter names rather than broad queries when possible

Error Handling:

  • Implement retry logic for rate limiting (429) responses
  • Handle missing metric entries (404) gracefully in monitoring systems
  • Validate datetime formats before making API calls to avoid 400 errors

Performance Optimization:

  • Cache frequently accessed metric data locally when appropriate
  • Use batch processing for large historical data exports
  • Consider the trade-off between real-time queries and scheduled data collection

Origin Code Reference:

  • au = Automatic (sensor/system generated)
  • ma = Manual (human entered)
  • gu = GUI (web interface)
  • cl = CLI (command line)
  • sc = Script (automated script)
  • ap = API (external system)