Back to OP5 Monitor FAQ

How to monitor VMware vSphere infrastructure with check_vmware_v2

Purpose Copied

The purpose of this article is to describe how OP5 Monitor, Naemon or Nagios can be used with the check_vmware_v2 plugin to monitor your VMware vSphere infrastructure.

What can be monitored? Copied

The plugin can be used to monitor the infrastructure managed by a VMware vCenter server or a VMware ESXi server; such as its datacenters, clusters, hosts and virtual machines. It can check a large range of different metrics and statuses depending on the targeted infrastructure; for example CPU load, memory usage, network activity, runtime states, etc..

The plugin uses the Python SDK for the VMware vSphere API, which makes it compatible with the previous four versions of vSphere. The Python SDK does not need to be installed on the OP5 Monitor server for the plugin to work.

Installation Copied

The check_vmware_v2 plugin should be installed by default on Monitor 8. It is also available for manual install from the op5 Monitor Updates repository:

yum install naemon-check-vmware

The check_vmware_v2 plugin is not supported on previous versions of Monitor.

Note: It is currently not possible to use this plugin on a slim poller.

Configuration Copied

The service configuration files are installed in /etc/op5/check_vmware.

The service is installed with a working configuration, but you may for example want to configure the port used by the check_vmware service process, or the vCenter authentication details known by the service.

Service configuration Copied

The service.cfg file is used to specify configuration variables for the service WSGI application.

Most of the available configuration variables are documented by the respective library they belong to:

Service-specific configuration Copied

The Check VMware service defines the following additional configuration variables.

Gunicorn configuration Copied

The gunicorn.cfg file is used to configure the Gunicorn HTTP server that runs the service as a WSGI application. This is where we can configure the host and port the service runs on.

See http://docs.gunicorn.org/en/stable/settings.html for documentation on the available Gunicorn configuration.

Starting the service Copied

The plugin has a service that runs in the background to avoid making a new HTTP connection to VMware for every check. The plugin service also needs a running Redis instance that is used for caching.

Depending on your architecture, run the commands below.

Starting the service on EL6 Copied

service redis start

service check_vmware start

And to make sure the services start after a system reboot:

chkconfig redis on

chkconfig check_vmware on

Starting the service on EL7 Copied

systemctl start redis

systemctl start check_vmware

And to make sure the services start after a system reboot:

systemctl enable redis

systemctl enable check_vmware

Running the check command Copied

The check command is installed in /opt/plugins/check_vmware_v2.

Run check_vmware_v2 --help to list all the command options.

Available counters Copied

The --list-counters and --list-all-counters options can be used to list all available counters.

The --list-counters option lists counters actually available on a specified managed entity.

The --list-all-counters option lists all counters known by the vCenter server, but they may not necessarily be available on any accessible managed entity.

Add the --verbose option for more information about the listed counters.

Examples Copied

Troubleshooting Copied

Bad magic numbers Copied

If the service fails to start and there is a log entry saying something like:

ImportError: bad magic number in 'check_vmware': b'\x03\xf3\r\n'

Then the problem is likely that there are .pyc files compiled for a different version of the Python interpreter than the one being used. This could happen after a system upgrade where the service had previously been running on a lower Python version. The solution is to remove all .pyc files from the installation so that the new Python interpreter is forced to re-compile them.

["Geneos"] ["FAQ"]

Was this topic helpful?