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.

Provided free and as is, without warranty of any kind — including merchantability, fitness for a particular purpose, and the accuracy or completeness of any result. See the licence. You are responsible for checking what this produces before relying on it.

agreementdeveloper-devopslevelmetricsmonitoringpromqlservicestatus

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

Publishes

The keys a later task may reference as {{taskName.key}}. Referencing anything not listed here resolves to nothing at run time.

Input Properties

Every property this tool accepts, from its own tool.iml.

Property Type Required Default Description
serverUrl string yes Base URL of the Prometheus server, e.g. http://prometheus.example.com:9090. Must not include the /api/v1 path.
operation string yes One of: instant_query, range_query, list_labels, list_series
apiKey string no DEPRECATED — bind an API Key credential to the task with credentialName instead. A key pasted here is stored in the workflow definition in clear and appears in every export of it. Still honoured for workflows built before the change.
query string no PromQL expression. Required for instant_query and range_query, e.g. 'up' or 'rate(http_requests_total[5m])'.
time string no Evaluation timestamp for instant_query. RFC 3339 string or UNIX epoch seconds, e.g. '2024-01-15T12:00:00Z' or '1705312800'. Defaults to the server's current time when blank.
start string no Start of the time range for range_query. RFC 3339 or UNIX epoch seconds. Required for range_query.
end string no End of the time range for range_query. RFC 3339 or UNIX epoch seconds. Required for range_query.
step string no Query resolution step width for range_query. Duration string or float seconds, e.g. '15s', '1m', '300'. Required for range_query.
match string no Comma-separated series selectors for list_series, e.g. 'up,{job="prometheus"}'. Required for list_series. Also optionally filters list_labels results.
timeout string no Evaluation timeout for the Prometheus server (not the network timeout), e.g. '30s'. Optional.