Actions¶
This reference describes the Juju actions exposed by Jaime - Juju AI Medic
Engine. The charm actions.yaml files remain the source of truth. All actions
are read-only with respect to the monitored workload.
The machine subordinate charm (jaime) exposes every action below; the
Kubernetes standalone charm (jaime-k8s) exposes all except
collect-context, and adds show-setup-steps.
show-status¶
Show the current monitoring state for every monitored unit: workload, the active
incident if any, and the last observation. Returns a JSON array under result
with fields unit, workload, status-message, first-seen, status-since,
increment, last-reported, incident-id, incident-opened-at.
juju run jaime/0 show-status
show-usage¶
Show AI token usage and cost: a global summary across all incidents, or
per-incident detail when incident-id is given.
Parameter |
Type |
Description |
|---|---|---|
|
string |
Incident id to filter by. Empty returns the global summary. |
juju run jaime/0 show-usage
juju run jaime/0 show-usage incident-id=<incident-id>
Each unit keeps its 200 most recent usage records; older ones are folded into
per-model totals. The global summary includes them, so token and cost totals
stay exact, but a per-incident query and total_incidents only see the
retained records.
get-suggestion¶
Return the AI suggestion for the current open incident: a root-cause description and a single suggested command. The command is never executed.
Parameter |
Type |
Description |
|---|---|---|
|
string |
Extra context to include in the AI prompt. |
|
boolean |
Call the AI provider again even when a stored suggestion would be reused. Default |
juju run jaime/0 get-suggestion \
additional-context="Disk was resized 20 min ago; pgdata is on /dev/sdb1"
To get a fresh answer without changing anything, for example after switching
provider-remote-url to a different server that serves the same model name, run
juju run jaime/0 get-suggestion force=true.
Results: incident-id, description, commands, command-count,
generated-at, cached, and, when the provider reports usage, model,
prompt-tokens, completion-tokens, total-tokens and cost-usd. The
suggestion is cached on the incident and regenerated only when the
additional-context or the configured model changes, so cached reports
whether the provider was called; force=true skips the cache. A stored
suggestion based on an older report version is not reused. Answers to ask
questions never serve as the cache. Commands are taken only from code blocks
tagged bash: if the model answers in another block (sh, sql, yaml),
commands is empty and the answer is still in description. The action fails when no incident is open, when
the mode is observe, or when no suggestion is available.
ask (conversational)¶
Append one question/answer turn to an incident’s conversation. Each call adds a new turn; previous answers are never overwritten.
Parameter |
Type |
Description |
|---|---|---|
|
string |
The question to ask about the incident (required). |
|
string |
Incident to ask about. Empty uses the single open incident; it is required when several are open, and to ask about a closed incident. |
juju run jaime/0 ask incident-id=550e8400-e29b-41d4-a716-446655440000 \
question="What is the replication lag?"
Results: incident-id, turn-id (a per-incident integer: 1, 2, 3 …),
description, commands, command-count,
generated-at, and usage when the provider reports it. The prompt carries the
stored report plus the compact previous turns, so the model keeps the thread
context (the most recent 10 turns, answers truncated). The report is the
incident’s latest version, and each turn records which one it used. Requires mode=suggest;
the action fails in observe mode. A provider error fails the action with the
reason and does not block the unit. Nothing is executed. Each incident keeps at most 20 turns (oldest
pruned).
list-suggestions¶
Return the full conversation for an incident as a JSON array under result.
Parameter |
Type |
Description |
|---|---|---|
|
string |
Incident to list turns for. Empty lists every tracked incident’s turns. |
Each record carries incident_id, unit, turn_id, question,
generated_at, report_file (the report version the answer was based on), and
description.
generate-report¶
Collect fresh context and write a new report version for the current open
incident, as <incident-id>-<UTC timestamp>.md in report-dir. Earlier
versions, including the first report <incident-id>.md, are never
overwritten. The new version becomes the incident’s latest, the one ask and
get-suggestion send to the provider.
juju run jaime/0 generate-report
Results: incident-id and report-path. The action fails when no incident is
open or the collection fails.
list-incidents¶
List incidents recorded in the audit log, newest first. Each entry correlates
the incident’s incident-start, report-generated and incident-closed
events by incident id, including open incidents, and reports the workload status
message captured when the incident opened.
Parameter |
Type |
Description |
|---|---|---|
|
string |
Restrict the result to incidents for one unit, for example |
juju run jaime/0 list-incidents
juju run jaime-k8s/0 list-incidents unit=postgresql-k8s/0
Returns a JSON array under result with fields incident_id, unit,
workload, status_message, first_seen, status_since, opened_at,
report_path (the latest report version), closed_at and status (open or
closed). The size-rotated archives (events.jsonl.1 …) are read with the
live file. A missing or malformed audit log yields an empty list rather than an
error.
reset¶
Close every tracked incident and clear the monitoring state.
juju run jaime/0 reset
reset closes open incidents (already closed ones get no second closure row),
then rotates the audit log: the closed history, including the numbered size
archives, is archived to events.jsonl.<timestamp> and the configured path
restarts empty,
so list-incidents returns nothing afterwards while the archive is retained on
disk.
collect-context (machine charm)¶
Collect a bounded context bundle for the related principal, write it to disk, and return its path.
juju run jaime/0 collect-context
Results: unit and context-path. The action fails when no principal unit is
related.
show-setup-steps (Kubernetes charm)¶
Print the exact setup steps for the Kubernetes charm: Kubernetes RBAC, the Juju observer user, secrets, and configuration, with the model and application names pre-filled. Read-only.
juju run jaime-k8s/0 show-setup-steps