Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: Qemu exporters minor improvements
- Improve documentation about vm configuration.
- Change error management to warn user if he forgot about the --vm
  switch.
  • Loading branch information
uggla committed Jan 2, 2021
commit 2f8d832c3d478a1681fe9f96d4071621d4736839
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png binary
Binary file added docs/exporters/images/virtualmgr00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/exporters/images/virtualmgr01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/exporters/images/virtualmgr02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 18 additions & 5 deletions docs/exporters/qemu.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,37 @@ First create a tmpfs mount point to isolate metrics for that virtual machine:
mount -t tmpfs tmpfs_DOMAIN_NAME /var/lib/libvirt/scaphandre/DOMAIN_NAME -o size=10m

3. Ensure you expose the content of this folder to the virtual machine by having this configuration in the xml configuration of the domain:

```
<filesystem type='mount' accessmode='passthrough'>
<driver type='virtiofs'/>
<source dir='/var/lib/libvirt/scaphandre/DOMAIN_NAME'/>
<target dir='scaphandre'/>
<readonly />
</filesystem>
```
You can edit the vm properties using `sudo virsh edit <DOMAIN_NAME>` using your usual editor. But it is more convenient to use virtual-manager, as explained in the following screenshots.

*It also helps to define the correct syntax which probably depends from the qemu version. You can check that the above configuration is slightly different form the one below*.

a. Right click in the hardware menu:
![virtualmgr00](images/virtualmgr00.png)

b. Enter the following parameters:
![virtualmgr01](images/virtualmgr01.png)

c. XML generated as a result:
![virtualmgr02](images/virtualmgr02.png)

3. Ensure the VM has been started once the configuration is applied, then mount the filesystem on the VM/guest:
4. Ensure the VM has been started once the configuration is applied, then mount the filesystem on the VM/guest:

mount -t 9p -o trans=virtio scaphandre /var/scaphandre

4. Still in the guest, run scaphandre in VM mode with the default sensor:
5. Still in the guest, run scaphandre in VM mode with the default sensor:

scaphandre --vm prometheus

5. Collect your virtual machine specific power usage metrics. (requesting http://VM_IP:8080/metrics in this example, using the prometheus exporter)
6. Collect your virtual machine specific power usage metrics. (requesting http://VM_IP:8080/metrics in this example, using the prometheus exporter)

As always exporter's options can be displayed with `-h`:

scaphandre qemu -h
scaphandre qemu -h
2 changes: 1 addition & 1 deletion src/sensors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl Topology {
.sockets
.iter_mut()
.find(|x| &x.id == socket_id)
.unwrap();
.expect("Trick: if you are running on a vm, do not forget to use --vm parameter invoking scaphandre at the command line");
if socket_id == &socket.id {
socket.add_cpu_core(c);
}
Expand Down