KosmoKrator

analytics

Prometheus CLI for AI Agents

Use the Prometheus CLI from KosmoKrator to call Prometheus tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 7 read 0 write API token auth

Prometheus CLI Setup

Prometheus can be configured headlessly with `kosmokrator integrations:configure prometheus`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure prometheus --set api_token="$PROMETHEUS_API_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor prometheus --json
kosmokrator integrations:status --json

Credentials

Authentication type: API token api_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_token PROMETHEUS_API_TOKEN Secret secret yes API Token

Call Prometheus Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call prometheus.prometheus_list_alerts '{
  "filter": "example_filter",
  "receiver": "example_receiver"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:prometheus prometheus_list_alerts '{
  "filter": "example_filter",
  "receiver": "example_receiver"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs prometheus --json
kosmo integrations:docs prometheus.prometheus_list_alerts --json
kosmo integrations:schema prometheus.prometheus_list_alerts --json
kosmo integrations:search "Prometheus" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Prometheus.

prometheus.prometheus_list_alerts

Read read

List Prometheus alerts. Optionally filter by alert state or label selectors. Returns alert names, states, labels, and annotations.

Parameters
filter, receiver

Generic CLI call

kosmo integrations:call prometheus.prometheus_list_alerts '{"filter":"example_filter","receiver":"example_receiver"}' --json

Provider shortcut

kosmo integrations:prometheus prometheus_list_alerts '{"filter":"example_filter","receiver":"example_receiver"}' --json

prometheus.prometheus_get_alert

Read read

Get a Prometheus alert by name. Returns the full alert definition including labels, annotations, and state.

Parameters
name

Generic CLI call

kosmo integrations:call prometheus.prometheus_get_alert '{"name":"example_name"}' --json

Provider shortcut

kosmo integrations:prometheus prometheus_get_alert '{"name":"example_name"}' --json

prometheus.prometheus_list_rules

Read read

List Prometheus alerting and recording rules. Optionally filter by type. Returns rule groups with their rules and states.

Parameters
type

Generic CLI call

kosmo integrations:call prometheus.prometheus_list_rules '{"type":"example_type"}' --json

Provider shortcut

kosmo integrations:prometheus prometheus_list_rules '{"type":"example_type"}' --json

prometheus.prometheus_get_rule

Read read

Get a Prometheus rule group by name. Returns the full rule group definition including all rules within the group.

Parameters
name

Generic CLI call

kosmo integrations:call prometheus.prometheus_get_rule '{"name":"example_name"}' --json

Provider shortcut

kosmo integrations:prometheus prometheus_get_rule '{"name":"example_name"}' --json

prometheus.prometheus_list_targets

Read read

List Prometheus scrape targets. Optionally filter by state (active or dropped). Returns target health status, labels, and scrape info.

Parameters
state

Generic CLI call

kosmo integrations:call prometheus.prometheus_list_targets '{"state":"example_state"}' --json

Provider shortcut

kosmo integrations:prometheus prometheus_list_targets '{"state":"example_state"}' --json

prometheus.prometheus_get_target

Read read

Get a Prometheus target by its instance address. Returns target health, last scrape info, and discovery labels.

Parameters
instance

Generic CLI call

kosmo integrations:call prometheus.prometheus_get_target '{"instance":"example_instance"}' --json

Provider shortcut

kosmo integrations:prometheus prometheus_get_target '{"instance":"example_instance"}' --json

prometheus.prometheus_get_current_user

Read read

Get the current authenticated Prometheus user info. Useful for verifying authentication and retrieving user details.

Parameters
none

Generic CLI call

kosmo integrations:call prometheus.prometheus_get_current_user '{}' --json

Provider shortcut

kosmo integrations:prometheus prometheus_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

prometheus.prometheus_list_alerts

List Prometheus alerts. Optionally filter by alert state or label selectors. Returns alert names, states, labels, and annotations.

Operation
Read read
Schema command
kosmo integrations:schema prometheus.prometheus_list_alerts --json
ParameterTypeRequiredDescription
filter string no Optional label selector filter (e.g., "severity=critical").
receiver string no Filter alerts by receiver name.

prometheus.prometheus_get_alert

Get a Prometheus alert by name. Returns the full alert definition including labels, annotations, and state.

Operation
Read read
Schema command
kosmo integrations:schema prometheus.prometheus_get_alert --json
ParameterTypeRequiredDescription
name string yes The name of the alert to retrieve.

prometheus.prometheus_list_rules

List Prometheus alerting and recording rules. Optionally filter by type. Returns rule groups with their rules and states.

Operation
Read read
Schema command
kosmo integrations:schema prometheus.prometheus_list_rules --json
ParameterTypeRequiredDescription
type string no Filter rules by type: "alert" for alerting rules or "recording" for recording rules.

prometheus.prometheus_get_rule

Get a Prometheus rule group by name. Returns the full rule group definition including all rules within the group.

Operation
Read read
Schema command
kosmo integrations:schema prometheus.prometheus_get_rule --json
ParameterTypeRequiredDescription
name string yes The name of the rule group to retrieve.

prometheus.prometheus_list_targets

List Prometheus scrape targets. Optionally filter by state (active or dropped). Returns target health status, labels, and scrape info.

Operation
Read read
Schema command
kosmo integrations:schema prometheus.prometheus_list_targets --json
ParameterTypeRequiredDescription
state string no Filter targets by state: "active" or "dropped".

prometheus.prometheus_get_target

Get a Prometheus target by its instance address. Returns target health, last scrape info, and discovery labels.

Operation
Read read
Schema command
kosmo integrations:schema prometheus.prometheus_get_target --json
ParameterTypeRequiredDescription
instance string yes The target instance address (e.g., "localhost:9090").

prometheus.prometheus_get_current_user

Get the current authenticated Prometheus user info. Useful for verifying authentication and retrieving user details.

Operation
Read read
Schema command
kosmo integrations:schema prometheus.prometheus_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.