Custom Component - ESXi Stats

Mine is similar
image
image

Seems we might have a bug on our hands. Might try rolling back the install via HACS tomorrow just to see if that changes anything

This is not a bug, they are 2 different stats.

Active guest memory is what the hypervisor estimates the VM is using.

Consumed host memory is how much ram the hypervisor has allocated to the VM, including any overhead - this is the stat weā€™re pulling. If you add up all the consumed host memory you should get the total which is close to the total used memory for the VMHost.

1 Like

Yeah I get that. It seems that Memory Allocated MB in your component should be pulling from the Consumed Host Memory in ESXi, and Memory Used MB should be pulling form the Active Guest Memory, right? It the examples above, those number are way off though

The metrics are correct, maybe the wording needs to be changed.

Memory Allocated MB is how much RAM you allocated to the VM in the VM configuration. In the screenshot you provided, it is 16384 or 16GB. I can change it to Memory Configured
Memory Usage is how much RAM the host has allocated to the VM (including overhead). In the screenshot you provided it is 16479 or 16.09GB. I can change it to Memory Allocated.

So basically looking at Allocated and Consumed does not make sense, since this is basically what is preconfigured at VM setup and what OS tries to allocate to machine, without looking at actual usageā€¦ What we really need is Active Guest memory, that shows if allocated memory was right for the machine (close to 100%) or overestimated (way below 100%) and how is it changing over time. Otherwise we are getting 2 very similar and mostly static numebrs, that tell nothing about potential VM performace problems. But I do not think it is available?

I donā€™t agree with this - the host will allocate memory when it is needed. If you configure VM with 32GB but only ever need 4, the host is not going to allocate all 32GB just because.

Active memory is also not the best metric to use for right sizing, I am going to refer you to this article - Understanding vSphere Active Memory - VMware vSphere Blog

It sounds like you want to know what is going on with the VM on the OS level. There are better tools to monitor those conditions (netdata, glances, etd). The purpose of this component is to see what is happening on the host level.

1 Like

Fully agree, I want to know what is going on VM level! And Iā€™d prefer to have this in one place, in commonly accessed set of sensors from one integration rather, than have several different other components, perhaps one per VM to gather data from. Issue is here, that in some cases I even do not know what is underlying OS for some of appliances that Iā€™m using, nor if it is possible to monitor OS level data for these. For some appliances, even if underlying OS is known and supports some monitoring component installation, actual implementaion might be striped down to minimum, prohibiting installation of for example VMware tools.
Said that, if these sensors that ESXi integration exposes to you are fitting your needs - perfect. But this is not what Iā€™d expect/desire. If I allocate 4GB to my HA VM and I see that all 4GB are used, I might think that more is needed. But then when I look at HA memory use via sysmonitor I see that only 23% of allocated RAM is used. So what is the sense of ESXi Memory Consumed sensor? Indeed only if you look at this from host perspective.
Luckily for HA there are sensors available, so I can check. For other VMs not.

1 Like

Thanks for the clarification. :slight_smile:

Ah, and one more thing why my approach is different; my server has 32GB of RAM and all of my allways-on VMs are configured to use 24GB all togethe. So it leaves also plenty of capacity for host itself. Thats why current setup is not so much interesting for me, as host is able to allocate all of configured amount of RAM to respective VMs. For sure this would be different situation if Iā€™d have overprovisioned RAM and host would need to dynamically manage RAM depending on VM load. Then such sensors would be of great use!

Not to upstage the ESXi Stats Component, because I do still use it to monitor the Datastores and whatnot, but if you want a closer look into the VMs themselves, take a look at OpenHardwareMonitor. Basically you set it up on the VM, and enable the web console for OHM Then there is a Component for HA to read the web console for each of your machines. I use both side by side: ESXi Stats for the top level view, and OHM for a close up of each VM.

Just installed via HACS custom repo and restarted HA.
I get the warning in the log about the component, so it seems to be loading.
But, nothing in the integrations, I missed something ?

When in the integrations press F5 to issue a refresh, then hit the +. Itā€™ll show in the list then.

That did the job !
Many thanks.

I get a lot of errors:

Logger: homeassistant.util.async_
Source: util/async_.py:105
First occurred: 13 september 2020 17:34:04 (121410 occurrences)
Last logged: 20:50: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/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

That error isnt an error, merely a warning. You can safely ignore it.

Thereā€™s already a github issue for it, but will take time to correct and doesnt not effect anything negatively other than spamming the log with that warning.

Add following option to logger configuration in your configuration.yaml to get rid of these:

logger:
  default: warning
  logs:
    ...
    homeassistant.esxi_stats: error     # line to add
    ...

Still the same errors in the log (changed config and did restart)

Because itā€™s wrong :stuck_out_tongue:

logger:
  default: warning
  logs:
    ...
    custom_components.esxi_stats: error
    ...

is what you want.

Me too ā€“ hopefully the issue gets resolved soon!