XenServer License Check – Nagios NRPE Plugin

If you hadn’t already guessed I am a big fan of the Xen hypervisor. Lately I have been using the Citrix XenServer release because it makes it quite palatable for my co-workers. One annoyance that I do have about XenServer is the requirement that you license it (with a free license) every year. If you fail to license it the GUI stops working. Now I hate relying on GUIs but the fact of the matter is others in my team expect to have a working GUI when they need to do something. And I dont know about you but I don’t really log onto the management console very often. Really I only log on to it if I need to provision a new server so its entirely plausible that a license would expire and I wouldn’t know about it until I really needed to do something.

I ended up writing a little Nagios plugin that checks the license expiration date using XenAPI. I don’t know that it’s 100% compliant with the plugin specification but it does work for me. I actually don’t prefer to use the warn and critical states with the Nagios (I use the performance data with Zenoss and apply thresholds there. I find that to be a bit more flexible.) but I did implement them. The plugin can be executed on the XenServer (you may want to reference how to install nrpe on XenServer) or on from your monitoring host as long as the host performing the check has the python XenAPI installed.

The plugin check_citrix_xenserver_license can be found on github.

I hope someone can find it useful.


  • Mark Linux Google Chrome 11.0.696.57 wrote:

    Hey Nick,
    FYI the link to github is giving a 404.
    I don’t suppose you still have this plugin available do you?


  • Thanks for the heads up, i fixed the link.

  • Hi.
    Your script is excellent, except that there is a tiny bug with casting. Comparison of expire_days and options.warning_days (and options.critical_days)actually produces incorrect results, due to one of them not being an integer. I have enclosed them all (only for the comparison part) in int(), and the results are correct now.

    Thanks for your script!

  • If you send a patch or make a pull request on github I’ll make sure its updated for everyone.

    Thanks for the heads up on the bug and glad you found it useful.

  • Below is the contents of my diff. I have fixed both the cast problem, and also the problem with querying a slave. Your original script (after the cast change) would have just failed, as the slave does not respond correctly. I am only partially happy with the current status of the script, as it does not answer a case where a single node loses its license (it has happened to me) and reacts in a weird way, as long as the pool master is OK. For now, I will leave it. So, the patch:

    > if int(expire_days) > int(options.warning_days):
    < elif expire_days elif int(expire_days) <= int(options.warning_days):
    < if expire_days if int(expire_days) <= int(options.critical_days):
    session = XenAPI.Session(“https://”+options.server)
    > except XenAPI.Failure, e:
    > if e.details[0]==’HOST_IS_SLAVE’:
    > session=XenAPI.Session(‘https://’+e.details[1])
    > session.login_with_password(options.username, options.password)

    I hope it helps, and I would be more than happy to test any further. I wish I was a better python coder (or, given my level – python coder at all…)


  • As suspected. Lines indent was lost. Mail me, and I will send you the patch file directly.


  • I rewrote the check so it works with xen 5.8
    In a few weeks we will migrate to 6.2 and i’ll give you an update 🙂


Leave a Reply

Your email is never shared.Required fields are marked *

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha