From owner-freebsd-virtualization@freebsd.org Mon Aug 27 14:15:46 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 981BE108B394 for ; Mon, 27 Aug 2018 14:15:46 +0000 (UTC) (envelope-from fabian.freyer@physik.tu-berlin.de) Received: from mail2.physik.tu-berlin.de (mail2.physik-pool.tu-berlin.de [130.149.50.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3857F7232A; Mon, 27 Aug 2018 14:15:45 +0000 (UTC) (envelope-from fabian.freyer@physik.tu-berlin.de) Received: from [130.149.50.202] (yalow02.physik-pool.tu-berlin.de [130.149.50.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail2.physik.tu-berlin.de (Postfix) with ESMTPSA id BB5AB61F92; Mon, 27 Aug 2018 14:15:37 +0000 (UTC) To: freebsd-virtualization@freebsd.org From: Fabian Freyer Subject: on bhyve statistics Message-ID: Date: Mon, 27 Aug 2018 16:14:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2018 14:15:46 -0000 Hi list, I'm currently looking at getting the libvirt prometheus exporter[1] to work with libvirt+bhyve. In its current state this doesn't work because at least one of the API calls exposed by libvirt isn't implemented by the libvirt bhyve driver - so I started looking at implementing it. The first API call in question is virDomainBlockStats[2], which returns statistics (number of read and written bytes and ops, respectively). Currently, bhyve does not expose any of these statistics. All the stats available through bhyvectl --get-stats seem to be coming from the VMM, not from the userspace emulation. OTOH, I did see that there are *some* stats being collected in bhyverun.c (see struct bhyvestats {...} stats;). I can't see how these are exposed though - a grep of /usr/src turned up no other uses. Which brings me to the following questions: - are the stats in struct bhyvestats {...} stats exposed or used in any non-obvious way? - architecturally, what would be the best ways to get stats out of the user-space emulations? Off of the top of my head, I could think of the following possibilities: - prometheus exporter - having some socket or pipe to request them - DTrace probes I wouldn't mind implementing any of the above, and so would like to know which of these (or other options) would be the most acceptable, and would appreciate some guidance. CC'ing novel@ for the libvirt side, and grehan@ for the architectural bhyve questions. Fabian [1] https://github.com/kumina/libvirt_exporter [2] https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockStats