Jockey is a CLI tool for querying Juju model data with concise filter expressions. It currently supports querying units and machines and can filter them using related object values (applications, charms, hostnames, IPs, and availability zones).
Jockey relies on this model of Juju objects and how they are related:
---
title: Juju object relationships
---
flowchart LR
C([Charm]) --> A[Application]
A -->|Instances of| U[Unit]
U -->|Running on| M[Machine]
M -->|Metadata| M_I(IP)
M -->|Metadata| M_H(Hostname)
All filters are evaluated by traversing these relationships.
Only these object types can be queried as the top-level OBJECT:
| Name | Aliases |
|---|---|
| Unit | unit, units, u |
| Machine | machine, machines, m |
When filtering units or machines, you can reference these Juju objects:
| Attribute | Aliases |
|---|---|
| Charm | charm, charms, c |
| Application | application, applications, app, apps, a |
| Unit | unit, units, u |
| Machine | machine, machines, m |
| IP address | ips, address, addresses, ip, i |
| Hostname | hostnames, hostname, host, hosts, h |
| Availability Zone | availability-zone, availability_zone, az, zone |
| Operator | Behavior |
|---|---|
= |
Value equals |
^= |
Value does not equal |
~ |
Value contains substring |
^~ |
Value does not contain substring |
jockey <OBJECT> [FILTER ...] [OPTIONS]
<OBJECT>: A queryable object type (uorm) or alias[FILTER ...]: Zero or more filter expressions[OPTIONS]:--file <path>to query a Juju status JSON file
<ATTRIBUTE><OPERATOR><VALUE>
<ATTRIBUTE>: A filterable attribute (e.g.,app,host,charm)<OPERATOR>: One of=,^=,~,^~<VALUE>: The string to match
jockey ujockey mjockey u app=etcdReturns all units of the etcd application.
jockey u charm=nrpeReturns all units running the nrpe charm.
jockey m host~nodeReturns machines whose hostname contains "node".
jockey u machine=0Returns units running on machine 0 (and its containers).
jockey u app=nova machine^=0Returns units of the nova application that are NOT on machine 0.
jockey m m^~lxdReturns all non-LXD machines (physical machines only).
jockey u --file /tmp/status.json app=mysqlReturns mysql units from a local status file.
--file /path/to/status.jsonqueries a local Juju status JSON file.- Without
--file, Jockey queries Juju CLI output and uses a local cache. - The in-memory status used for filtering is intentionally narrowed to fields needed by the currently supported query/filter paths.