wxt9861 / esxi_stats

ESXi component for Home Assistant
MIT License
145 stars 40 forks source link
esxi hacs home-assistant integration vmware

ESXi Stats

hacs_badge

ESXi component for Home Assistant This component will gather stats from an ESXi server or vCenter. Information gathered can be Host, Datastore, License, and VM info. Information is gathered approximately every 45 seconds. A sensor is created for each discovered monitored object (since release 0.5.0). The sensor state can be changed to suit your needs.

The component pulls the following information:

Sensor Example Datastore Sensor Example

Installation

HACS

  1. Open HACS > Settings
  2. In ADD CUSTOM REPOSITORY box paste this git's URL https://github.com/wxt9861/esxi_stats and select type Integration
  3. Click INSTALL
  4. Configure via Integrations page or Make necessary modifications to your configuration.yaml
  5. Restart Home Assistant

Manual install

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called esxi_stats.
  4. Download all the files from the custom_components/esxi_stats/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Add esxi_stats: to your HA configuration (see examples below)
  7. Restart Home Assistant

Configuration options

Key Type Required Default Description
host string True None ESXi host or vCenter
username string True None Username to ESXi host or vCenter
password string True None Password to ESXi host or vCenter
verify_ssl boolean False False Leave at default if your ESXi host or vCenter is using a self-signed certificate (most likely scneario). Change to true if you replaced a self-signed certificate. If you're using a self-signed cert and set this to True, the component will not be able to establish a connection with the host/vcenter.
monitored_conditions list False all What information do you want to get from the host/vcenter. Available options are vmhost, datastore, license, and vm

ESXi Stats can be configured via Integrations page or in yaml. While yaml is currently allowed, support is likely to be dropped in the future releases.

Integration UI

  1. From Home Assistant UI go to Confinguration > Integrations
  2. Click the orange + icon at the bottom right to bring up new integration window
  3. Find and click on ESXi Stats
  4. Enter required information and click Submit

Sensor States

You can control what attribute key each sensor type displays as a state. For example, you can set VM sensors to display their uptime as their sensor state. To change the state of each sensor type:

  1. From Home Assistant UI go to Configuration > Integrtions > ESXi Stats integation
  2. In the upper right corner click on the gears icon to bring up the options menu
  3. Enter the attribute you want displayed as the state
  4. Restart HASS

Options Example

To enable debug

logger:
  logs:
    custom_components.esxi_stats: debug

Service Calls

Service calls are only available with a full ESXi license. On start up the component will scan available licenses and register services only if a compatible license is found.

To issue a command:

  1. Select the service from the Development Tools > Services > Service dropdown
  2. Enter required data

The following serivces are available:

Some commands provide status (ex. suspending a VM or resuming a VM), while other commands are fire and forget (ex. reboot/shutdown). Commands that provide status will output info messages to logger and create a persistent notification when they are complete.

When executing commands, understand what each command does (ex. to gracefully shutdown, send a shutdown command not an off command)

Presenting Data in Home Assistant

A custom lovelace card would be ideal, but for now I explored existing available tools since I'm not too thrilled about diving into creating custom cards