Skip to main content
Monitoring & Collection/Monitoring Query & Overview
POSTMonitoringSince 1.0SynchronousAuth Required

BuildQuery

Build a structured monitoring query from field-level parameters and return the rendered PromQL and SQL-like forms

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • metricStringRequired

    Metric name to query

    Example: cpu_usage_percent

  • filtersLinkedHashMapRequired

    Filter criteria to narrow down results

    Example: (nested object)

  • conditionStringRequired

    Filter condition expression

    Example: resource_type='vm'

  • timeRangeStringRequired

    Query time range (e.g. 1h, 24h)

    Example: 1h

  • aggregationStringRequired

    Aggregation function to apply

    Example: avg

Responses

200 OK

On success, this API returns the following response structure.

  • sqlLikeString

    SQL-like representation of the built query

    Example: SELECT avg(cpu_usage_percent) FROM metrics WHERE resource_type='vm'

  • promqlString

    PromQL representation of the built query

    Example: avg(cpu_usage_percent{resource_type="vm"})

  • validBoolean

    Whether the query passed validation

    Example: true

  • errorString

    Validation error message if the query is invalid

    Example: connection refused

Endpoint

POST/api/v1/monitoring/query-builder/build

/api/v1/monitoring/query-builder/build

Operation ID

BuildQuery

Permalink

Request Example

curl -X POST '{host}/api/v1/monitoring/query-builder/build' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"metric":"cpu_usage_percent","filters":"(nested object)","condition":"resource_type='vm'","timeRange":"1h","aggregation":"avg","groupBy":"item1,item2"}'

Response Example

200
{
  "sqlLike": "SELECT avg(cpu_usage_percent) FROM metrics WHERE resource_type='vm'",
  "promql": "avg(cpu_usage_percent{resource_type=\"vm\"})",
  "valid": true,
  "error": "connection refused"
}

Change History

This API has no change history records yet.

View all change history