How to Monitor Libvirt with Prometheus, Nacos, and Grafana – A Step‑by‑Step Guide
This article walks you through deploying the libvirt‑exporter, registering it with Nacos for service discovery, exposing it to Prometheus, and adding a ready‑made Grafana dashboard, providing a complete monitoring solution for virtualized environments.
Deploy libvirt‑exporter service
Download the pre‑built libvirt‑exporter binary, make it executable, and start it listening on port 9177.
$ sudo wget https://github.com/srkaviani/prometheus_exporters/raw/main/libvirt_exporter/prometheus-libvirt-exporter
$ sudo chmod +x prometheus-libvirt-exporter
$ ./prometheus-libvirt-exporter -web.listen-address :9177Register libvirt‑exporter to Nacos
Use a POST request to register the exporter instance with Nacos so that it can be discovered by Prometheus.
$ curl -d 'username=jiaxzeng' \
-d 'password=' \
-d 'namespaceId=46f891fb-c1a2-4b67-a0cb-b9d3888ac9be' \
-d 'serviceName=libvirt-exporter' \
-d 'ip=172.139.20.1' \
-d 'port=9177' \
-d 'ephemeral=false' \
-X POST 'http://172.139.20.100:8848/nacos/v2/ns/instance'
{ "code":0, "message":"success", "data":"ok" }Expose Nacos monitor discovery to Prometheus
If the Nacos discovery service has not been deployed, refer to the article “From Static to Dynamic Monitoring: Prometheus + Nacos for Intelligent Operations” for deployment instructions.
Add libvirt monitoring panel in Grafana
Import the provided Grafana dashboard to visualize libvirt metrics collected by Prometheus.
Conclusion
Monitoring the Libvirt service is not only a technical task but also a critical safeguard for business continuity and system stability; mastering these steps equips you with the ability to keep virtualized infrastructures reliable and resilient.
Linux Ops Smart Journey
The operations journey never stops—pursuing excellence endlessly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
