InTouch Hub · Blue Isle Software

Prometheus

Run PromQL instant and range queries against a Prometheus server, and list series metadata via the Prometheus HTTP API v1.

prometheusmonitoringmetricspromql

Prometheus

Run PromQL instant and range queries against a Prometheus server, and list label names or series metadata — all via the Prometheus HTTP API v1.

Operations

Operation Endpoint Description
instant_query GET /api/v1/query Evaluate a PromQL expression at a single point in time
range_query GET /api/v1/query_range Evaluate a PromQL expression over a time range (returns a matrix)
list_labels GET /api/v1/labels List all label names known to Prometheus, optionally filtered by selector and time range
list_series GET /api/v1/series Find all series matching one or more selector strings

Authentication

Prometheus itself has no built-in authentication. When your Prometheus instance is protected by a reverse proxy (e.g. Grafana Cloud, nginx with Basic Auth middleware, or a JWT gateway), pass a Bearer token in the apiKey field. It is sent as:

Authorization: Bearer <apiKey>

For unauthenticated Prometheus instances on a private network, leave apiKey blank.

Inputs

Field Required Description
serverUrl Yes Base URL of the Prometheus server, e.g. http://prometheus.example.com:9090. No trailing slash.
operation Yes One of the four operations above.
apiKey No Bearer token for reverse-proxy-protected instances. Leave blank for open servers.
query For instant_query, range_query PromQL expression, e.g. up or rate(http_requests_total[5m]).
time No Evaluation timestamp for instant_query. RFC 3339 or UNIX epoch seconds. Defaults to server's current time.
start For range_query Range start. RFC 3339 or UNIX epoch seconds.
end For range_query Range end. RFC 3339 or UNIX epoch seconds.
step For range_query Resolution step, e.g. 15s, 1m, or 300.
match For list_series (required); list_labels (optional) Comma-separated series selectors, e.g. up,{job="prometheus"}.
timeout No Server-side evaluation timeout, e.g. 30s.

Outputs

Field Description
result Full JSON response body from Prometheus (the data field contains the query result).
status HTTP status code as a string (e.g. 200).
truncated Present and set to "true" if the response was truncated at 5 MB.

Examples

Check which targets are up (instant query)

- name: check_targets
  tool: prometheus
  input:
    serverUrl: "http://prometheus.example.com:9090"
    operation: instant_query
    query: "up"

CPU usage over the last hour (range query)

- name: cpu_usage
  tool: prometheus
  input:
    serverUrl: "http://prometheus.example.com:9090"
    operation: range_query
    query: "100 - (avg by(instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)"
    start: "2024-01-15T11:00:00Z"
    end: "2024-01-15T12:00:00Z"
    step: "1m"

List all label names

- name: labels
  tool: prometheus
  input:
    serverUrl: "http://prometheus.example.com:9090"
    operation: list_labels

Find all series for a specific job

- name: series
  tool: prometheus
  input:
    serverUrl: "http://prometheus.example.com:9090"
    operation: list_series
    match: "{job=\"node_exporter\"}"

Grafana Cloud (authenticated)

- name: gf_query
  tool: prometheus
  input:
    serverUrl: "https://prometheus-prod-01-eu-west-0.grafana.net"
    apiKey: "glc_eyJ..."
    operation: instant_query
    query: "up"

Notes