CHR: "qemu-guest-agent" Wiki Documentation

RouterOS 6.42 and above now have support for qemu guest agent connectivity for provisioning. The wiki has a few cursory comments on what it can do and what is supported(https://wiki.mikrotik.com/wiki/Manual:CHR#KVM), but I think it needs a lot more detail on how to use it. By comparison, the VMware provisioning section is quite a bit more comprehensive, including an example Python script.

Can someone from Mikrotik please take some time to add more detail to the documentation? Specifically:

  • What kind of scripts may be executed
  • The security context under which the scripts are executed
  • An example script that can serve as a basis for provisioning
  • How to use the additional chr.provision_channel channel

Thank you for your consideration.

Rather late I know but I finally got this to work

I connect to the qemu agent like this
socat /var/run/qemu-server/155.qga -

where 155 was my VM id on the hypervisor now I m talking to the Agent and can send commands you need to make sure you have a serial device in your VM config

Ok now to send a command
I ending up sending some commands and working out what needs to be sent if you just want to run a script that you send you use input-data option BUT your data must be base 64 encoded

so
{“execute”: “guest-exec”, “arguments”: {“input-data”: “OmlwIGFkZHJlc3MgYWRkIGFkZHJlc3M9MTkyLjE2OC4wLjEvMjQgaW50ZXJmYWNlPWV0aGVyMTs=” ,“capture-output”: true } }

and it works
this is equal to
:ip address add address=192.168.0.1/24 interface=ether1; eg base64 encode this and send as your input


It would be good to see some more info in the Wiki though but I hope this helps someone

It helped me! Thank you kindly!