How to find "owner" of a juju instance

Hello!

I’m trying to advice on how to find “owners” of a specific juju instance in a multiuser setup? See below:

Anyone got some advice on how to track down which model for example an instance belongs to using just juju commands?

I think I can track it down in vsphere, but how to one track down a model from a juju instance name?

Hi @erik-lonroth,

The middle part of an instance ID is the first part of the owning model’s UUID. As an admin you can list all of the models on a controller using the juju models command. Combining that with a simple filter would allow one to get the model information for a particular instance. For example in your case you could run:

juju models --format=json |  jq '.models | map(select( .["model-uuid"] | test("^ff578c.*")))'

That command would give you the model summary for the model running the instance.

A couple of things to note:

  1. This will only work for “superuser” level users on the controller. Normal users can only see their own models.
  2. JIMM doesn’t support “superuser” level users in the same way as a normal juju controller so it’s not possible to run this check across the whole system, but rather one has to scan each juju controller one at a time.
2 Likes

You may also be able to check the /var/log/juju/audit.log on the controller model machines to determine the user who executed the ‘add-model’ command for that particular model.

2 Likes

The above does not work. The following does, Martins example searches for start of the model-uuid, whereas the search is for the ending:

juju models --format=json | jq ‘.models | map(select( .[“model-uuid”] | test(“ff578c$”)))’