check-vmware | check_vmware_host_memory
plugin
- Overview
- Output
- Performance Data
- Optional evaluation
- Installation
- Configuration options
- Contrib
- Examples
- License
- References
Nagios plugin used to monitor ESXi host memory.
In addition to reporting current host memory usage, this plugin also reports which VMs are on the host (running or not), how much memory each VM is using as a fixed value and as a percentage of the host's total memory.
Thresholds for CRITICAL
and WARNING
memory usage have usable defaults, but
max memory usage is required before this plugin can be used. See the
configuration options section for details.
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 display within the web UI, use in email and Teams notifications (atc0005/send2teams).
See the main project README for details.
Initial support has been added for emitting Performance Data / Metrics, but refinement suggestions are welcome.
Consult the list below for the metrics implemented thus far, the original discussion thread and the Add Performance Data / Metrics support project board for an index of the initial implementation work.
Please add to an existing Discussion thread or open a new one with any feedback that you may have. Thanks in advance!
NOTE: These metrics are based on the visibility of the service account used to login to the target VMware environment. If the service account cannot see a resource, it cannot evaluate the resource.
Metric | Unit of Measurement | Description |
---|---|---|
time |
milliseconds | plugin runtime |
vms |
all (visible) virtual machines on the host | |
vms_powered_on |
virtual machines powered on | |
vms_powered_off |
virtual machines powered off | |
memory_usage |
percentage | cpu usage |
memory_total |
Hz | the total amount of CPU capacity for the host |
memory_used |
Hz | the consumed host memory |
memory_remaining |
Hz | the remaining host memory |
Some plugins provide optional support to limit evaluation of VMs to specific
Resource Pools (explicitly including or excluding) and power states (on or
off). Other plugins support similar filtering options (e.g., Acknowledged
state of Triggered Alarms). See the configuration
options, examples and
contrib sections for more information.
See the main project README for details.
Nagios State | Description |
---|---|
OK |
Ideal state, memory usage for the specified ESXi host system is within bounds. |
WARNING |
Memory usage crossed user-specified threshold for this state. |
CRITICAL |
Memory usage crossed user-specified threshold for this state. |
- 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.
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. Log messages are sent to stderr by default. See Output for more information. |
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. This is needed for user accounts residing in a non-default domain (e.g., SSO specific domain). | |
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. | |
host-name |
Yes | No | valid ESXi host name | ESXi host/server name as it is found within the vSphere inventory. | |
mc , memory-usage-critical |
No | 95 |
No | percentage as positive whole number | Specifies the percentage of memory use (as a whole number) when a CRITICAL threshold is reached. |
mw , memory-usage-warning |
No | 80 |
No | percentage as positive whole number | Specifies the percentage of memory use (as a whole number) when a WARNING threshold is reached. |
Not currently supported. This feature may be added later if there is sufficient interest.
See the main project README for details.
/usr/lib/nagios/plugins/check_vmware_host_memory --username SERVICE_ACCOUNT_NAME --password "SERVICE_ACCOUNT_PASSWORD" --server vc1.example.com --host-name "esx1.example.com" --memory-usage-warning 80 --memory-usage-critical 95 --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 host name is specified (via
host-name
flag) using the exact value shown in the vSphere inventory (e.g.,esx1.example.com
) - Certificate warnings are ignored.
- not best practice, but many vCenter instances use self-signed certs per various freely available guides
- Service Check results output is sent to
stdout
- Logging output is enabled at the
info
level.- logging output is sent to
stderr
by default - logging output is intended to be seen when invoking the plugin directly
via CLI (often for troubleshooting)
- see the Output section of the main README for potential conflicts with some monitoring systems
- logging output is sent to
# /etc/nagios-plugins/config/vmware-host-memory.cfg
# Look at a specific host and explicitly provide custom WARNING and CRITICAL
# threshold values.
define command{
command_name check_vmware_host_memory
command_line $USER1$/check_vmware_host_memory --server '$HOSTNAME$' --domain '$ARG1$' --username '$ARG2$' --password '$ARG3$' --memory-usage-warning '$ARG4$' --memory-usage-critical '$ARG5$' --host-name '$ARG6$' --trust-cert --log-level info
}
See the main project README for details.