VMware vSphere

 View Only
  • 1.  how to monitor my virtual machines with Nagios?

    Posted Oct 14, 2010 11:40 AM

    Hi all,

    how can I monitor my virtual guests (not the ESX itself) with Nagios? Is there a howto somewhere?

    Olaf



  • 2.  RE: how to monitor my virtual machines with Nagios?

    Broadcom Employee
    Posted Oct 14, 2010 03:40 PM

    Define "monitoring" .... depending on what you're trying to monitor, there have been some Nagios check scripts written by the community, check out Nagios Exchange for more details.

    There are no official VMware check scripts, so if you're unable to find something, you'll most likely have to write a custom script. We use nagios for our monitoring and what you can do is create a passive check in which you notify Nagios on either ok, warning or error. This allows you to write various types of checks and Nagios would just report on those 3 states. If you want to leverage vCenter and it's alarms, you can have vCenter trigger the alarm and part of it's notification can be an email, snmp trap or command. You can write a script, whatever language that can be executed within the vCenter server to send off a command which basically generates the passive call to Nagios for your monitoring.

    Do a search online for creating Nagios passive checks and play around with it and you should get a feel for it, if you've worked with Nagios and creating passive checks, then it's pretty easy to implement into vCenter.

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware scripts and resources at:

    Twitter: @lamw

    Getting Started with the vMA (tips/tricks)

    Getting Started with the vSphere SDK for Perl

    VMware Code Central - Scripts/Sample code for Developers and Administrators

    VMware Developer Community

    If you find this information useful, please award points for "correct" or "helpful".



  • 3.  RE: how to monitor my virtual machines with Nagios?

    Posted Oct 14, 2010 04:09 PM

    Beside Nagios, you may try Veeam Monitor.






    Regards,

    jlchannel

    MALAYSIA VMware Communities

    http://www.malaysiavm.com

    'If you found this or any other answer useful please consider allocating points for helpful or correct answers ***



  • 4.  RE: how to monitor my virtual machines with Nagios?

    Posted Oct 15, 2010 08:02 AM

    Thanks for the answers!

    We already have Nagios monitoring here that checks all VMs for running WMware tools.

    I upgraded our servers from ESX 3.5 to ESX 4.0u2, and now vmware-cmd -l needs 3-5 minutes just to list all running VMs. With 3.5, this check needed only a couple of seconds. Is it perhaps because vmware-cmd is no longer aPerl script but a Python script?

    Anyway, I think of moving to ESXi. So I will need a monitoring station that can run all VM checks that are currently running on the ESX hosts. What will I need to have something similar to the ESX console?

    Olaf



  • 5.  RE: how to monitor my virtual machines with Nagios?

    Broadcom Employee
    Posted Oct 15, 2010 11:29 AM

    If you're going down the ESXi route, you'll want to use an external system to perform your monitoring as ESXi no longer has a Service Console. You should take a look at using something like VMware vMA and using the APIs to perform the monitoring that is required and you can setup custom passive calls back to your Nagios host as mentioned earlier, that is what I do in our environment. You can also look at using vCenter or Windows system and using PowerCLI and sending alerts via Nagios. Since you already have vCenter, you can just leverage it's alarms/etc. and send everything to Nagios. There's definitely a lot of solutions out there, just depends on your requirements and what other external applications you may use to perform alerting and notifications.

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware VCP3,4

    VMware VCAP-DCA4

    VMware scripts and resources at:

    Twitter: @lamw

    Getting Started with the vMA (tips/tricks)

    Getting Started with the vSphere SDK for Perl

    VMware Code Central - Scripts/Sample code for Developers and Administrators

    VMware Developer Community

    If you find this information useful, please award points for "correct" or "helpful".



  • 6.  RE: how to monitor my virtual machines with Nagios?

    Posted Oct 18, 2010 02:51 PM

    OK, I built a monitoring Linux VM with the Perl API. I can check my VM status locally as user nrpe.

    /opt/nagios/plugins.local/check-vmware-guests.pl says:

    CRITICAL: vm1: VMware Tools NOT INSTALLED // vm2: VMware Tools NOT INSTALLED //

    So far, so good. But in Nagios I only see this output:

    Enter username: Enter password:

    I created a .visdkrc that is obviously okay, and I created a credstore, but nothing helps... :smileysad:



  • 7.  RE: how to monitor my virtual machines with Nagios?

    Broadcom Employee
    Posted Oct 18, 2010 03:00 PM

    If you're going to create your own Nagois checks, depending if you're performing and active or passive check, you'll need to send Nagios the data in a specific format. Please take a look at the Nagios documentation based on the type of check you're creating - http://nagios.sourceforge.net/docs/3_0/activechecks.html

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware VCP3,4

    VMware VCAP4-DCA

    VMware scripts and resources at:

    Twitter: @lamw

    Getting Started with the vMA (tips/tricks)

    Getting Started with the vSphere SDK for Perl

    VMware Code Central - Scripts/Sample code for Developers and Administrators

    VMware Developer Community

    If you find this information useful, please award points for "correct" or "helpful".



  • 8.  RE: how to monitor my virtual machines with Nagios?

    Posted Oct 18, 2010 03:27 PM

    Well, my question is: how can I feed my perl script with credentials when it is run by the nrpe daemon? When I put --username and --password into nrpe.cfg then the output is okay. But I would like to use .visdkrc instead.



  • 9.  RE: how to monitor my virtual machines with Nagios?

    Broadcom Employee
    Posted Oct 18, 2010 03:35 PM

    Well that's pretty simple :smileywink:

    1) First, did you manually verify the script functions 100% with the results you are expecting using the service account you created?

    2) Assuming #1 was properly tested, create a configuration file, you can call it anything or .visdkrc as you named it.

    The file can contain various variables that include:

    VI_SERVER=<esx or esxi or vcenter hostname>
    VI_USERNAME=<esx or esxi or vcenter username>
    VI_PASSWORD=<password>
    VI_PROTOCOL=<http or https>
    

    Say you have a script called "check_esx.pl", you would create a cron entry and it should have the following assuming you've populated everything correctly:

    check_esx.pl --config .visdkrc
    

    This uses the --config flag and reads in the file and based on the populated file, it'll use those as the credentials. Note, you don't need to fill in every single variable. If you want to loop through a set of ESX(i) host, you probably want to leave VI_SERVER out and just specify that on the command line useing --server and the username and password maybe the same.

    Hopefully this makes sense.

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware VCP3,4

    VMware VCAP4-DCA

    VMware scripts and resources at:

    Twitter: @lamw

    Getting Started with the vMA (tips/tricks)

    Getting Started with the vSphere SDK for Perl

    VMware Code Central - Scripts/Sample code for Developers and Administrators

    VMware Developer Community

    If you find this information useful, please award points for "correct" or "helpful".



  • 10.  RE: how to monitor my virtual machines with Nagios?

    Posted Oct 19, 2010 09:24 AM

    That helped, thanks! ~/.visdkrc pointed to /root/.visdkrc, so I had to put the full path to nrpe's .visdkrc into nrpe.cfg.