Skip to main content

Inventory Metric

RetrieveThe Inventory Metric API provides endpoints for retrieving and viewmonitoring various metrics related to your inventory metricsitems. These endpoints allow you to monitor systemaccess performance data, usage statistics, and resourceoperational utilization.metrics for devices and resources in your inventory system. Perfect for building dashboards, monitoring systems, and generating reports.

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

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Overview

The Inventory Metric API category enables you to access comprehensive metrics and analytical data about your inventory items. These endpoints are designed to help you monitor performance, track usage patterns, analyze trends, and generate insights about your inventory resources.

Key Features:

    Retrieve metrics for all inventory items with filtering capabilities Access detailed metric data for specific items Filter results by metric names to focus on specific KPIs Paginate through large datasets efficiently

    Common Metric Types:

      CPU utilization and performance metrics Memory usage statistics Network throughput and connectivity data Storage capacity and usage Uptime and availability metrics Error rates and system health indicators

      These endpoints work together to provide a complete view of your inventory performance - use the list endpoint to get an overview and identify items of interest, then drill down with the detail endpoint for comprehensive metric analysis.


      Endpoints

      GET /inventory_metric/

      RetrieveDescription: Retrieves a paginated list of all inventory metrics in your system. This endpoint is essential for getting an overview of metric data across your entire inventory, with optionalpowerful filtering capabilities to narrow down results by metric name.

      Use Cases:

        Building monitoring dashboards that display multiple inventory metrics Generating reports on system performance across all devices Identifying specific metrics by name for focused analysis Implementing automated alerting systems based on metric thresholds

        Full URL Example:

        https://control.zequenze.com/api/v1/inventory_metric/?name=cpu_usage&limit=50&offset=0
        

        Parameters:

        Parameter Type In Required Description
        name string query No Filter results by the metric's 'name'name fieldfield. Useful for finding specific metrics like "cpu_usage", "memory_utilization", or "network_throughput"
        limit integer query No Number of results to return per page (default: 20, max: 100). Use for pagination control
        offset integer query No The initial index from which to return theresults. resultsUse with limit for pagination

        ExamplecURL Request:Example:

        curl -X GET "https://control.zequenze.com/api/v1/inventory_metric/?name=cpu_usage&limit=2025&offset=00" \
          -H "Authorization: Bearer YOUR_API_TOKEN" \
          -H "Content-Type: application/json"
        

        Example Response:

        {
          "count": 45,147,
          "next": "https://control.zequenze.com/api/v1/inventory_metric/?limit=2025&offset=20"25",
          "previous": null,
          "results": [
            {
              "id": 1,
              "name": "cpu_usage",
              "device_id": 42,
              "device_name": "web-server-01",
              "metric_type": "performance",
              "value": 78.5,
              "unit": "percent",
              "timestamp": "2023-10-15T14:2024-01-15T10:30:00Z",
              "device_id": 123,
              "description"status": "CPUnormal",
              utilization"threshold_warning": percentage"80.0,
              "threshold_critical": 95.0
            },
            {
              "id": 2,
              "name": "memory_usage"memory_utilization",
              "device_id": 42,
              "device_name": "web-server-01",
              "metric_type": "performance",
              "value": 4.6.2,
              "unit": "GB",
              "timestamp": "2023-10-15T14:2024-01-15T10:30:00Z",
              "status": "normal",
              "threshold_warning": 7.0,
              "threshold_critical": 7.8
            },
            {
              "id": 3,
              "name": "network_throughput",
              "device_id": 124,43,
              "description"device_name": "Memorydatabase-server-01",
              usage"metric_type": in"network",
              gigabytes""value": 125.7,
              "unit": "Mbps",
              "timestamp": "2024-01-15T10:29:45Z",
              "status": "normal",
              "threshold_warning": 800.0,
              "threshold_critical": 950.0
            }
          ]
        }
        

        Response Codes:

        Status Description
        200 Success - Returns the paginated list of inventory metrics
        401 Unauthorized - Invalid or missing Bearer token
        400 Bad Request - Invalid query parameters

        GET /inventory_metric/{id}/

        RetrieveDescription: Retrieves detailed information forabout a specific inventory metric by its unique ID. This endpoint provides comprehensive metric data including historical values, configuration details, and related device information.

        Use Cases:

          Displaying detailed metric information in monitoring interfaces Retrieving specific metric data for analysis and reporting Getting current values and thresholds for alerting systems Accessing historical trend data for a particular metric

          Full URL Example:

          https://control.zequenze.com/api/v1/inventory_metric/1/?name=cpu_usage
          

          Parameters:

          Parameter Type In Required Description
          id integer path Yes The unique identifier of the inventory metric to retrieve
          name string query No FilterAdditional filter by metric'smetric 'name'name fieldfor validation or cross-referencing

          ExamplecURL Request:Example:

          curl -X GET "https://control.zequenze.com/api/v1/inventory_metric/1/?name=cpu_usage" \
            -H "Authorization: Bearer YOUR_API_TOKEN" \
            -H "Content-Type: application/json"
          

          Example Response:

          {
            "id": 1,
            "name": "cpu_usage",
            "value"device_id": 42,
            "device_name": "web-server-01",
            "device_type": "server",
            "organization": "Production",
            "metric_type": "performance",
            "description": "CPU utilization percentage for web server",
            "current_value": 78.5,
            "unit": "percent",
            "timestamp"last_updated": "2023-10-15T14:2024-01-15T10:30:00Z",
            "device_id": 123,
            "device_name"status": "server-01",
            "description": "CPU utilization percentage"normal",
            "threshold_warning": 80.0,
            "threshold_critical": 95.0,
            "status"collection_interval": 60,
            "retention_days": 90,
            "historical_data": [
              {
                "timestamp": "normal"2024-01-15T10:29:00Z",
                "tags"value": 76.2
              },
              {
                "timestamp": "2024-01-15T10:28:00Z",
                "value": 74.8
              },
              {
                "timestamp": "2024-01-15T10:27:00Z",
                "value": 79.1
              }
            ],
            "alerts": [
              {
                "performance"id": 101,
                "type": "warning",
                "system"triggered_at": "2024-01-15T09:45:00Z",
                "message": "CPU usage approaching warning threshold"
              }
            ],
            "created_at": "2024-01-01T00:00:00Z",
            "updated_at": "2024-01-15T10:30:00Z"
          }
          

          Response Codes:

          Status Description
          200 Success - Returns the detailed metric information
          401 Unauthorized - Invalid or missing Bearer token
          404 Not Found - Metric with specified ID does not foundexist
          403 Forbidden - Access denied to this metric

          Common Use Cases

          Use Case 1: Building a Real-time Monitoring Dashboard

          Combine both endpoints to create a comprehensive monitoring dashboard. Use the list endpoint to get an overview of all metrics, then drill down into specific metrics using the detail endpoint for charts and detailed analysis.

          Use Case 2: Automated Performance Alerting

          Regularly poll the list endpoint filtered by specific metric names (like cpu_usage or memory_utilization) to check current values against thresholds and trigger alerts when necessary.

          Use Case 3: Historical Performance Analysis

          Use the detail endpoint to access historical data for specific metrics, enabling trend analysis and capacity planning based on past performance patterns.

          Use Case 4: Custom Reporting and Analytics

          Filter metrics by name and combine data from multiple devices to generate custom reports on system performance, resource utilization, and operational efficiency.

          Use Case 5: Inventory Health Assessment

          Systematically retrieve metrics across your entire inventory to assess overall system health and identify devices or resources that may need attention.


          Best Practices

          • Use Pagination Effectively: For large inventories, always use the limit parameter to control response size and implement proper pagination using the offset parameter
          Filter by Metric Name: When you need specific types of metrics, always use the name parameter to filterreduce metricsresponse bysize typeand (e.g.,improve cpu_usage, memory_usage, disk_space)performance Cache Responses: Implement pagination using limit and offset parameterscaching for large metric datasets Monitor API response times when retrieving metrics for multiple devices Cache metric data appropriatelythat doesn't change frequently to avoid excessivereduce API calls and improve application performance Consider Handle Rate Limits: Implement exponential backoff and respect any rate limiting to ensure reliable access to the timestampAPI field Monitor Response Times: For real-time dashboards, consider the refresh frequency needed versus API performance to provide optimal user experience Error Handling: Always implement proper error handling for 404 responses when analyzingaccessing metricspecific trendsmetrics, overas timedevices may be removed or metrics may be discontinued Use theBatch thresholdProcessing: fieldsWhen toanalyzing implementmultiple alertingmetrics, basedconsider onbatching requests and processing them efficiently rather than making individual calls for each metric values