Wrapper for the rabbitmqadmin
command.
composer require innmind/rabbitmq-management
use Innmind\RabbitMQ\Management\{
Status,
Control,
};
use Innmind\OperatingSystem\Factory;
$os = Factory::build();
$status = Status::of(
$os->control(),
$os->clock(),
);
$status->users();
$status->vhosts();
$status->connections();
$status->exchanges();
$status->permissions();
$status->channels();
$status->consumers();
$status->queues();
$status->nodes();
$control = Control::of($server);
$control->users();
$control->vhosts();
$control->permissions();
Essentially this will run rabbitmqadmin list {element}
on the server and extract informations.
If you need to list the information of a remote server, then you can simply do this:
use Innmind\RabbitMQ\Management\Status\Environment\Remote;
use Innmind\Url\{
Authority\Host,
Authority\Port,
Path,
};
Status::of(
$os->control(),
$os->clock(),
Remote::of(
Host::of('your-host'),
Port::of(1337),
'username',
'password',
Path::of('/some-vhost'),
),
);
However for this to work you need to have rabbitmqadmin
installed on the machine this code will run.
In case you don't have the command on the machine, you can replace $os->control()
by $os->remote()->ssh(/*...*/)
so it will use ssh
to run the command on the machine (and you will need to remove the third argument from Status::of()
).