Start QEMU with QMP UNIX socket and connect:
qemu-system-x86_64 -qmp unix:test.socket,server,nowait ...
nc -U test.socket
qmp-shell test.socket # use the raw qmp interface. see https://github.com/0xef53/qmp-shell
qmp-shell -H test.socket # use the human interface. see https://github.com/0xef53/qmp-shell
Or start QEMU with QMP TCP socket and connect:
qemu-system-x86_64 -qmp tcp:127.0.0.1:12345,server,nowait ...
nc localhost 12345
After you open the socket, the first command is always:
{ "execute": "qmp_capabilities" }
Then you can either execute human or machine friendly commands.
{ "execute": "human-monitor-command", "arguments": { "command-line": "help" } }
{ "execute": "human-monitor-command", "arguments": { "command-line": "info version" } }
{ "execute": "human-monitor-command", "arguments": { "command-line": "info network" } }
{ "execute": "human-monitor-command", "arguments": { "command-line": "info qtree" } }
{ "execute": "query-qmp-schema" }
{ "execute": "query-machines" }
{ "execute": "query-version" }
{ "execute": "query-name" }
{ "execute": "query-status" }
{ "execute": "query-kvm" }
{ "execute": "query-pci" }
{ "execute": "device-list-properties", "arguments": { "typename": "vmxnet3" } }
{ "execute": "qom-list-types" }
{ "execute": "qom-list", "arguments": { "path": "/" } }
{ "execute": "qom-list", "arguments": { "path": "/machine" } }
{ "execute": "qom-get", "arguments": { "path": "/machine", "property": "type" } }
{ "execute": "qom-list", "arguments": { "path": "/machine/i440fx" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/i440fx", "property": "type" } }
{ "execute": "qom-list", "arguments": { "path": "/machine/i440fx/pci.0" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0", "property": "type" } }
{ "execute": "qom-list", "arguments": { "path": "/machine/i440fx/pci.0/child[3]" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "type" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "mac" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "netdev" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "legacy-addr" } }
{ "execute": "qom-list", "arguments": { "path": "/machine/peripheral-anon" } }
{ "execute": "qom-list", "arguments": { "path": "/machine/peripheral-anon/device[0]" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "type" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "mac" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "netdev" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/peripheral/nic0", "property": "type" } }
{ "execute": "qom-get", "arguments": { "path": "/machine/peripheral/nic0", "property": "mac" } }