Received: from eggs.gnu.org ([2001:4830:134:3::10]:53322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfsYa-0007di-SA for qemu-devel@nongnu.org; Wed, 08 Apr 2015 12:10:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfsYW-0003Hl-Sf for qemu-devel@nongnu.org; Wed, 08 Apr 2015 12:10:24 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:51687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfsYW-0003HV-Je for qemu-devel@nongnu.org; Wed, 08 Apr 2015 12:10:20 -0400 Date: Wed, 8 Apr 2015 18:10:18 +0200 (CEST) From: Erik Rull Message-ID: <668770373.39977.1428509418086.JavaMail.open-xchange@oxbaltgw07.schlund.de> In-Reply-To: <1428414139.25243.1.camel@profitbricks.com> References: <1746798507.1094444.1428413473548.JavaMail.open-xchange@oxbaltgw09.schlund.de> <1428414139.25243.1.camel@profitbricks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Getting VM state from outside QEMU? Reply-To: Erik Rull List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: paulo.vital@profitbricks.com Cc: "qemu-devel@nongnu.org" Hello Paulo, > On April 7, 2015 at 3:42 PM Paulo Ricardo Paz Vital > wrote: > > > On Tue, 2015-04-07 at 15:31 +0200, Erik Rull wrote: > > Hi all, > > > > I need a pretty simple way to get the current state of the VM running in > > QEMU - > > I only need the VM state (e.g. running, paused,...). Since my environment > > does > > not have any perl, python or other high level scripting capabilities, a > > simple > > way e.g. via a shell script would be nice. QEMU is running daemonized, so > > interacting with the qemu console is not possible. > > Are there any usable entries in /proc, /dev or /sys that could be used? > > > > Hello Erik, > > My suggestion is to create a script that sends the QMP command > "query-status" an then parse the result. The syntax and output is: > > -> { "execute": "query-status" } > <- { "return": { "running": true, "singlestep": false, "status": > "running" } } > Sounds good - I tried that - but all attempts return that the command has not been found. I added the following command line snippet and the results are: [...] -qmp tcp:localhost:4444,server,nowait [...] 172.17.48.45 ~ # telnet 127.0.0.1 4444 {"QMP": {"version": {"qemu": {"micro": 0, "minor": 1, "major": 2}, "package": ""}, "capabilities": []}} { "execute": "query-status" } {"error": {"class": "CommandNotFound", "desc": "The command query-status has not been found"}} { "execute": "info status" } {"error": {"class": "CommandNotFound", "desc": "The command info status has not been found"}} { "execute": "info", "arguments": { "status": "" } } {"error": {"class": "CommandNotFound", "desc": "The command info has not been found"}} { "execute": "query-kvm" } {"error": {"class": "CommandNotFound", "desc": "The command query-kvm has not been found"}} Any ideas what's wrong here? Thanks. Best regards, Erik