Create host and various things in Zabbix

Recently I wanted to monitor some servers. In the old days I used Nagios or Cacti for such a purpose (both based on rrdtool) but I wanted to change and let Zabbix a chance.

Zabbix turn out a nice product I have to say. When it's easy to tweak, then I tag it :)

So, I wanted to monitor running virtual machines, but the thing is they are not accessible from the Zabbix server. The hypervisor must send all VM statistics to the server.

In the little script I wrote, I just demonstrate the way I get all running VM from a qemu domain, and then create a corresponding host into Zabbix.

At the end, I create an item (CPU util but it could be something else) and create a graph with it.

What I need to do next : a little script to update the cpu time and send the value to the server.