README ¶
check-vmware
Go-based tooling to monitor VMware environments; NOT affiliated with or endorsed by VMware, Inc.
Table of Contents
- check-vmware
Project home
See our GitHub repo for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.
Just to be 100% clear: this project is not affiliated with or endorsed by VMware, Inc.
Overview
This repo contains various tools used to monitor/validate VMware environments.
Tool Name | Status | Description |
---|---|---|
check_vmware_tools |
Alpha | Nagios plugin used to monitor VMware Tools installations. |
check_vmware_vcpus |
Alpha | Nagios plugin used to monitor allocation of virtual CPUs (vCPUs). |
check_vmware_vhw |
Alpha | Nagios plugin used to monitor virtual hardware versions. |
check_vmware_hs2ds2vms |
Alpha | Nagios plugin used to monitor host/datastore/vm pairings. |
check_vmware_datastore |
Alpha | Nagios plugin used to monitor datastore usage. |
The output for these plugins is designed to provide the one-line summary needed by Nagios for quick identification of a problem while providing longer, more detailed information for use in email and Teams notifications (atc0005/send2teams).
Some plugins provide optional support to limit evaluation of VMs to specific Resource Pools (explicitly including or excluding) and power states (on or off). See the configuration options, examples and contrib sections for more information.
check_vmware_tools
Nagios plugin used to monitor VMware Tools installations. See the configuration options section for details regarding how the various Tools states are evaluated.
check_vmware_vcpus
Nagios plugin used to monitor allocation of virtual CPUs (vCPUs).
Thresholds for CRITICAL
and WARNING
vCPUs allocation have usable defaults,
but Max vCPUs allocation is required before this plugin can be used. See the
configuration options section for details.
check_vmware_vhw
Nagios plugin used to monitor virtual hardware versions.
As of this writing, I am unaware of a way to query the current vSphere environment for the latest available hardware version. As a workaround for that lack of knowledge, this plugin applies an automatic baseline of "highest version discovered" across evaluated VMs. Any VMs with a hardware version not at that highest version are flagged as problematic. Please file an issue or open a discussion in this project's repo if you're aware of a way to directly query the desired value from the current vSphere environment.
Instead of trying to determine how far behind each VM is from the newest
version, this plugin assumes that any deviation is a WARNING
level issue.
See GH-33 for future potential changes to this behavior.
check_vmware_hs2ds2vms
Nagios plugin used to monitor host/datastore/vm pairings.
This is a functional plugin responsible for verifying that each VM is housed on a datastore (best) intended for the host associated with the VM.
By default, the evaluation is limited to powered on VMs, but this can be toggled to also include powered off VMs.
The association between datastores and hosts is determined by a user-provided Custom Attribute. Flags for this plugin allow specifying separate Custom Attribute names for hosts and datastores along with optional separate prefixes for the provided Custom Attributes.
This allows for example, hosts to use a Location
Custom Attribute that
shares a datacenter name with datastores using the same Location
Custom
Attribute. If not specifying a prefix separator, the plugin assumes that a
literal, case-insensitive match of the Location
field is required. If a
prefix separator is provided, then the separator is used to retrieve the
common prefix for the Location
Custom Attribute for both hosts and
datastores.
This is intended to work around hosts that may include both the datacenter
name and rack location details in their Custom Attribute (e.g., Location
).
This plugin optionally allows ignoring a list of datastores, and both hosts and datastores that are missing the specified Custom Attribute.
In addition to specifying separate Custom Attribute names (required) and prefix separators (optional), the plugin also accepts a single Custom Attribute used by both hosts and datastores and an optional prefix separator, also used by both hosts and datastores.
If specifying a shared Custom Attribute or prefix, per-resource Custom Attribute flags are rejected (error condition).
check_vmware_datastore
Nagios plugin used to monitor datastore usage.
In addition to reporting current datastore usage, this plugin also reports which VMs reside on the datastore along with their percentage of the total datastore space used.
Features
-
Multiple plugins for monitoring VMware vSphere environments (standalone ESXi hosts or vCenter instances) for select (or all) Resource Pools.
- VMware Tools
- Virtual CPU allocations
- Virtual hardware versions
- Host/Datastore/Virtual Machine pairings (using provided Custom Attribute)
- Datastore usage
-
Optional, leveled logging using
rs/zerolog
package- JSON-format output (to
stderr
) - choice of
disabled
,panic
,fatal
,error
,warn
,info
(the default),debug
ortrace
.
- JSON-format output (to
-
Optional, user-specified timeout value for plugin execution.
Changelog
See the CHANGELOG.md
file for the changes associated with
each release of this application. Changes that have been merged to master
,
but not yet an official release may also be noted in the file under the
Unreleased
section. A helpful link to the Git commit history since the last
official release is also provided for further review.
Requirements
The following is a loose guideline. Other combinations of Go and operating systems for building and running tools from this repo may work, but have not been tested.
Building source code
- Go 1.14+
- GCC
- if building with custom options (as the provided
Makefile
does)
- if building with custom options (as the provided
make
- if using the provided
Makefile
- if using the provided
Running
- Windows 7, Server 2008R2 or later
- per official Go install notes
- Windows 10 Version 1909
- tested
- Ubuntu Linux 16.04, 18.04
Installation
- Download Go
- Install Go
- NOTE: Pay special attention to the remarks about
$HOME/.profile
- NOTE: Pay special attention to the remarks about
- Clone the repo
cd /tmp
git clone https://github.com/atc0005/check-vmware
cd check-vmware
- Install dependencies (optional)
- for Ubuntu Linux
sudo apt-get install make gcc
- for CentOS Linux
sudo yum install make gcc
- for Windows
- Emulated environments (easier)
- Skip all of this and build using the default
go build
command in Windows (see below for use of the-mod=vendor
flag) - build using Windows Subsystem for Linux Ubuntu environment and just copy out the Windows binaries from that environment
- If already running a Docker environment, use a container with the Go tool-chain already installed
- If already familiar with LXD, create a container and follow the installation steps given previously to install required dependencies
- Skip all of this and build using the default
- Native tooling (harder)
- see the StackOverflow Question
32127524
link in the References section for potential options for installingmake
on Windows - see the mingw-w64 project homepage link in the
References section for options for installing
gcc
and related packages on Windows
- see the StackOverflow Question
- Emulated environments (easier)
- for Ubuntu Linux
- Build binaries
- for the current operating system, explicitly using bundled dependencies
in top-level
vendor
foldergo build -mod=vendor ./cmd/check_vmware_tools/
go build -mod=vendor ./cmd/check_vmware_vcpus/
go build -mod=vendor ./cmd/check_vmware_vhw/
go build -mod=vendor ./cmd/check_vmware_hs2ds2vms/
go build -mod=vendor ./cmd/check_vmware_datastore/
- for all supported platforms (where
make
is installed)make all
- for use on Windows
make windows
- for use on Linux
make linux
- for the current operating system, explicitly using bundled dependencies
in top-level
- Copy the newly compiled binary from the applicable
/tmp
subdirectory path (based on the clone instructions in this section) below and deploy where needed.- if using
Makefile
- look in
/tmp/check-vmware/release_assets/check_vmware_tools/
- look in
/tmp/check-vmware/release_assets/check_vmware_vcpus/
- look in
/tmp/check-vmware/release_assets/check_vmware_vhw/
- look in
/tmp/check-vmware/release_assets/check_vmware_hs2ds2vms/
- look in
/tmp/check-vmware/release_assets/check_vmware_datastore/
- look in
- if using
go build
- look in
/tmp/check-vmware/
- look in
- if using
- Review configuration options,
examples
andcontrib
sections usage details.
Configuration options
Threshold calculations
check_vmware_tools
Tools Status | Nagios State | Description |
---|---|---|
toolsOk |
OK |
Ideal state, no problems with VMware Tools (or open-vm-tools ) detected. |
toolsOld |
WARNING |
Outdated VMware Tools installation. The host ESXi system was likely recently updated. |
toolsNotRunning |
CRITICAL |
VMware Tools (or open-vm-tools ) not currently running. It likely crashed or was terminated due to low memory scenario. |
toolsNotInstalled |
CRITICAL |
Fresh virtual environment, or VMware Tools removed as part of an upgrade of an existing installation. |
check_vmware_vcpus
Nagios State | Description |
---|---|
OK |
Ideal state, vCPU allocations within bounds. |
WARNING |
vCPU allocations crossed user-specified threshold for this state. |
CRITICAL |
vCPU allocations crossed user-specified threshold for this state. |
check_vmware_vhw
Nagios State | Description |
---|---|
OK |
Ideal state, no mismatched Host/Datastore/Virtual machine pairings detected. |
WARNING |
Non-homogenous hardware versions. |
CRITICAL |
Not used by this plugin. |
check_vmware_hs2ds2vms
Nagios State | Description |
---|---|
OK |
Ideal state, no mismatched Host/Datastore/Virtual machine pairings detected. |
WARNING |
Not used by this plugin. |
CRITICAL |
Any errors encountered or Hosts/Datastores/VM mismatches. |
check_vmware_datastore
Nagios State | Description |
---|---|
OK |
Ideal state, Datastore usage within bounds. |
WARNING |
Datastore usage crossed user-specified threshold for this state. |
CRITICAL |
Datastore usage crossed user-specified threshold for this state. |
Command-line arguments
- Use the
-h
or--help
flag to display current usage information. - Flags marked as
required
must be set via CLI flag. - Flags not marked as required are for settings where a useful default is already defined, but may be overridden if desired.
check_vmware_tools
Flag | Required | Default | Repeat | Possible | Description |
---|---|---|---|---|---|
branding |
No | false |
No | branding |
Toggles emission of branding details with plugin status details. This output is disabled by default. |
h , help |
No | false |
No | h , help |
Show Help text along with the list of supported flags. |
v , version |
No | false |
No | v , version |
Whether to display application version and then immediately exit application. |
ll , log-level |
No | info |
No | disabled , panic , fatal , error , warn , info , debug , trace |
Log message priority filter. Log messages with a lower level are ignored. |
p , port |
No | 443 |
No | positive whole number between 1-65535, inclusive | TCP port of the remote ESXi host or vCenter instance. This is usually 443 (HTTPS). |
t , timeout |
No | 10 |
No | positive whole number of seconds | Timeout value in seconds allowed before a plugin execution attempt is abandoned and an error returned. |
s , server |
Yes | No | fully-qualified domain name or IP Address | The fully-qualified domain name or IP Address of the remote ESXi host or vCenter instance. | |
u , username |
Yes | No | valid username | Username with permission to access specified ESXi host or vCenter instance. | |
pw , password |
Yes | No | valid password | Password used to login to ESXi host or vCenter instance. | |
domain |
No | No | valid user domain | (Optional) domain for user account used to login to ESXi host or vCenter instance. | |
trust-cert |
No | false |
No | true , false |
Whether the certificate should be trusted as-is without validation. WARNING: TLS is susceptible to man-in-the-middle attacks if enabling this option. |
include-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be exclusively used when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to ignore or exclude from evaluation. | |
exclude-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be ignored when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to include for evaluation. | |
ignore-vm |
No | No | comma-separated list of (vSphere) virtual machine names | Specifies a comma-separated list of VM names that should be ignored or excluded from evaluation. | |
powered-off |
No | false |
No | true , false |
Toggles evaluation of powered off VMs in addition to powered on VMs. Evaluation of powered off VMs is disabled by default. |
check_vmware_vcpus
Flag | Required | Default | Repeat | Possible | Description |
---|---|---|---|---|---|
branding |
No | false |
No | branding |
Toggles emission of branding details with plugin status details. This output is disabled by default. |
h , help |
No | false |
No | h , help |
Show Help text along with the list of supported flags. |
v , version |
No | false |
No | v , version |
Whether to display application version and then immediately exit application. |
ll , log-level |
No | info |
No | disabled , panic , fatal , error , warn , info , debug , trace |
Log message priority filter. Log messages with a lower level are ignored. |
p , port |
No | 443 |
No | positive whole number between 1-65535, inclusive | TCP port of the remote ESXi host or vCenter instance. This is usually 443 (HTTPS). |
t , timeout |
No | 10 |
No | positive whole number of seconds | Timeout value in seconds allowed before a plugin execution attempt is abandoned and an error returned. |
s , server |
Yes | No | fully-qualified domain name or IP Address | The fully-qualified domain name or IP Address of the remote ESXi host or vCenter instance. | |
u , username |
Yes | No | valid username | Username with permission to access specified ESXi host or vCenter instance. | |
pw , password |
Yes | No | valid password | Password used to login to ESXi host or vCenter instance. | |
domain |
No | No | valid user domain | (Optional) domain for user account used to login to ESXi host or vCenter instance. | |
trust-cert |
No | false |
No | true , false |
Whether the certificate should be trusted as-is without validation. WARNING: TLS is susceptible to man-in-the-middle attacks if enabling this option. |
include-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be exclusively used when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to ignore or exclude from evaluation. | |
exclude-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be ignored when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to include for evaluation. | |
ignore-vm |
No | No | comma-separated list of (vSphere) virtual machine names | Specifies a comma-separated list of VM names that should be ignored or excluded from evaluation. | |
powered-off |
No | false |
No | true , false |
Toggles evaluation of powered off VMs in addition to powered on VMs. Evaluation of powered off VMs is disabled by default. |
vcma , vcpus-max-allowed |
Yes | 0 |
No | positive whole number of vCPUs | Specifies the maximum amount of virtual CPUs (as a whole number) that we are allowed to allocate in the target VMware environment. |
vc , vcpus-critical |
No | 100 |
No | percentage as positive whole number | Specifies the percentage of vCPUs allocation (as a whole number) when a CRITICAL threshold is reached. |
vw , vcpus-warning |
No | 95 |
No | percentage as positive whole number | Specifies the percentage of vCPUs allocation (as a whole number) when a WARNING threshold is reached. |
check_vmware_vhw
Flag | Required | Default | Repeat | Possible | Description |
---|---|---|---|---|---|
branding |
No | false |
No | branding |
Toggles emission of branding details with plugin status details. This output is disabled by default. |
h , help |
No | false |
No | h , help |
Show Help text along with the list of supported flags. |
v , version |
No | false |
No | v , version |
Whether to display application version and then immediately exit application. |
ll , log-level |
No | info |
No | disabled , panic , fatal , error , warn , info , debug , trace |
Log message priority filter. Log messages with a lower level are ignored. |
p , port |
No | 443 |
No | positive whole number between 1-65535, inclusive | TCP port of the remote ESXi host or vCenter instance. This is usually 443 (HTTPS). |
t , timeout |
No | 10 |
No | positive whole number of seconds | Timeout value in seconds allowed before a plugin execution attempt is abandoned and an error returned. |
s , server |
Yes | No | fully-qualified domain name or IP Address | The fully-qualified domain name or IP Address of the remote ESXi host or vCenter instance. | |
u , username |
Yes | No | valid username | Username with permission to access specified ESXi host or vCenter instance. | |
pw , password |
Yes | No | valid password | Password used to login to ESXi host or vCenter instance. | |
domain |
No | No | valid user domain | (Optional) domain for user account used to login to ESXi host or vCenter instance. | |
trust-cert |
No | false |
No | true , false |
Whether the certificate should be trusted as-is without validation. WARNING: TLS is susceptible to man-in-the-middle attacks if enabling this option. |
include-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be exclusively used when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to ignore or exclude from evaluation. | |
exclude-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be ignored when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to include for evaluation. | |
ignore-vm |
No | No | comma-separated list of (vSphere) virtual machine names | Specifies a comma-separated list of VM names that should be ignored or excluded from evaluation. | |
powered-off |
No | false |
No | true , false |
Toggles evaluation of powered off VMs in addition to powered on VMs. Evaluation of powered off VMs is disabled by default. |
check_vmware_hs2ds2vms
Flag | Required | Default | Repeat | Possible | Description |
---|---|---|---|---|---|
branding |
No | false |
No | branding |
Toggles emission of branding details with plugin status details. This output is disabled by default. |
h , help |
No | false |
No | h , help |
Show Help text along with the list of supported flags. |
v , version |
No | false |
No | v , version |
Whether to display application version and then immediately exit application. |
ll , log-level |
No | info |
No | disabled , panic , fatal , error , warn , info , debug , trace |
Log message priority filter. Log messages with a lower level are ignored. |
p , port |
No | 443 |
No | positive whole number between 1-65535, inclusive | TCP port of the remote ESXi host or vCenter instance. This is usually 443 (HTTPS). |
t , timeout |
No | 10 |
No | positive whole number of seconds | Timeout value in seconds allowed before a plugin execution attempt is abandoned and an error returned. |
s , server |
Yes | No | fully-qualified domain name or IP Address | The fully-qualified domain name or IP Address of the remote ESXi host or vCenter instance. | |
u , username |
Yes | No | valid username | Username with permission to access specified ESXi host or vCenter instance. | |
pw , password |
Yes | No | valid password | Password used to login to ESXi host or vCenter instance. | |
domain |
No | No | valid user domain | (Optional) domain for user account used to login to ESXi host or vCenter instance. | |
trust-cert |
No | false |
No | true , false |
Whether the certificate should be trusted as-is without validation. WARNING: TLS is susceptible to man-in-the-middle attacks if enabling this option. |
include-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be exclusively used when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to ignore or exclude from evaluation. | |
exclude-rp |
No | No | comma-separated list of resource pool names | Specifies a comma-separated list of Resource Pools that should be ignored when evaluating VMs. This option is incompatible with specifying a list of Resource Pools to include for evaluation. | |
ignore-vm |
No | No | comma-separated list of (vSphere) virtual machine names | Specifies a comma-separated list of VM names that should be ignored or excluded from evaluation. | |
ignore-ds |
No | No | comma-separated list of (vSphere) datastore names | Specifies a comma-separated list of Datastore names that should be ignored or excluded from evaluation. | |
powered-off |
No | false |
No | true , false |
Toggles evaluation of powered off VMs in addition to powered on VMs. Evaluation of powered off VMs is disabled by default. |
ca-name |
Maybe | No | valid Custom Attribute name | Custom Attribute name for host ESXi systems and datastores. Optional if specifying resource-specific custom attribute names. | |
ca-prefix-sep |
Maybe | No | valid Custom Attribute prefix separator character | Custom Attribute prefix separator for host ESXi systems and datastores. Skip if using Custom Attribute values as-is for comparison, otherwise optional if specifying resource-specific custom attribute prefix separator, or using the default separator. | |
ignore-missing-ca |
No | false |
No | true , false |
Toggles how missing specified Custom Attributes will be handled. By default, ESXi hosts and datastores missing the Custom Attribute are treated as an error condition. |
host-ca-name |
Maybe | No | valid Custom Attribute name | Custom Attribute name specific to host ESXi systems. Optional if specifying shared custom attribute flag. | |
host-ca-prefix-sep |
Maybe | No | valid Custom Attribute prefix separator character | Custom Attribute prefix separator specific to host ESXi systems. Skip if using Custom Attribute values as-is for comparison, otherwise optional if specifying shared custom attribute prefix separator, or using the default separator. | |
ds-ca-name |
Maybe | No | valid Custom Attribute name | Custom Attribute name specific to datastores. Optional if specifying shared custom attribute flag. | |
ds-ca-prefix-sep |
Maybe | No | valid Custom Attribute prefix separator character | Custom Attribute prefix separator specific to datastores. Skip if using Custom Attribute values as-is for comparison, otherwise optional if specifying shared custom attribute prefix separator, or using the default separator. |
check_vmware_datastore
Flag | Required | Default | Repeat | Possible | Description |
---|---|---|---|---|---|
branding |
No | false |
No | branding |
Toggles emission of branding details with plugin status details. This output is disabled by default. |
h , help |
No | false |
No | h , help |
Show Help text along with the list of supported flags. |
v , version |
No | false |
No | v , version |
Whether to display application version and then immediately exit application. |
ll , log-level |
No | info |
No | disabled , panic , fatal , error , warn , info , debug , trace |
Log message priority filter. Log messages with a lower level are ignored. |
p , port |
No | 443 |
No | positive whole number between 1-65535, inclusive | TCP port of the remote ESXi host or vCenter instance. This is usually 443 (HTTPS). |
t , timeout |
No | 10 |
No | positive whole number of seconds | Timeout value in seconds allowed before a plugin execution attempt is abandoned and an error returned. |
s , server |
Yes | No | fully-qualified domain name or IP Address | The fully-qualified domain name or IP Address of the remote ESXi host or vCenter instance. | |
u , username |
Yes | No | valid username | Username with permission to access specified ESXi host or vCenter instance. | |
pw , password |
Yes | No | valid password | Password used to login to ESXi host or vCenter instance. | |
domain |
No | No | valid user domain | (Optional) domain for user account used to login to ESXi host or vCenter instance. | |
trust-cert |
No | false |
No | true , false |
Whether the certificate should be trusted as-is without validation. WARNING: TLS is susceptible to man-in-the-middle attacks if enabling this option. |
dc-name |
No | No | valid vSphere datacenter name | Specifies the name of a vSphere Datacenter. If not specified, applicable plugins will attempt to use the default datacenter found in the vSphere environment. Not applicable to standalone ESXi hosts. | |
ds-name |
Yes | No | valid datastore name | Datastore name as it is found within the vSphere inventory. | |
dsuc , ds-usage-critical |
No | 95 |
No | percentage as positive whole number | Specifies the percentage of a datastore's storage usage (as a whole number) when a CRITICAL threshold is reached. |
dsuw , ds-usage-warning |
No | 90 |
No | percentage as positive whole number | Specifies the percentage of a datastore's storage usage (as a whole number) when a WARNING threshold is reached. |
Configuration file
Not currently supported. This feature may be added later if there is sufficient interest.
Contrib
Example Nagios configuration files are provided in an effort to illustrate usage of plugins provided by this project. See the Contrib README and directory contents for details.
Examples
While entries in this section attempt to provide a brief overview of usage, it
is recommended that you review the provided command definitions and other
Nagios configuration files within the contrib
directory for more
complete examples.
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each.
check_vmware_tools
Nagios plugin
CLI invocation
/usr/lib/nagios/plugins/check_vmware_tools --username SERVICE_ACCOUNT_NAME --password "SERVICE_ACCOUNT_PASSWORD" --server vc1.example.com --exclude-rp "Desktops" --ignore-vm "test1.example.com,redmine.example.com,TESTING-AC,RHEL7-TEST" --trust-cert --log-level info
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
Of note:
- The resource pool named
Desktops
is excluded from evaluation.- this results in all other resource pools used for evaluation
- Multiple Virtual machines (vSphere inventory name, not OS hostname), are
ignored, regardless of which Resource Pool they are part of.
test1.example.com
redmine.example.com
TESTING-AC
RHEL7-TEST
- Certificate warnings are ignored.
- not best practice, but many vCenter instances use self-signed certs per various freely available guides
- Logging is enabled at the
info
level.- this output is sent to
stderr
by default, which Nagios ignores - this output is only seen (at least as of Nagios v3.x) when invoking the plugin directly via CLI (often for troubleshooting)
- this output is sent to
Command definition
# /etc/nagios-plugins/config/vmware-tools.cfg
# Look at all pools, all VMs, do not evaluate any VMs that are powered off.
# This variation of the command is most useful for environments where all VMs
# are monitored equally.
define command{
command_name check_vmware_tools
command_line /usr/lib/nagios/plugins/check_vmware_tools --server '$HOSTNAME$' --domain '$ARG1$' --username '$ARG2$' --password '$ARG3$' --trust-cert --log-level info
}
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
check_vmware_vcpus
Nagios plugin
CLI invocation
/usr/lib/nagios/plugins/check_vmware_tools --username SERVICE_ACCOUNT_NAME --password "SERVICE_ACCOUNT_PASSWORD" --server vc1.example.com --exclude-rp "Desktops" --ignore-vm "test1.example.com,redmine.example.com,TESTING-AC,RHEL7-TEST" --vcpus-warning 97 --vcpus-critical 100 --vcpus-max-allowed 160 --trust-cert --log-level info
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
Of note:
- The resource pool named
Desktops
is excluded from evaluation.- this results in all other resource pools used for evaluation
- Multiple Virtual machines (vSphere inventory name, not OS hostname), are
ignored, regardless of which Resource Pool they are part of.
test1.example.com
redmine.example.com
TESTING-AC
RHEL7-TEST
- Certificate warnings are ignored.
- not best practice, but many vCenter instances use self-signed certs per various freely available guides
- Logging is enabled at the
info
level.- this output is sent to
stderr
by default, which Nagios ignores - this output is only seen (at least as of Nagios v3.x) when invoking the plugin directly via CLI (often for troubleshooting)
- this output is sent to
Command definition
# /etc/nagios-plugins/config/vmware-vcpus.cfg
# Look at all pools, all VMs, do not evaluate any VMs that are powered off.
# This variation of the command is most useful for environments where all VMs
# are monitored equally.
define command{
command_name check_vmware_vcpus
command_line /usr/lib/nagios/plugins/check_vmware_vcpus --server '$HOSTNAME$' --domain '$ARG1$' --username '$ARG2$' --password '$ARG3$' --vcpus-warning '$ARG4$' --vcpus-critical '$ARG5$' --vcpus-max-allowed '$ARG6$' --trust-cert --log-level info
}
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
check_vmware_vhw
Nagios plugin
CLI invocation
/usr/lib/nagios/plugins/check_vmware_vhw --username SERVICE_ACCOUNT_NAME --password "SERVICE_ACCOUNT_PASSWORD" --server vc1.example.com --exclude-rp "Desktops" --ignore-vm "test1.example.com,redmine.example.com,TESTING-AC,RHEL7-TEST" --trust-cert --log-level info
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
Of note:
- The resource pool named
Desktops
is excluded from evaluation.- this results in all other resource pools used for evaluation
- Multiple Virtual machines (vSphere inventory name, not OS hostname), are
ignored, regardless of which Resource Pool they are part of.
test1.example.com
redmine.example.com
TESTING-AC
RHEL7-TEST
- Certificate warnings are ignored.
- not best practice, but many vCenter instances use self-signed certs per various freely available guides
- Logging is enabled at the
info
level.- this output is sent to
stderr
by default, which Nagios ignores - this output is only seen (at least as of Nagios v3.x) when invoking the plugin directly via CLI (often for troubleshooting)
- this output is sent to
Command definition
# /etc/nagios-plugins/config/vmware-virtual-hardware.cfg
# Look at all pools, all VMs, do not evaluate any VMs that are powered off.
# This variation of the command is most useful for environments where all VMs
# are monitored equally.
define command{
command_name check_vmware_vhw
command_line /usr/lib/nagios/plugins/check_vmware_vhw --server '$HOSTNAME$' --domain '$ARG1$' --username '$ARG2$' --password '$ARG3$' --trust-cert --log-level info
}
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
check_vmware_hs2ds2vms
Nagios plugin
CLI invocation
/usr/lib/nagios/plugins/check_vmware_vhw --username SERVICE_ACCOUNT_NAME --password "SERVICE_ACCOUNT_PASSWORD" --server vc1.example.com --exclude-rp "Desktops" --ignore-vm "test1.example.com,redmine.example.com,TESTING-AC,RHEL7-TEST" --ca-name "Location" --ca-prefix-sep "-" --trust-cert --log-level info
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
Of note:
- The resource pool named
Desktops
is excluded from evaluation.- this results in all other resource pools used for evaluation
- Multiple Virtual machines (vSphere inventory name, not OS hostname), are
ignored, regardless of which Resource Pool they are part of.
test1.example.com
redmine.example.com
TESTING-AC
RHEL7-TEST
- The Custom Attribute named
Location
is used to dynamically build pairs of Hosts and Datastores. Any Host or Datastore missing that Custom Attribute is reported as an error condition unless the appropriate CLI flag is provided. See the Configuration options section for the flag name and further details. - The Custom Attribute prefix separator
-
is provided in order to "split" the value found for the Custom Attribute namedLocation
into pairs. The second value is thrown away, leaving the first to be used as theLocation
value for comparison. VMs running on a host with one value have their datastores checked for the same value. If a mismatch is found, this is assumed to be aCRITICAL
level event and reported as such. - Certificate warnings are ignored.
- not best practice, but many vCenter instances use self-signed certs per various freely available guides
- Logging is enabled at the
info
level.- this output is sent to
stderr
by default, which Nagios ignores - this output is only seen (at least as of Nagios v3.x) when invoking the plugin directly via CLI (often for troubleshooting)
- this output is sent to
Command definition
# /etc/nagios-plugins/config/vmware-host-datastore-vms-pairings.cfg
# Look at all pools, all VMs, do not evaluate any VMs that are powered off.
# Use the same Custom Attribute for hosts and datastores. Use the same Custom
# Attribute prefix separator for hosts and datastores.
#
# This variation of the command is most useful for environments where all VMs
# are monitored equally.
define command{
command_name check_vmware_hs2ds2vms
command_line /usr/lib/nagios/plugins/check_vmware_hs2ds2vms --server '$HOSTNAME$' --domain '$ARG1$' --username '$ARG2$' --password '$ARG3$' --ca-name '$ARG4$' --ca-prefix-sep '$ARG5$' --trust-cert --log-level info
}
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
check_vmware_datastore
Nagios plugin
CLI invocation
/usr/lib/nagios/plugins/check_vmware_datastore --username SERVICE_ACCOUNT_NAME --password "SERVICE_ACCOUNT_PASSWORD" --server vc1.example.com --ds-name "HUSVM-DC1-vol6" --ds-usage-warning 95 --ds-usage-critical 97 --trust-cert --log-level info
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
Of note:
- Certificate warnings are ignored.
- not best practice, but many vCenter instances use self-signed certs per various freely available guides
- Logging is enabled at the
info
level.- this output is sent to
stderr
by default, which Nagios ignores - this output is only seen (at least as of Nagios v3.x) when invoking the plugin directly via CLI (often for troubleshooting)
- this output is sent to
Command definition
# /etc/nagios-plugins/config/vmware-datastores.cfg
# Look at specific datastore and explicitly provide custom WARNING and
# CRITICAL threshold values.
define command{
command_name check_vmware_datastore
command_line /usr/lib/nagios/plugins/check_vmware_tools --server '$HOSTNAME$' --domain '$ARG1$' --username '$ARG2$' --password '$ARG3$' --ds-usage-warning '$ARG4$' --ds-usage-critical '$ARG5$' --ds-name '$ARG6$' --trust-cert --log-level info
}
See the configuration options section for all command-line settings supported by this plugin along with descriptions of each. See the contrib section for information regarding example command definitions and Nagios configuration files.
License
From the LICENSE file:
MIT License
Copyright (c) 2021 Adam Chalkley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
References
-
Related projects
-
vSphere
-
Logging
-
Nagios
Documentation ¶
Overview ¶
This repo contains various tools used to monitor VMware environments.
PROJECT HOME ¶
See our GitHub repo (https://github.com/atc0005/check-vmware) for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.
PURPOSE ¶
Monitor VMware environments ¶
FEATURES ¶
Nagios plugins for monitoring VMware vSphere environments (standalone ESXi hosts or vCenter instances) for select (or all) Resource Pools.
• VMware Tools
• Virtual CPU allocations
• Virtual hardware versions
• Host/Datastore/Virtual Machine pairings (using provided Custom Attribute)
• Datastore usage
USAGE ¶
See our main README for supported settings and examples.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
config
Package config provides types and functions to collect, validate and apply user-provided settings.
|
Package config provides types and functions to collect, validate and apply user-provided settings. |
textutils
Package textutils provides common helper functions for text manipulation or output used by applications in this module.
|
Package textutils provides common helper functions for text manipulation or output used by applications in this module. |
vsphere
Package vsphere provides various wrapper functions and types for interacting with and monitoring VMware vSphere environments.
|
Package vsphere provides various wrapper functions and types for interacting with and monitoring VMware vSphere environments. |