prometheus_scrape_pool_targets
Retrieve targets for a specific scrape pool in Prometheus, enabling precise monitoring and analysis of selected metrics for effective infrastructure management.
Instructions
Get targets for a specific scrape pool
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scrapePool | Yes | scrape pool name |
Implementation Reference
- src/server/tools.ts:148-149 (handler)Tool handler lambda that executes the core logic by calling PrometheusClient.getScrapePoolTargets with the provided scrapePool argument.handle: async (client: PrometheusClient, args) => client.getScrapePoolTargets(args.scrapePool),
- src/server/tools.ts:72-74 (schema)Zod input schema for the tool, defining the required 'scrapePool' parameter.const PrometheusScrapePoolTargetsSchema = z.object({ scrapePool: z.string().describe("scrape pool name"), });
- src/server/tools.ts:141-150 (registration)Definition and registration of the tool in the tools array, including name, metadata, schema, and handler.defineTool<typeof PrometheusScrapePoolTargetsSchema, TargetsResult>({ capability: "discovery", name: "prometheus_scrape_pool_targets", title: "Get Scrape Pool Targets", description: "Get targets for a specific scrape pool", inputSchema: PrometheusScrapePoolTargetsSchema, type: "readonly", handle: async (client: PrometheusClient, args) => client.getScrapePoolTargets(args.scrapePool), }),
- src/prometheus/client.ts:260-262 (helper)PrometheusClient method directly invoked by the tool handler, forwarding to listTargets.async getScrapePoolTargets(scrapePool: string): Promise<TargetsResult> { return this.listTargets(scrapePool); }
- src/prometheus/client.ts:239-246 (helper)Core helper method that performs the HTTP request to Prometheus /api/v1/targets endpoint with optional scrapePool query parameter, returning TargetsResult.async listTargets(scrapePool?: string): Promise<TargetsResult> { const endpoint = "/api/v1/targets"; const params: Record<string, string> = {}; if (scrapePool) { params.scrapePool = scrapePool; } return this.request<TargetsResult>(endpoint, params); }