WP-XenServerStats – WordPress Plugin for XenServer 1/2
WP-XenServerStats – WordPress Plugin for XenServer 2/2

I got this idea when I saw Nick (Show And Tell : First vSphere Plugin for WordPress!) doing something I wanted to do for Citrix XenServer. Then before trying to do myself (I’m a very bad dev….) I’ve try to find someone who did it better than I would ever do… And no one did it(yet)…

So here I am trying to make something nice and learning again something new (php / mysql / function etc…) just to show off my XenServer @ Home hypervisor stats. I got everything working, but I’m sure someone, better dev than me would make a really cleaner and efficient job.

I’ve study Citrix XenServer 5.6 FP1 SDK documentation / references and this is hard (for me) to try to find a good way to handle and find values I’m looking for. So my first step was to list everything I wanted to see on my widget bar (the bar on the right on this blog)

Here is the list :

  • Show Hostname
  • Show Number of CPU
  • Show Memory amount
  • Show Number of VMs
  • Show Number of VMs On
  • Show Number of VMs Off
  • Show Number of VMs Paused
  • Show Last data refresh update time
  • Automatic information refresh every hour
  • Storing these data in my MySQL database

At first I needed to find a mechanism to get all those data the simplest way possible. As I told you, I’m not very comfortable yet with MySQL stuffs, so I’ll do it the old way because there is really not much data and I think this is a good start.

To get the amount of VMs running on my host it came very quicky a simple way to get it :

[root@suomixen log]# xe vm-list | grep -c power-state

And then using the same way, it was be very easy to get the Powered, Halted and Suspended ones :


2 23