Giter VIP home page Giter VIP logo

esxi_stats's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esxi_stats's Issues

Ability to monitor multiple ESXi servers and license status?

Came to say thank you for the excellent custom component. I can't believe how easy it was to get access to these key data points.

Is there any chance we can add the ability to monitor multiple individual ESXi servers?

Also, any chance we can add the ability to monitor the license expiration date?

Plugin fails to start

Got error starting the plugin, all data is empty.
HASS latest stable, plugin latest master.

Got 3 hosts in cluster, one is down (network connection error) in vCenter.

Hass error log:
Log Details (ERROR)
Logger: custom_components.esxi_stats
Source: custom_components/esxi_stats/init.py:146
First occurred: 11:16:26 AM (5 occurrences)
Last logged: 11:17:52 AM

local variable 'host_mm_mode' referenced before assignment

I think it matches the case when there are error offline hypervisors in cluster.

Detected I/O inside the event loop

Describe the bug
this has been ongoing. has anyone ever found a fix? rebooted ha this morning and 6 hours later it shows: 1:54:35 PM – util/async_.py (WARNING) - message first occurred at 8:58:29 AM and shows up 11949 times. running esxi 6.5 using ubuntu 18 vm hassio in docker. logs below:

Log Details (WARNING)
Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 8:58:29 AM (11949 occurrences)
Last logged: 1:54:35 PM

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 173: vm_conf = vm.configStatus
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 174: vm_sum = vm.summary
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 175: vm_run = vm.runtime
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 176: vm_snap = vm.snapshot
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 31: current_session = conn.content.sessionManager.currentSession.key
Successfully saved

Expected behavior
A clear and concise description of what you expected to happen.

ESXi environment (please complete the following information):

  • Host/vCenter: ESXi 6.5

Additional context
Add any other context about the problem here.

Incorrect Key message

Describe the bug
From log:
State is set to incorrect key. Check Options in Integration UI

To Reproduce
Appears in log after every restart.

Expected behavior
No log message
Screenshots
If applicable, add screenshots to help explain your problem.

ESXi environment (please complete the following information):

  • Host/vCenter: ESXi 6.5u3

Additional context
Settings from Integrations Options:

Host State Attribute
cpuusage_ghz

Datastore State Attribute
free_space_gb

License State Attribute
status

Virtual Machine State Attribute
used_space_gb

KeyError: 'notify'

Describe the bug
Upon startup of home assistant an error is generated in the logs.

To Reproduce
Install latest beta version of esxi_stats and reboot homeassistant.

Expected behavior
No errors

Screenshots

ESXi environment (please complete the following information):
vCenter as vm on ESXi 6.7

Additional context

Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/config_entries.py", line 335, in async_setup
result = await component.async_setup_entry(hass, self)
File "/home/homeassistant/.homeassistant/custom_components/esxi_stats/init.py", line 139, in async_setup_entry
async_add_services(hass, config_entry)
File "/home/homeassistant/.homeassistant/custom_components/esxi_stats/init.py", line 298, in async_add_services
notify = config_entry.options["notify"]
KeyError: 'notify'

vim.fault.NoPermission

Don't know is if it's a bug or my fault
I added the ESXi Stats integration to my HA 2022.2.5
In the integration panel, i configured ESXi Stats with the ip of the vCenter, user and password (made a read only user for this integration, as i want only to read statistics), but i got some errors in the logs:

ERROR:
(vim.fault.NoPermission) { dynamicType = , dynamicProperty = (vmodl.DynamicProperty) [], msg = '', faultCause = , faultMessage = (vmodl.LocalizableMessage) [], object = 'vim.LicenseManager:LicenseManager', privilegeId = 'Global.Licenses' }

WARNING:
Config entry '10.1.101.31' for esxi_stats integration not ready yet: None; Retrying in background

This is the integration screenshot:
image

  • Host/vCenter: 6.5

I tested the credentials in vSphere 7.0 and were fine.

Unable to configure vCenter

Configuring integration through ui to connect to vsphere 6.7.0.40000 does not work. Adding the integration and selecting the host directly works fine. Log details says:

Config entry for esxi_stats not ready yet. Retrying in 10 seconds.
config_entries.py (WARNING)

  • Config entry for esxi_stats not ready yet. Retrying in 10 seconds.

unsupported operand type(s) for /: 'NoneType' and 'int'
custom_components/esxi_stats/init.py

To Reproduce
Steps to reproduce the behavior:

  1. Run Hass.io
  2. Install component through HACS
  3. Configure Integration through UI
  4. See error in logs and no sensors showing up

Expected behavior
Sensors for my 2 vmware hosts showing up in HA

ESXi environment:

  • vSphere 6.7.0.40000 deployed from appliance
  • 2 hosts running VMware ESXi, 6.5.0, 5969303
  • vCenter standard license
  • Self-Signed certificate

Additional context
Tested running the integration both as dedicated hassio user and default vsphere admin user. Hass.io running dockerized on Ubuntu 18.04 VM, vSphere is appliance downloaded from vmware.com

0.109.0 Detection of blocking I/O in the event loop

LOG
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 173: vm_conf = vm.configStatus Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 174: vm_sum = vm.summary Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 175: vm_run = vm.runtime Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 176: vm_snap = vm.snapshot Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 31: current_session = conn.content.sessionManager.currentSession.key

Active Memory

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Any chance we can change the values it reports for memory for each VM? Right now, it shows memory allocated and memory used. Neither value is really that important. What would really be useful is the current active memory.

Describe alternatives you've considered
None

Additional context
None

Can't start or stop virtual machine

Hi,

As I didn't have this problem before with vCenter, I do have it when configured the ESXi host directly.
When I start or stop a virtual machine I got this error:

This error originated from a custom integration.

Logger: homeassistant.helpers.script.shed_macos
Source: custom_components/esxi_stats/__init__.py:321
Integration: ESXi Stats (documentation, issues)
First occurred: 10:52:43 (1 occurrences)
Last logged: 10:52:43

Shed MacOS: Error executing script. Unexpected error for call_service at pos 1: VM UUID not found
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 367, in _async_step
    await getattr(self, handler)()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 570, in _async_call_service_step
    await service_task
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1636, in async_call
    task.result()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1673, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/home/homeassistant/.homeassistant/custom_components/esxi_stats/__init__.py", line 338, in vm_power
    vm_uuid = async_get_vm_details(vm_name)
  File "/home/homeassistant/.homeassistant/custom_components/esxi_stats/__init__.py", line 321, in async_get_vm_details
    raise ValueError("VM UUID not found")
ValueError: VM UUID not found

and

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/esxi_stats/__init__.py:321
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:52:43 (1 occurrences)
Last logged: 10:52:43

[547075532208] VM UUID not found
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/websocket_api/commands.py", line 192, in handle_call_service
    await hass.services.async_call(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1636, in async_call
    task.result()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1673, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 668, in entity_service_call
    future.result()  # pop exception if have
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/service.py", line 705, in _handle_entity_call
    await result
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/template/switch.py", line 159, in async_turn_on
    await self._on_script.async_run(context=self._context)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 1243, in async_run
    await asyncio.shield(run.async_run())
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 349, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 367, in _async_step
    await getattr(self, handler)()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/script.py", line 570, in _async_call_service_step
    await service_task
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1636, in async_call
    task.result()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/core.py", line 1673, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/home/homeassistant/.homeassistant/custom_components/esxi_stats/__init__.py", line 338, in vm_power
    vm_uuid = async_get_vm_details(vm_name)
  File "/home/homeassistant/.homeassistant/custom_components/esxi_stats/__init__.py", line 321, in async_get_vm_details
    raise ValueError("VM UUID not found")
ValueError: VM UUID not found

configuration.yaml snippet:

switch:
      shed_macos:
        friendly_name: Shed MacOS
        value_template: '{{ (is_state("sensor.esxi_vm_macos", "running")) }}'
        icon_template: >-
          {% if is_state("sensor.esxi_vm_macos", "running"), "running" %}
            mdi:server-network
          {% else %}
            mdi:server-network-off
          {% endif %}
        turn_on:
          service: esxi_stats.vm_power
          data:
            host: 'esxi-fileserver.flissinger.local'
            vm: 'MacOS'
            command: 'on'
        turn_off:
          service: esxi_stats.vm_power
          data:
            host: 'esxi-fileserver.flissinger.local'
            vm: 'MacOS'
            command: 'shutdown'

How to troubleshoot?

How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it? How to use it?

How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?How to use it?

local variable 'host_mm_mode' referenced before assignment

Describe the bug
When trying to integrate a vCenter environment, I get the described error in the HA logs.

To Reproduce
Integrate to vCenter 6.7

Expected behavior
A functional integration, as vCenter i mentioned as compatible

Screenshots
If applicable, add screenshots to help explain your problem.

ESXi environment (please complete the following information):

  • Host/vCenter: vCenter 6.7.0.42000

Additional context
From the logs:

Logger: custom_components.esxi_stats
Source: custom_components/esxi_stats/__init__.py:166
Integration: ESXi Stats (documentation, issues)
First occurred: 18. april 2021 10.36.00 (1137 occurrences)
Last logged: 11.48.43

local variable 'host_mm_mode' referenced before assignment

[BUG] Sensor property renamed `device_state_attributes` to `extra_state_attributes` in HA core

Describe the bug
device_state_attributes has property has been changed to extra_state_attributes

To Reproduce
Steps to reproduce the behavior:
Run 2021.12.0+ of Home Assistant

Expected behavior
n/a

Screenshots
n/a

ESXi environment (please complete the following information):

  • Host/vCenter: Not Applicable

Additional context

(<class 'custom_components.esxi_stats.sensor.esxiSensor'>) implements device_state_attributes. Please report it to the custom component author.

Total Allocated Storage per VM

Is your feature request related to a problem? Please describe.
My apologies for not asking for this when you added total active memory, but I'm hoping we can add the total allocated storage space to the list of attributes for each VM, so we can monitor % free space.

Describe the solution you'd like
Ideally we add the total allocated storage for each VM and/or the percentage of disk space, so we can monitor it.

Describe alternatives you've considered
Obviously we can use ESXi monitoring for this, but it's nice to have it all in HA.

Additional context
None.

snapshots not working in 0.7.0.beta3

Describe the bug
Snapshots not working. I get. It does work in 0.7.0.beta2
I get this in the home assistant log:
2022-08-05 21:19:06.347 ERROR (MainThread) [custom_components.esxi_stats] free variable 'notify' referenced before assignment in enclosing scope

To Reproduce
Steps to reproduce the behavior:
Go to dev tools in HA > services and then:
service: esxi_stats.create_snapshot
data:
host: 192.168.1.x
vm: vmname
name: nightly snapshot2
memory: true
quiesce: true

Expected behavior
A snapshot
I don't see the snapshot task in esxi recent tasks

Screenshots
If applicable, add screenshots to help explain your problem.

ESXi environment (please complete the following information):

  • Host/vCenter: ESXi 7.0u3

Additional context
Add any other context about the problem here.

0.107.0 Issue

Hello,

seems like the latest update is messing with esxi_stats:

Log Details (ERROR)
Logger: homeassistant.config_entries
Source: custom_components/esxi_stats/init.py:102
First occurred: 11:52:35 PM (1 occurrences)
Last logged: 11:52:35 PM

Error setting up entry 192.168.1.76 for esxi_stats
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 216, in async_setup
hass, self
File "/config/custom_components/esxi_stats/init.py", line 102, in async_setup_entry
config[DOMAIN]["monitored_conditions"] = []
TypeError: 'mappingproxy' object does not support item assignment

Please add version to manifest.json

Describe the bug
2021-03-01 12:28:29 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'esxi_stats'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'esxi_stats'

To Reproduce
n/a

Expected behavior
n/a

Screenshots
n/a

ESXi environment (please complete the following information):
n/a

Additional context
n/a

Can't add this as repository in HA

Describe the bug
While following the installation steps to add a Custom Repository, it reports being an invalid repository

To Reproduce
Steps to reproduce the behavior:

  1. Follow the installation step from README
  2. Add the github URL
  3. Notice Invalid repo error

Expected behavior
Repository should be added

ESXi environment (please complete the following information):

  • Host/vCenter: N/A (but it would be vCenter 6.7 U3)

Additional context
When checking the system logs, it shows this:
21-01-10 21:54:11 ERROR (MainThread) [supervisor.store] https://github.com/wxt9861/esxi_stats is not a valid add-on repository 21-01-10 21:54:11 ERROR (MainThread) [supervisor.utils.json] Can't read json from /data/addons/git/90387c89/repository.json: [Errno 2] No such file or directory: '/data/addons/git/90387c89/repository.json' 21-01-10 21:54:11 WARNING (MainThread) [supervisor.store.data] Can't read repository information from /data/addons/git/90387c89/repository.json

Operating System Home Assistant OS 5.10
Supervisor Version 2020.12.7

Thanks in advance!

core-2021.12.1 breaks integration

Describe the bug
Integration not working after upgrading to core-2021.12.1

ESXi environment (please complete the following information):
Supervised setup running on Debian/ESXi

ERROR LOG

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/esxi_stats/init.py:169
Integration: ESXi Stats (documentation, issues)
First occurred: 12:43:46 (1 occurrences)
Last logged: 12:43:46

Error setting up entry 192.168.XXX.XXX for esxi_stats
Traceback (most recent call last):
File "/config/custom_components/esxi_stats/init.py", line 159, in connect
conn = esx_connect(**conn_details)
File "/config/custom_components/esxi_stats/esxi.py", line 18, in esx_connect
si = SmartConnectNoSSL(host=host, user=user, pwd=pwd, port=port)
File "/usr/local/lib/python3.9/site-packages/pyVim/connect.py", line 887, in SmartConnectNoSSL
return SmartConnect(protocol=protocol,
File "/usr/local/lib/python3.9/site-packages/pyVim/connect.py", line 856, in SmartConnect
return Connect(host=host,
File "/usr/local/lib/python3.9/site-packages/pyVim/connect.py", line 265, in Connect
si, stub = __Login(host, port, user, pwd, service, adapter, version, path,
File "/usr/local/lib/python3.9/site-packages/pyVim/connect.py", line 388, in __Login
x = content.sessionManager.Login(user, pwd, None)
File "/usr/local/lib/python3.9/site-packages/pyVmomi/VmomiSupport.py", line 706, in
self.f(*(self.args + (obj,) + args), **kwargs)
File "/usr/local/lib/python3.9/site-packages/pyVmomi/VmomiSupport.py", line 512, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "/usr/local/lib/python3.9/site-packages/pyVmomi/SoapAdapter.py", line 1397, in InvokeMethod
raise obj # pylint: disable-msg=E0702
pyVmomi.VmomiSupport.vim.fault.InvalidLogin: (vim.fault.InvalidLogin) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = 'Cannot complete login due to an incorrect user name or password.',
faultCause = ,
faultMessage = (vmodl.LocalizableMessage) []
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/esxi_stats/init.py", line 167, in connect
raise ConfigEntryNotReady
homeassistant.exceptions.ConfigEntryNotReady: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/esxi_stats/init.py", line 129, in async_setup_entry
lic = await hass.async_add_executor_job(connect, hass, config, entry)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/esxi_stats/init.py", line 169, in connect
esx_disconnect(conn)
UnboundLocalError: local variable 'conn' referenced before assignment

Change cpu_use_% to cpu_use

Unfortunately, the attribute named cpu_use_% cannot be used in the Custom Tamplate Sensor integration because it contains the% character and tense cannot be used.

Warnning in logs

ESXi environment (please complete the following information):

  • Host/vCenter: [e.g. ESXi 6.7]

Additional context
HA logs show :
Logger: homeassistant.util.async_
Source: util/async_.py:105
First occurred: AM12:29:13 (30635 occurrences)
Last logged: PM 5:54:00

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/init.py, line 227: ds_name = ds.summary.name.replace(" ", "_").lower()
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 151: ds_summary = ds.summary
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 162: "connected_hosts": len(ds.host),
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 163: "virtual_machines": len(ds.vm),
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 31: current_session = conn.content.sessionManager.currentSession.key

disable HA notifications

Is your feature request related to a problem? Please describe.
It gets kinda annoying that every time I power on a machine I get a notification in HA.

Describe the solution you'd like
Get an option to disable the notifications in HA for the service call to power on/off a machine.

Describe alternatives you've considered
?

Additional context

Howto add ESXi Stats to integrations

Describe the bug
There is no esxi stats in integrations, howto add it?

To Reproduce
Followed the installation instructions at https://github.com/wxt9861/esxi_stats#installation (using HACS), restarted homeassistant.

Expected behavior
An option to configure the esxi stats integration under integrations.

Screenshots
If applicable, add screenshots to help explain your problem.
image

ESXi environment (please complete the following information):

  • vCenter 6.7.0.42000

In homeassistant log:

2020-04-02 17:39:03 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for esxi_stats which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

Network Utilization

Is your feature request related to a problem? Please describe.
I'm really enjoying this addon, so my apologies if I'm being annoying with requests, but it would be nice to be able to monitor network utilization as well. :)

Describe the solution you'd like
Ideally we pull the network in and out values from vCenter/esxi host.

Describe alternatives you've considered
I can just use vCenter to monitor things, but I am loving this addon and my new VM dashboard.

Additional context
N/A

Error in log upgrading to 2021.4

Got the following error since i upgraded to 2021.4

2021-04-08 18:25:45 ERROR (SyncWorker_11) [custom_components.esxi_stats] (vim.fault.NoPermission) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = '',
faultCause = ,
faultMessage = (vmodl.LocalizableMessage) [],
object = 'vim.Folder:ha-folder-root',
privilegeId = 'System.Read'
}

ESXi Component stopped to report any data - sensor.esxi_stats_xxxx does not exist

Describe the bug
Suddenly ESXi integration component stopper to work. Automatically created sensor.esxi_stats_xxxx is not there and in consequence any sensor template created upo is reporting unknown status.
Side note: at the same time I noticed lots of problems with custom cards components that to not initiate properly (might be related?). These are working showing valid/no/defective data when configured previously. New card configuration not possible, causing error:
Cannot read property ‘setConfig’ of undefined and editor windo goes red.

To Reproduce
Steps to reproduce the behavior:
Nothing specific, this behavior noticed at one point in time without any clear action taken. Since that was around the time of restoring configuration after SD crash it might be related to upgrade of either hassio or component itself.

Expected behavior
Sensors created and usable.

Screenshots
If applicable, add screenshots to help explain your problem.

ESXi environment (please complete the following information):

  • Host/vCenter: ESXi Server 6.0 (free)

Additional context
Entries related to ESXi component setup from log file (unrelated one removed for clarity):

2019-09-16 08:57:28 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for esxi_stats which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

2019-09-16 08:57:30 DEBUG (MainThread) [homeassistant.bootstrap] Setting up {'lovelace', 'system_health', 'tradfri', 'config', 'api', 'conversation', 'light', 'life360', 'switch', 'remote', 'zeroconf', 'speedtestdotnet', 'media_player', 'sensor', 'http', 'webhook', 'input_text', 'zwave', 'updater', 'auth', 'onboarding', 'mobile_app', 'logbook', 'websocket_api', 'input_number', 'shopping_list', 'audiconnect', 'ssdp', 'map', 'cast', 'hacs', 'device_tracker', 'timer', 'discovery', 'emulated_hue', 'netatmo', 'hassio', 'ios', 'script', 'cloud', 'group', 'history', 'weather', 'input_boolean', 'tts', 'sun', 'default_config', 'person', 'automation', 'panel_custom', 'heos', 'zone', 'frontend', 'esxi_stats'}

2019-09-16 08:57:43 INFO (MainThread) [homeassistant.setup] Setting up esxi_stats
2019-09-16 08:57:43 INFO (MainThread) [custom_components.esxi_stats]

esxi_stats
Version: 0.4.1
This is a custom component
If you have any issues with this you need to open an issue here:
https://github.com/wxt9861/esxi_stats/issues


2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats] Setting up host 192.168.52.20
2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Logged in - session 52922c42-f369-dd55-5cda-2ee1489da3a7
2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Checking license type
2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Found VMware ESX Server license
2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Logged out - session 52922c42-f369-dd55-5cda-2ee1489da3a7
2019-09-16 08:57:43 INFO (MainThread) [custom_components.esxi_stats] Service calls are disabled - 192.168.52.20 doesn't have a supported license
2019-09-16 08:57:43 INFO (MainThread) [homeassistant.setup] Setup of domain esxi_stats took 0.3 seconds.
2019-09-16 08:57:43 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.52.20 for esxi_stats
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 190, in async_setup
hass, self
File "/config/custom_components/esxi_stats/init.py", line 201, in async_setup_entry
if config_entry.data["licenses"]:
KeyError: 'licenses'
2019-09-16 08:57:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=esxi_stats>

.... lots of lines regarding setting specific template sensors....

2019-09-16 08:58:07 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.esxi_stats

2019-09-16 08:58:08 ERROR (MainThread) [homeassistant.components.sensor] esxi_stats: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update
await self.async_update()
File "/config/custom_components/esxi_stats/sensor.py", line 40, in async_update
await self.hass.data[DOMAIN_DATA]["client"].update_data()
KeyError: 'client'
2019-09-16 08:58:08 ERROR (MainThread) [homeassistant.components.sensor] esxi_stats: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update
await self.async_update()
File "/config/custom_components/esxi_stats/sensor.py", line 40, in async_update
await self.hass.data[DOMAIN_DATA]["client"].update_data()
KeyError: 'client'

Again lots of errors similar to:
2019-09-16 08:58:11 WARNING (MainThread) [homeassistant.components.template.sensor] Could not render template ESXi Host GHz Used, the state is unknown.
2019-09-16 08:58:11 DEBUG (Dummy-5) [libopenzwave] notif_callback : new notification
2019-09-16 08:58:11 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.esx_host_cpuusage_ghz, old_state=<state sensor.esx_host_cpuusage_ghz=unknown; friendly_name=ESXi Host GHz Used @ 2019-09-16T08:57:53.337484+02:00>, new_state=<state sensor.esx_host_cpuusage_ghz=unknown; friendly_name=ESXi Host GHz Used, icon=mdi:chip @ 2019-09-16T08:57:53.337484+02:00>>
2019-09-16 08:58:11 DEBUG (Dummy-5) [libopenzwave] notif_callback : Notification type : 8, nodeId : 1

Error while configuring integration

I get this error while installing and configuring esxi_stats in home assistant:
2021-10-08 13:59:39 WARNING (MainThread) [homeassistant.config_entries] Config entry 'vcenter.test.nl' for esxi_stats integration not ready yet: None; Retrying in background.

I filled out the credentials but I can't get further than this error.

Host/vCenter: ESXi v7.0
Home Assistant Core Version: 2021.10.1

Add total allocated space for VM

Is your feature request related to a problem? Please describe.
Currently sensor is showing total used space by VM, but does not show total allocated space to VM.

Describe the solution you'd like
An attribute added to VM to show total allocated space.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

get all vm guest ip's?

is it possible to get all vm ip's?

i tried to read the code and i i think i found where the integration get the guest_ip.

if vm_sum.guest.ipAddress:
vm_ip = vm_sum.guest.ipAddress
else:
vm_ip = "n/a"
_LOGGER.debug("Unable to return VM IP address for %s", vm_name)

i tried to change the code in:

if vm_sum.guest.net.IPAddress:
vm_ip = vm_sum.guest.net.ipAddress
else:
vm_ip = "n/a"
_LOGGER.debug("Unable to return VM IP address for %s", vm_name)

but this breaks the integration.

hope you could help.

greetings and big thanks for the integration

ESX build level

Would it be possible to retive the ESX build version, so it would be possible compare it with the latest build version from VMware and the determine if there is an update available.

2 logs in the newest beta that could improve esxi_stats.

the newest hass build has improved logging. And that logging comes with 2 logs for esxi_stats:

Logger: homeassistant.helpers.translation
Source: helpers/translation.py:206
First occurred: 8:02:17 (10 occurrences)
Last logged: 8:33:24

esxi_stats: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this
readme: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this

and:
Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 8:01:42 (2333 occurrences)
Last logged: 8:32:50

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 173: vm_conf = vm.configStatus
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 174: vm_sum = vm.summary
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 175: vm_run = vm.runtime
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 176: vm_snap = vm.snapshot
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for esxi_stats doing I/O at custom_components/esxi_stats/esxi.py, line 31: current_session = conn.content.sessionManager.currentSession.key

Values don't get updated for a long time / leading to unavailable data in Grafana/InfluxDB

Got this data from Developer Menu

sensor.esxi_datastore_datastore1

name: datastore1
type: vmfs
free_space_gb: 47.41
total_space_gb: 110.25
connected_hosts: 1
virtual_machines: 3
unit_of_measurement: Free (GB)
friendly_name: ESXi datastore datastore1

Last changed: August 27, 2021, 1:22:41 AM
Last updated: August 27, 2021, 1:22:41 AM

The time is now: August 28, 2021, 5:47:24 PM

So the stats wasn't updated for a very very long time. This doesn't put data into my InfluxDB.

Would it be ok for you, if I add a fixed update intervall e.g. 60 sec into this?

Undefined line in datastore list

Describe the bug
As seen in this image, I have a undefined line in the datastore list - can't seem to find where it's coming from
image

To Reproduce
Steps to reproduce the behavior:
Setup ESXi stats pointing to a vcenter with a mix of local and central storage

Expected behavior
Not showing the undefined list

ESXi environment (please complete the following information):

  • Host/vCenter: ESXi /vCenter 6.7

https://github.com/wxt9861/esxi_stats is not a valid add-on repository

Hi,
I use HA version 2022.8.6/ Supervisor 2022.08.3/ Operating System 8.4/ Frontend 20220802.0 - latest and I am facing the following error while trying to add it through the Add-On repositories.

I would appreciate for your help.
Nikos

Logger: homeassistant.components.hassio
Source: components/hassio/websocket_api.py:123
Integration: Home Assistant Supervisor (documentation, issues)
First occurred: 8:54:26 PM (1 occurrences)
Last logged: 8:54:26 PM

Failed to to call /store/repositories - https://github.com/wxt9861/esxi_stats is not a valid add-on repository

Cannot remove Esxi Stats from intergrations

Home Assistant 0.107.7

I cannot remove Esxi stats from intergrations after the Esxi server it was connected to has failed.

I have tried removing all devices manaully.
Removing the HACS intergration.

Any suggestions on how to manually remove this from Home assistant

error when setting up entry on 0.107.0b4

Describe the bug
I am testing my configuration on 0.107.0b4 and i am getting an error after a restart of HA.
Component doesnt initilize at all.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 216, in async_setup
    hass, self
  File "/config/custom_components/esxi_stats/__init__.py", line 102, in async_setup_entry
    config[DOMAIN]["monitored_conditions"] = []
TypeError: 'mappingproxy' object does not support item assignment

To Reproduce
Steps to reproduce the behavior:

  1. Join the beta channal
  2. Upgrade to latest beta
  3. restart HA
  4. See error in the logs

Expected behavior
should be working in 0.107, i know this is a beta its more a headsup as in my production HA its working fine.

Screenshots
If applicable, add screenshots to help explain your problem.

ESXi environment (please complete the following information):

  • host version 6.7 full enterprise license

Integration does not show up in Configuration/Integrations

I installed the repo through HACS
restarted HASS
Went to Configuration/Integrations as per instruction to add the integration
It is not in the list....
The files are there in the custom_components tree
Docs for manual installation are not clear on how to setup in configuration.yaml
I tried adding
esxi_stats:
host: 1.1.1.1
username: bleh
password: ******

no errors visible but no entities either.

Some running VMs not reporting guest OS

Describe the bug
Some running VMs are not reporting guest os.

Expected behavior
When a guest OS is running, we're expecting to see the Guest OS that is reported by the VM Tools. Some VMs are not properly reporting this information, causing the component to output None.

The fix would be to fall back on reporting the Guest OS that the VM is configured as. This is the same information that is being reported when the VM is not running.

Metrics stopped updating

Capture

Getting some basic information like snapshot counts, status...but cpu % and ram used stopped updating after a couple of days and now show n/a and -1

Breakout objects into individual sensors.

Is your feature request related to a problem? Please describe.
Nested information is difficult to work with.

Describe the solution you'd like
Breakout objects into individual sensors instead of nesting by type

Add name of snapshots for VM

Could you add the ability to get the name of snapshots ?

When an update is available on HA, I create automatically a snapshot with a unique name. Now, I would like to verify that the snapshot has been created to send me a notification

Thanks

Properly handle null values.

Allow for proper handling if a null value is returned from vm cou usage.

In this case caused by overallCpuUsage =


File "/root/.homeassistant/custom_components/esxi_stats/esxi.py", line 91, in get_vm_info
    ((vm_sum.quickStats.overallCpuUsage / vm_run.maxCpuUsage) * 100), 0
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Error - State is set to incorrect key. Check Options in Integration UI

Describe the bug
I just installed the integration and I was able to configure the lovelace card and sensors but I got a lot of logs regarding this:

2021-10-06 12:52:32 ERROR (SyncWorker_2) [custom_components.esxi_stats.sensor] State is set to incorrect key. Check Options in Integration UI
2021-10-06 12:52:47 ERROR (SyncWorker_0) [custom_components.esxi_stats.sensor] State is set to incorrect key. Check Options in Integration UI
2021-10-06 12:53:02 ERROR (SyncWorker_5) [custom_components.esxi_stats.sensor] State is set to incorrect key. Check Options in Integration UI
2021-10-06 12:53:17 ERROR (SyncWorker_0) [custom_components.esxi_stats.sensor] State is set to incorrect key. Check Options in Integration UI
2021-10-06 12:53:32 ERROR (SyncWorker_7) [custom_components.esxi_stats.sensor] State is set to incorrect key. Check Options in Integration UI
2021-10-06 12:53:47 ERROR (SyncWorker_4) [custom_components.esxi_stats.sensor] State is set to incorrect key. Check Options in Integration UI

HA is core-2021.9.7

To Reproduce
Just installed and tested it

Expected behavior
No errors :)

Screenshots
Logs above

ESXi environment (please complete the following information):

  • Host/vCenter: ESXi v6.7 on Intel NUC

Additional context

Need help with VM Name

Trying to use the esxi_stats.vm_power to shut down a VM.
I just receive the error "Make sure the name is correct"
Am I missing something obvious ? Thank You. Chris

`2021-01-20 15:12:13 DEBUG (MainThread) [custom_components.esxi_stats] Getting stats for vm: nakivobackup
2021-01-20 15:12:13 DEBUG (MainThread) [custom_components.esxi_stats.esxi] {'name': 'nakivobackup', 'status': 'green', 'state': 'running', 'uptime_hours': 94.7, 'cpu_count': 2, 'cpu_use_pct': 0.7, 'memory_allocated_mb': 4096, 'memory_used_mb': 1780, 'used_space_gb': 8.33, 'tools_status': 'toolsOk', 'guest_os': 'Ubuntu Linux (64-bit)', 'guest_ip': '192.168.1.245', 'snapshots': 0}
2021-01-20 15:12:13 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Logged out - session 52f4a939-8603-b640-85e9-265ce8de5198
2021-01-20 15:12:37 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Logged in - session 52a54b0a-91bf-5efc-8c1a-aac9c1bdbbcd
2021-01-20 15:12:37 INFO (MainThread) [custom_components.esxi_stats.esxi] VM nakivobackup on host 192.168.1.242 not found. Make sure the name is correct
2021-01-20 15:12:37 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Logged out - session 52a54b0a-91bf-5efc-8c1a-aac9c1bdbbcd```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.