prometheus_list_targets
List scrape targets with health status, last scrape duration, and errors. Grouped by job and health to quickly identify down targets and investigate failures.
Instructions
List Prometheus scrape targets, summarised by job and health.
Wraps GET /api/v1/targets. Returns scrape targets with job name,
instance address, health status (up / down / unknown),
last scrape duration in milliseconds, and any last error. Also returns
a summary grouped by job and health state.
Examples:
- Use when: "Which targets are currently down?"
→ filter targets where health='down' and check last_error.
- Use when: "How many instances of the 'node-exporter' job are up?"
→ check job_summary for the 'node-exporter' entry.
- Use when: Investigating a scrape failure — list targets for the
affected job to see which instances have errors.
- Don't use when: You want metric values from a target
(call prometheus_query with label matchers instead).
- Don't use when: You want alert status
(call prometheus_list_alerts instead).
Returns:
dict with state_filter / total_count / up_count /
down_count / unknown_count / job_summary (per-job health counts) /
targets (list with job, instance, health,
last_scrape_duration_ms, last_error, labels).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | Filter targets by state: 'active' (default, scrape targets Prometheus is scraping), 'dropped' (targets that were dropped by relabelling), or 'any' (all targets regardless of state). | active |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state_filter | Yes | ||
| total_count | Yes | ||
| up_count | Yes | ||
| down_count | Yes | ||
| unknown_count | Yes | ||
| job_summary | Yes | ||
| targets | Yes |