# Prometheus

> Query your Prometheus metrics with PromQL, now or over a time range, and check its alerts, rules and scrape targets. Start a workflow when an alert starts firing.

App · 8 actions. Web page: https://docs.lodol.com/docs/integrations/prometheus

## Actions

### Find series

List the series that match a selector, with all their labels, optionally only those seen within a time range.

**Inputs**

- Selector (`match`, text, required): A series selector, such as up{job="node"}.
- Seen after (`start`, date and time): Only series with data after this moment.
- Seen before (`end`, date and time): Only series with data before this moment.
- Limit (`limit`, number): The most to return. Defaults to 100. From 1 to 1000.

**Outputs**

- `count` (number): How many series were returned
- `has_more` (true/false): True when more series match than the limit
- `match` (text): The selector
- `series` (list): The matching series' labels

**Example output**

```json
{
  "count": 1,
  "has_more": false,
  "match": "up",
  "series": [
    {
      "__name__": "up",
      "instance": "localhost:9090",
      "job": "prometheus"
    }
  ]
}
```

### Get label values

List the values a label takes, such as every job or instance, optionally only on series matching a selector.

**Inputs**

- Label (`label`, text, required): The label, such as job or instance.
- Only on series (`match`, text): A series selector, such as up{job="node"}. Leave empty for all series.
- Limit (`limit`, number): The most to return. Defaults to 100. From 1 to 1000.

**Outputs**

- `count` (number): How many values were returned
- `has_more` (true/false): True when it has more values than the limit
- `label` (text): The label
- `values` (list): Its values, in order

**Example output**

```json
{
  "count": 2,
  "has_more": false,
  "label": "job",
  "values": [
    "node",
    "prometheus"
  ]
}
```

### Get metric info

Get a metric's type (counter, gauge, histogram or summary), unit and help text, or list them for every metric.

**Inputs**

- Metric (`metric`, text): The metric. Leave empty to list every metric.
- Limit (`limit`, number): The most to return. Defaults to 100. From 1 to 1000.

**Outputs**

- `count` (number): How many metrics were returned
- `has_more` (true/false): True when there are more than the limit
- `metrics` (list): The metrics

**Example output**

```json
{
  "count": 1,
  "has_more": false,
  "metrics": [
    {
      "help": "Whether the target is up",
      "name": "up",
      "type": "gauge",
      "unit": ""
    }
  ]
}
```

### List alerts

List the alerts firing or pending now, with their labels, annotations and when they became active. Firing alerts come first.

**Inputs**

- State (`state`, text): Which alerts to include. Defaults to firing or pending. One of: `any` (Firing or pending), `firing`, `pending`. Default: `any`.
- Alert (`alert_name`, text): Only alerts of this name. Leave empty for all.

**Outputs**

- `alerts` (list): The alerts
- `count` (number): How many alerts were returned
- `firing_count` (number): How many of them are firing

**Example output**

```json
{
  "alerts": [
    {
      "active_since": "2026-10-27T10:15:00Z",
      "annotations": {
        "summary": "More than 5% of requests are failing"
      },
      "labels": {
        "alertname": "HighErrorRate",
        "job": "api",
        "severity": "critical"
      },
      "name": "HighErrorRate",
      "severity": "critical",
      "state": "firing",
      "value": 0.072
    }
  ],
  "count": 1,
  "firing_count": 1
}
```

### List rules

List the server's alerting or recording rules with their query, health and, for alerts, whether they are firing.

**Inputs**

- Rules (`rule_type`, text): Which rules to list. Defaults to alerting rules. One of: `alert` (Alerting rules), `record` (Recording rules), `any` (Both). Default: `alert`.
- Group (`group`, text): Only rules in this group. Leave empty for every group.

**Outputs**

- `count` (number): How many rules
- `rules` (list): The rules

**Example output**

```json
{
  "count": 1,
  "rules": [
    {
      "active_alert_count": 1,
      "group": "api",
      "health": "ok",
      "labels": {
        "severity": "critical"
      },
      "last_error": "",
      "name": "HighErrorRate",
      "query": "rate(errors_total[5m]) > 0.05",
      "state": "firing",
      "type": "alert"
    }
  ]
}
```

### List targets

List what Prometheus scrapes and whether each target is up, with the last error for any that are down. Down targets come first.

**Inputs**

- Health (`health`, text): Only targets in this state. Defaults to any. One of: `any`, `up`, `down`, `unknown`. Default: `any`.
- Job (`job`, text): Only targets of this job. Leave empty for every job.

**Outputs**

- `count` (number): How many targets were returned
- `down_count` (number): How many of them are down
- `targets` (list): The targets

**Example output**

```json
{
  "count": 1,
  "down_count": 1,
  "targets": [
    {
      "health": "down",
      "instance": "db-1:9100",
      "job": "node",
      "labels": {
        "instance": "db-1:9100",
        "job": "node"
      },
      "last_error": "connection refused",
      "last_scrape": "2026-10-27T10:19:45Z",
      "scrape_url": "http://db-1:9100/metrics"
    }
  ]
}
```

### Run query

Run a PromQL query for one moment, now unless you pick another, and get each result's labels and value. 'value' holds the first result's number, handy for a single total or rate.

**Inputs**

- Query (`query`, text, required): A PromQL expression, such as sum(rate(http_requests_total[5m])).
- At (`at_time`, date and time): The moment to evaluate it at. Leave empty for now.

**Outputs**

- `count` (number): How many results there are
- `query` (text): The query that ran
- `result_type` (text): vector, scalar, string or matrix
- `results` (list): Each result with its labels and value
- `truncated` (true/false): True when there were more than 1000 results
- `value` (number): The first result's value; empty when there are none

**Example output**

```json
{
  "count": 1,
  "query": "up",
  "result_type": "vector",
  "results": [
    {
      "labels": {
        "__name__": "up",
        "instance": "localhost:9090",
        "job": "prometheus"
      },
      "raw_value": "1",
      "time": "2026-10-27T10:20:00Z",
      "value": 1
    }
  ],
  "truncated": false,
  "value": 1
}
```

### Run range query

Run a PromQL query over a time range, one point per step, and get each series' points. For trends and reports.

**Inputs**

- Query (`query`, text, required): A PromQL expression, such as sum(rate(http_requests_total[5m])).
- From (`start`, date and time, required): When the range begins.
- To (`end`, date and time): When the range ends. Leave empty for now.
- Resolution (`step`, text): How far apart the points are. Defaults to every minute. A duration such as 30s or 2h works too. One of: `15s` (Every 15 seconds), `1m` (Every minute), `5m` (Every 5 minutes), `15m` (Every 15 minutes), `1h` (Every hour), `6h` (Every 6 hours), `1d` (Every day). Default: `1m`.

**Outputs**

- `count` (number): How many series there are
- `end` (text): When it ended, in UTC (ISO 8601)
- `query` (text): The query that ran
- `series` (list): Each series with its points
- `start` (text): When the range began, in UTC (ISO 8601)
- `step_seconds` (number): Seconds between points
- `truncated` (true/false): True when there were more than 500 series

**Example output**

```json
{
  "count": 1,
  "end": "2026-10-27T10:02:00Z",
  "query": "up",
  "series": [
    {
      "labels": {
        "__name__": "up",
        "instance": "localhost:9090",
        "job": "prometheus"
      },
      "points": [
        {
          "raw_value": "1",
          "time": "2026-10-27T10:00:00Z",
          "value": 1
        },
        {
          "raw_value": "1",
          "time": "2026-10-27T10:01:00Z",
          "value": 1
        },
        {
          "raw_value": "1",
          "time": "2026-10-27T10:02:00Z",
          "value": 1
        }
      ]
    }
  ],
  "start": "2026-10-27T10:00:00Z",
  "step_seconds": 60,
  "truncated": false
}
```
