Grafana Query
Type ID: grafanaQuery · Kind: Action · Ports: 1 in, 1 out
Run ad-hoc queries against a Grafana data source.
Credentials
Grafana (Service Account Token)
{
"credentials": {
"name": "grafana",
"id": "<credential-id>"
}
}
Resources & operations
- Query (
query)- Query Data Source (
queryDataSource) - Run an ad-hoc query against a configured Grafana data source
- Query Data Source (
For agent integrations (name: 'grafanaQuery' in permissions.integrations), grant '*', a resource key, or an operation key — see Tools and Permissions:
Resource key (<resource>) | Operation keys (<resource>.<operation>) |
|---|---|
query | query.queryDataSource |
Properties
Common
| Property | Key | Type | Required | Default | Possible values | Applies when |
|---|---|---|---|---|---|---|
| Resource | resource | options | Yes | query | Query (query) | - |
| Operation | operation | options | Yes | queryDataSource | Query Data Source (queryDataSource) | resource = query |
Query → Query Data Source
| Property | Key | Type | Required | Default | Possible values | Applies when |
|---|---|---|---|---|---|---|
| Data Source UID | datasourceUid | string | Yes | '' | UID of the Grafana data source to query (e.g. a Prometheus or PostgreSQL data source already configured in Grafana) | resource = query, operation = queryDataSource |
| Query | query | json | Yes | {} | Data-source-specific query object merged into the request target, for example { "expr": "up", "refId": "A" } for Prometheus or { "rawSql": "select 1", "refId": "A" } for SQL sources | resource = query, operation = queryDataSource |
| From | from | string | No | now-1h | Range start, Grafana time syntax (e.g. now-1h) or epoch millis string | resource = query, operation = queryDataSource |
| To | to | string | No | now | Range end, Grafana time syntax (e.g. now) or epoch millis string | resource = query, operation = queryDataSource |
Notes
- Query Data Source output:
{ results, raw }.