vmware

Monitoring VMware ESX, ESXi, vSphere and vCenter Server

7 Aprile 2014 SnetAdmin Comments Off

Monitoring VMware ESX, ESXi, vSphere and vCenter Server

The purpose of this article is to describe how op5 Monitor or Nagios used with the Check VMware API Plugin can be used to monitor your VMware ESX(i) and vCenter servers. You may monitor either a single ESX(i) server or a VMware vCenter Server and individual virtual machines. If you have a VMware cluster you should monitor the vCenter Server and not the ESX/vSphere servers by themselves.

More information can be found in Monitor Virtual Infrastructure with op5 Monitor and in the document What can you monitor in a VMware Server/cluster?

Prerequisites

Before you start you need to make sure you have an account on the server with correct access rights.
In the default installation of VMware ESX/vSphere there is a ‘read only’ profile you should use when creating a new user. That profile has enough rights to be used for monitoring. The user you create must be:

  • member of the group user
  • be based on the profile ‘read only’

 

You must install the VMware vSphere SDK for Perl on your op5 Monitor server. Please read the how-to about Installing vSphere SDK for Perl for instructions.

If you want to monitor a VMware 5.1 environment please read the Installing vSphere SDK for Perl 5.1 how-to.

This will be done

We will go through:

  • Monitoring a VMware ESX Datacenter/vCenter
  • Monitoring a VMware ESX/vSphere Host
  • Monitoring a VMware Virtual machine
  • Monitoring a VMware Virtual machine through a vCenter
  • Monitoring a VMware ESX/vSphere Host through a vCenter

 

Check commands

Add the required check-commands, if they don’t already exist in your configuration (‘Configure’ -> ‘Commands’ -> ‘Check Command Import’):

You should also define a username and password in /opt/monitor/etc/resource.cfg to hide this information from the CGI:s:

$USER11$=username
$USER12$=password

Note:We’ll use the $HOSTALIAS$ macro in the command_line because we need to use the VM-names as they are defined in your VMware server. Set this name as an Alias in the host definition. These changes don’t affect the history of your host.

The following commands should be preconfigured in op5 Monitor, if any is missing use the function “Check command import” from the configuration utility

Commands for ESX(i) Datacenter/vCenter

COMMAND NAME COMMAND LINE
check_vmware_api_dc_vm $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -l $ARG2$ -s $ARG3$ -N $HOSTALIAS$ -w $ARG4$ -c $ARG5$
check_vmware_api_dc_host $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -l $ARG2$ -s $ARG3$ -H $HOSTADDRESS$ -w $ARG4$ -c $ARG5$

 

Commands for ESX(i)/vSphere Hosts

COMMAND NAME COMMAND LINE
check_vmware_api_host_cpu_usage $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l cpu -s usage -w $ARG1$ -c $ARG2$
check_vmware_api_host_mem_usage $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l mem -s usage -w $ARG1$ -c $ARG2$
check_vmware_api_host_swap_usage $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l mem -s swap -w $ARG1$ -c $ARG2$
check_vmware_api_host_net_usage $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l net -s usage -w $ARG1$ -c $ARG2$
check_vmware_api_host_vmfs $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l vmfs -s $ARG1$ -w “$ARG2$:” -c “$ARG3$:”
check_vmware_api_host_runtime_status $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l runtime -s status
check_vmware_api_host_runtime_issues $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l runtime -s issues
check_vmware_api_host_io_read $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l io -s read -w $ARG1$ -c $ARG2$
check_vmware_api_host_io_write $USER1$/check_vmware_api -H $HOSTADDRESS$ -u $USER11$ -p $USER12$ -l io -s write -w $ARG1$ -c $ARG2$

 

Commands for virtual machines on ESX(i)/vSphere servers

COMMAND NAME COMMAND LINE
check_vmware_api_vm_cpu_usage $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l cpu -s usage -w $ARG2$ -c $ARG3$
check_vmware_api_vm_mem_usage $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l mem -s usage -w $ARG2$ -c $ARG3$
check_vmware_api_vm_swap_usage $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l mem -s swap -w $ARG2$ -c $ARG3$
check_vmware_api_vm_net_usage $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l net -s usage -w $ARG2$ -c $ARG3$
check_vmware_api_vm_runtime_cpu $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l runtime -s cpu -w $ARG2$ -c $ARG3$
check_vmware_api_vm_runtime_mem $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l runtime -s mem -w $ARG2$ -c $ARG3$
check_vmware_api_vm_runtime_status $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l runtime -s status
check_vmware_api_vm_runtime_state $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l runtime -s state
check_vmware_api_vm_runtime_issues $USER1$/check_vmware_api -H $ARG1$ -u $USER11$ -p $USER12$ -N $HOSTALIAS$ -l runtime -s issues

 

Commands for ESX/vSphere Hosts through your Datacenter/vCenter

COMMAND NAME COMMAND LINE
check_vmware_api_dc_host_cpu_usage $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l cpu -s usage -w $ARG2$ -c $ARG3$
check_vmware_api_dc_host_mem_usage $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l mem -s usage -w $ARG2$ -c $ARG3$
check_vmware_api_dc_host_net_usage $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l net -s usage -w $ARG2$ -c $ARG3$
check_vmware_api_dc_host_runtime_issues $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l runtime -s issues
check_vmware_api_dc_host_runtime_state $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l runtime -s state
check_vmware_api_dc_host_runtime_status $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l runtime -s status
check_vmware_api_dc_host_swap_usage $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l mem -s swap -w $ARG2$ -c $ARG3$
check_vmware_api_dc_host_io_read $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l io -s read -w $ARG2$ -c $ARG3$
check_vmware_api_dc_host_io_write $USER1$/check_vmware_api -D $ARG1$ -u $USER11$ -p $USER12$ -H $HOSTALIAS$ -l io -s write -w $ARG2$ -c $ARG3$

 

Generic commands for ESX(i)/vSphere

There are three generic commands for check_vmware_api which could be used if you want to monitor anything not mentioned in the tables above. If you do not have them in your system you may add them with the import functionality in op5 Monitor (‘Configure’ ->  ‘Check Command Import’).

COMMAND NAME DESCRIPTION
check_vmware_api_dc Use this command if you want to monitor (or through) a Datacenter/vCenter.
check_vmware_api_host Use this command if you want to monitor a ESX(i)/vSphere.
check_vmware_api_vm Use this command to monitor a single VM.
check_esx_dc_vm Use this command to monitor a single VM through Datacenter/vCenter

 

Adding the services

Add the required services, (‘Configure’ -> ‘Host: ‘ -> ‘Go’ -> ‘Services for host ‘ -> ‘Add new service’ -> ‘Go’):

Add the following services (Arguments are just examples, you need to adjust them to suite your environment).

Services for ESX(i) Datacenter

SERVICE DESCRIPTION CHECK COMMAND ARGUMENTS NOTE
VMware DC VM check_vmware_api_dc_vm VCserver-ip!command!subcommand!
warning!critical
 
VMware DC Host check_vmware_api_dc_host VCserver-ip!command!subcommand!
warning!critical

 

Services for ESX(i) hosts

SERVICE DESCRIPTION CHECK COMMAND ARGUMENTS NOTE
VMware CPU Usage check_vmware_api_host_cpu_usage 80!90 *
VMware Mem Usage check_vmware_api_host_mem_usage 80!90 *
VMware Swap Usage check_vmware_api_host_swap_usage 80!90 *
VMware Net Usage check_vmware_api_host_net_usage 102400!204800 **
VMware VMFS main-storage check_vmware_api_host_vmfs main-storage!15%:!10%:  
VMware Runtime Status check_vmware_api_host_runtime_status   ***
VMware Runtime Issues check_vmware_api_host_runtime_issues   ****
VMware IO Read check_vmware_api_host_io_read 40!90 *****
VMware IO Write check_vmware_api_host_io_write 40!90 *****

 

Services for virtual machines on ESX(i)/vSphere server

SERVICE DESCRIPTION CHECK COMMAND ARGUMENTS NOTE
VMware VMCPU Usage check_vmware_api_vm_cpu_usage esx-host-ip!80!90 *
VMware VM Mem Usage check_vmware_api_vm_mem_usage esx-host-ip!80!90 *
VMware VM Swap Usage check_vmware_api_vm_swap_usage esx-host-ip!80!90 *
VMware VM Net Usage check_vmware_api_vm_net_usage esx-hostip!
102400!204800
**
VMware VM Runtime CPU check_vmware_api_vm_runtime_status esx-host-ip!80!90 *
VMware VM Runtime Mem check_vmware_api_vm_runtime_status esx-host-ip!80!90 *
VMware VM Runtime Status check_vmware_api_vm_runtime_status esx-host-ip ***
VMware VM Runtime Issues check_vmware_api_vm_runtime_issues esx-host-ip ****

 

Services for virtual machines through your Datacenter/vCenter

SERVICE DESCRIPTION CHECK COMMAND ARGUMENTS NOTE
VMware Host CPU Usage check_vmware_api_dc_host_cpu_usage VCserver-ip!80!90 *
VMware Host Mem Usage check_vmware_api_dc_host_mem_usage VCserver-ip!80!90 *
VMware Host Swap Usage check_vmware_api_dc_host_swap_usage VCserver-ip!80!90 *
VMware Host Net Usage check_vmware_api_dc_host_net_usage VCserver-ip
!102400!204800
**
VMware Host Runtime Status check_vmware_api_dc_host_runtime_status VCserver-ip ***
VMware Host IO Read check_vmware_api_dc_host_io_read VCserver-ip!40!90 *****
VMware Host IO Write check_vmware_api_dc_host_io_write VCserver-ip!40!90 *****

Services for ESX/vSphere Hosts through your Datacenter/vCenter

SERVICE DESCRIPTION CHECK COMMAND ARGUMENTS NOTE
VMware Host CPU Usage check_vmware_api_dc_host_cpu_usage VCserver-ip!80!90 *
VMware Host Mem Usage check_vmware_api_dc_host_mem_usage VCserver-ip!80!90 *
VMware Host Swap Usage check_vmware_api_dc_host_swap_usage VCserver-ip!80!90 *
VMware Host Net Usage check_vmware_api_dc_host_net_usage VCserver-ip
!102400!204800
**
VMware Host Runtime Status check_vmware_api_dc_host_runtime_status VCserver-ip ***
VMware Host IO Read check_vmware_api_dc_host_io_read VCserver-ip!40!90 *****
VMware Host IO Write check_vmware_api_dc_host_io_write VCserver-ip!40!90 *****

 

Notes:

* Warn and critical in percent.
** Warn and critical in kb/s
*** Anything else than “green” as response results in a Critical state
**** Any issues found results in a Critical state
***** Warn and critical in ms

“” as the last char on each row means that the command is split for readability, should be on one line.

Ranges for Warning and Critical thresholds:

10 < 0 or > 10, (outside the range of {0 .. 10})

10: < 10, (outside {10 .. ∞})

~:10 > 10, (outside the range of {-∞ .. 10})

10:20 < 10 or > 20, (outside the range of {10 .. 20})

@10:20 ≥ 10 and ≤ 20, (inside the range of {10 .. 20})

10 < 0 or > 10, (outside the range of {0 .. 10})

Articoli recenti

Categorie