analytics
Prometheus CLI for CI
Use the Prometheus CLI for CI with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 7 read 0 write API token auth
Prometheus CLI for CI
Run integration calls from CI jobs with JSON output, explicit credentials, and predictable exit status.
Use this shape when a pipeline needs to read or update an external service. The Prometheus CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Prometheus CLI for CI
kosmokrator integrations:configure prometheus --set api_token="$PROMETHEUS_API_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call prometheus.prometheus_list_alerts '{"filter":"example_filter","receiver":"example_receiver"}' --json Discovery Before Execution
Agents and scripts can inspect Prometheus docs and schemas 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 Useful Prometheus CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
prometheus.prometheus_list_alerts | Read | filter, receiver | List Prometheus alerts. Optionally filter by alert state or label selectors. Returns alert names, states, labels, and annotations. |
prometheus.prometheus_get_alert | Read | name | Get a Prometheus alert by name. Returns the full alert definition including labels, annotations, and state. |
prometheus.prometheus_list_rules | Read | type | List Prometheus alerting and recording rules. Optionally filter by type. Returns rule groups with their rules and states. |
prometheus.prometheus_get_rule | Read | name | Get a Prometheus rule group by name. Returns the full rule group definition including all rules within the group. |
prometheus.prometheus_list_targets | Read | state | List Prometheus scrape targets. Optionally filter by state (active or dropped). Returns target health status, labels, and scrape info. |
prometheus.prometheus_get_target | Read | instance | Get a Prometheus target by its instance address. Returns target health, last scrape info, and discovery labels. |
prometheus.prometheus_get_current_user | Read | none | Get the current authenticated Prometheus user info. Useful for verifying authentication and retrieving user details. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.