Finding model name of a running machine

What is the best way of determining the controller and model name from a running machine without using Juju iself?

We have a few machines that are “runnaway” so we can’t find the controller+model in which its running…

Hi Erik!

There is a file called agent.conf in /var/lib/juju/agents/machine-<id>. It contains the uuid of the model and controller, along with the ip address of the controller. That’s not quite as straightforward as resolving to a name, but you should be able to match things up, were you to put together a mapping of names to uuids w/ a script.

hth,
~ petevg

Thanx, but I don’t understand where to get the uuid:s

Hi Erik,

You can get the uuid with the show-model and show-controller command.

For example: juju show-model local-maas gets me the uuid of the virutal maas I’m running on my laptop.

The information also appears in ~/.local/share/juju/models.yaml and ~/.local/share/juju/controllers.yaml, for the models and controllers a specific operator knows about.