Monitoring VMWare’s Free ESXi 3.5 with Cacti

When I realised that the free version of VMWare ESXi only kept an hours worth of logging information I went looking for a solution to keep more statistical data. This is what I have come up with so far.

VMWare ESXi 3.5 CPU Graph in Cacti

VMWare ESXi 3.5 CPU Graph in Cacti

VMWare ESXi 3.5 Memory Graph in Cacti

VMWare ESXi 3.5 Memory Graph in Cacti

This method uses the VMWare Remove CLI tools to connect to the ESX server and download the information via an XML interface.

Software Required:

Firstly download and install the VMWare Remote CLI tools to your Cacti server.

Next you need to add a user to ESX for the statistics collection.

On the ESX Virtual Infrastructure Client goto the “Users & Groups” tab.

VMWare ESXi 3.5 Add Stats User Step 1

VMWare ESXi 3.5 Add Stats User Step 1

Right Mouse Click and “Add” a new user.

VMWare ESXi 3.5 Add Stats User Step 2

VMWare ESXi 3.5 Add Stats User Step 2

Then go to the “Permissions” tab, and Right Mouse Click to “Add Permission”.

VMWare ESXi 3.5 Add Stats User Step 4

VMWare ESXi 3.5 Add Stats User Step 3

Add the new StatsUser and select Read-Only for the assigned role and click Ok.

Now goto your Cacti installation and copy the “esxstats.pl” file into your cacti scripts directory and import the “cacti_host_template_vmware_esxi_3_5_host.xml” file into Cacti using the web interface. These scripts can be downloaded from the bottom of this post.

You should now be able to add a new ESX host into cacti. You will need to specify the “Downed Device Detection” mode to just “Ping” as there is no SNMP on the current Free version of VMWare ESXi 3.5.

I am hoping that SNMP support will come to the free versions as that would make life much easier.

Files Required:

This entry was posted in Cacti, Linux, Sys Admin, VMWare and tagged , , , , . Bookmark the permalink.

23 Responses to Monitoring VMWare’s Free ESXi 3.5 with Cacti

  1. David Strong says:

    Cheers, works a treat. Exactly what i was looking for.

  2. CALF says:

    Error: XML: Hash version does not exist

    on templates importing…

  3. Jon Smith says:

    I really like Cacti, but this is one of my biggest bugbears. If you try to import a template on an older version you get the error stated above.

    The template should import on version 0.8.7d. What version are you using?

  4. CALF says:

    Nagios 0.8.7d
    Perl 5.8.8

  5. CALF says:

    Sorry. My cacti version is 0.8.7b. Thanks for fast answers and congratulations for monitoring solution…

  6. Mike B says:

    I got everything into cacti great and configured but nothing was showing up. running it from commandline:

    root@cacti:/usr/share/cacti/site/scripts# perl esxstats.pl 10.1.10.14 StatsUser statsuser
    Error: Server version unavailable at ‘https://10.1.10.14/sdk/vimService.wsdl’ :1: parser error : Start tag expected, ‘<' not found

    is what i get, any suggestions?

  7. Jon Smith says:

    Mike B :

    I got everything into cacti great and configured but nothing was showing up. running it from commandline:

    root@cacti:/usr/share/cacti/site/scripts# perl esxstats.pl 10.1.10.14 StatsUser statsuser
    Error: Server version unavailable at ‘https://10.1.10.14/sdk/vimService.wsdl’ :1: parser error : Start tag expected, ‘<‘ not found

    is what i get, any suggestions?

    What is the version of ESX you are using? Free version or Licensed?

  8. Mike B says:

    @Jon Smith
    Its the Free version, VMware ESX Server 3i, 3.5.0,153875 i can hit that url and its a rather short and sweet XML page. I’ve been scratching my head for a couple of days on it now.

  9. Jon Smith says:

    @Mike B
    Mike, I have done some googling about your problem and it seems like you might be missing a Perl module. Try installing “Crypt::SSLeay”.

    Source: http://communities.vmware.com/thread/164134?tstart=0 (on page two, first post)

    Good luck

  10. Mike B says:

    @Jon Smith
    Dead on, that was the hang up! Thanks so much, I thought I installed that module, but alas that was the issue. Great script, works perfectly and thanks again!

  11. PT says:

    @Jon Smith
    Will this work with ESX 3.5 Licensed version? cheers

  12. Jon Smith says:

    @PT
    To be honest I don’t know. In theory it should, it would be great if you could test it and let us know.

  13. feilong says:

    I have just test on a ESX 3.5 Licenced version and it’s working fine.
    I have just test on a ESXi 4 version and it’s working fine.

    Thanks for share.

  14. tapankar says:

    I am trying to import the XML file but getting “XML parse error”.I am using cacti 0.8.7e..Could you help…

  15. Jon Smith says:

    @tapankar
    Hrm, new version of Cacti out. I will try the import after I have upgraded my installation. Once upgraded I will release a new version made for 0.8.7e, this wont be until early next week.

  16. Mohit says:

    Thanks !! But is it possible for you add bandwidth monitoring also with this

  17. Jon Smith says:

    @Mohit
    Not currently. The last time I looked, this information was not easy to obtain.

    Cheers,

    Jon

  18. Lalbee99 says:

    I loaded this using cacti 0.8.7e and it works. I did change the perl script to be more robust. I added functions for mem & cpu reporting on a singular vm or on the cluster itself, by passing command line arguments. I then re wrote the templates for mem & cpu to reflect this change.

  19. Jon Smith says:

    @Lalbee99
    Any chance you would be happy to share your work back to the community? Sounds like a great improvement.

    Cheers,

    Jon

  20. Chungyih says:

    I got everything into cacti great and configured but nothing was showing up. running it from commandline:
    /usr/share/cacti/site/scripts# perl esxstats.pl

    BEGIN failed–compilation aborted at esxstats.pl line 7.

    is what i get, any suggestions?

  21. amg says:

    Great job. Many thanks for sharing. Works fine on ESXi 4, monitoring from ubuntu.

    Just to save some time from others. Running esxstats.pl from command gave the following error:

    /usr/local/share/cacti/scripts# perl esxstats.pl

    perl: symbol lookup error: /usr/lib/perl/5.10/auto/XML/LibXML/Common/Common.so: undefined symbol: Perl_Tstack_sp_ptr

    If you use Ubuntu 10.04.2 LTS you need to install following packages too:

    perl-XML-LibXML perl-XML-LibXML-Common perl-XML-SAX perl-XML-DOM perl-XML-Parser perl-XML-RegExp perl-Crypt-SSLeay perl-Data-Dump perl-Class-MethodMaker

  22. amg says:

    By the way, any one knows which ports on firewall should I open for this to work?

  23. Pingback: Graph VMware ESXi through Cacti - Admins Goodies

Leave a Reply

Your email address will not be published. Required fields are marked *