Skip to main content

🩺 juju-doctor 🩺

Run a configurable set of probes (assertions) against Juju deployment artifacts, which are the output of other tools like juju, sosreport, and kubectl. To enforce best practices, these probes are organized into a ruleset, which acts as a guide for correct deployment configurations.

Purpose & value

  • Unlike with goss, probes written by juju-doctor are equally usable on a live deployment as well as a (partial) support archive.
  • Unlike with LLMs, juju-doctor is intended as read-only operations, no KUBECONFIG needed.
  • Unlike with LLMs, you don't need to come up with prompts and pay for them for every troubleshooting session; instead, you can start with relying on probes that were written by others beforehand, from insights gained from previous incidents.
  • Unlike with charm code, juju-doctor probes can be created and updated much faster, ad hoc, and put immediately in use, without needing to release and refresh charm(s).
    • This means that juju-doctor probes can serve as a "staging ground" for production teams to communicate the kind of self-test checks that charming teams should consider incorporating into the operator code.

Usage

Here's some typical usage examples:

∮ juju-doctor check --help # displays the help

You can run juju-doctor against a solution archive:

∮ juju-doctor check \
    --probe file://tests/resources/probes/python/failing.py \
    --probe file://tests/resources/probes/python/passing.py \
    --status=status.yaml \
    --bundle=bundle.yaml

If you have a live deplyoment, you can also run juju-doctor against that:

∮ juju-doctor check \
    --probe file://tests/resources/probes/python/failing.py \
    --probe file://tests/resources/probes/python/passing.py \
    --model model-one \
    --model model-two

In either case, the output will look like so (configurable with --format and --verbose):

Results
├── 🔴 tests_resources_probes_python_failing.py
└── 🟢 tests_resources_probes_python_passing.py

Total: 🟢 3/6 🔴 3/6

The path to a probe can also be a URL:

# Run a remote probe against a live model
∮ juju-doctor check --model cos --probe github://canonical/grafana-k8s-operator//probes/some_probe.py

Writing Probes

Scriptlet

Scriptlet probes are written in Python, and run on standardized artifacts that can be provided either as static files, or gathered from a live model.

Currently, we support the following artifacts:

  • status: juju status --format=yaml
  • bundle: juju export-bundle
  • show_unit: juju show-unit --format=yaml

To write a probe, you should start by choosing an artifact. Your code will only have access to one artifact type at a time, but the input information can span multiple models.

Then, write a function named after your artifact (e.g., status, bundle, etc.) that takes one Dict argument: the artifact of choice indexed by model name. The function should raise an exception if you want your probe to fail, explaining why it failed.

Let's look at an example.

from typing import Dict

def status(juju_statuses: Dict[str, Dict]): # {'cos': juju_status_dict, ...}
    ... # do things with the Juju statuses
    if not all_good:
        raise Exception("'coconut' charm shouldn't be there!")

def bundle(juju_bundles: Dict[str, Dict]):
    ... # do things with the Juju bundles
    if not passing:
      raise Exception("who deployed the 'coconut' charm?")

def _first_check(...):
    ...

def _second_check(...):
    ...

# You can split multiple checks in functions
def show_unit(juju_show_units):
    ...
    _first_check()
    _second_check()

Remember: juju-doctor will only run functions that exactly match a supported artifact name, and will always pass to them a dictionary of model name mapped to the proper artifact.

For some real-world examples, check out the examples directory and this Grafana charm probe.

Ruleset

Ruleset probes are written in YAML, specifying which probes should be coordinated for a deployment validation.

Currently, the following probe types are supported:

  • scriptlet: A Python probe
  • ruleset: A declarative deployment RuleSet
  • builtin/*: A builtin plugin of a type defined in the supported plugins

Run juju-doctor schema to output the schema of a RuleSet YAML file and check out this RuleSet probe as an extensive example.

Builtins

See this doc for contributing a builtin and general information about the builtin plugin design.

Development

git clone https://github.com/canonical/juju-doctor.git
uv sync --extra=dev && source .venv/bin/activate
uv pip install -e .
juju-doctor check --help

Metadata

Release files for juju-doctor 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for juju-doctor 0.1.10
File Size Uploaded Provenance
juju_doctor-0.1.10.tar.gz 223.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for juju-doctor 0.1.10
File Interpreter ABI Platform
juju_doctor-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 254.9 kB

Release files / juju_doctor-0.1.10.tar.gz

Download URL juju_doctor-0.1.10.tar.gz
Size 223.1 kB
Tags Source
SHA-256 checksum
How to use checksums
db835aac11430cdaba1f86e2c815a374be892a0b2f3ef6ad821f4c9ebf27e219
BLAKE2b-256 checksum
How to use checksums
cda2bed6e3c664b88f48cfa570a0d16eeae7f5b2d594179d34d7f08a91760139
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / juju_doctor-0.1.10-py3-none-any.whl

Download URL juju_doctor-0.1.10-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8070ee0e744a632a4ee510acc6da3acb04a5a6f379abd7abfd72d3bd0123660
BLAKE2b-256 checksum
How to use checksums
206f1c3ed8834ff6a891c054e0ceb741c51805f207dc284f914b0e76641324a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for juju-doctor 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for juju_doctor-0.1.10.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page