Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Containers sections needs update to consume API version 3.4 #18

Open
elmigbot opened this issue May 30, 2023 · 19 comments
Open

Containers sections needs update to consume API version 3.4 #18

elmigbot opened this issue May 30, 2023 · 19 comments

Comments

@elmigbot
Copy link

3.4 puts container information under the "containers" plugin. (3.3 was "docker")

Also, "containers" omits some info, putting specific container data at top level. (i.e. http://localhost:61208/api/3/docker/containers becomes http://localhost:61208/api/3/containers

@freeDom-
Copy link

This is a breaking change. It would be great if you could create a PR adding the maximum supported version to the HA documentation.

I don't think that it should be changed atm, because Debian 11 (which HA supports) currently uses Glances 3.2.1 as default. Dont know which v HA OS ships with, but probably the same?

@elmigbot
Copy link
Author

I believe most people would be using the glances Add-on from the "Home Assistant Community Add-ons". The Add-on updated to 3.4 in version 0.19 back in May.

https://github.com/hassio-addons/addon-glances/releases/tag/v0.19.0

@freeDom-
Copy link

I believe most people would be using the glances Add-on from the "Home Assistant Community Add-ons". The Add-on updated to 3.4 in version 0.19 back in May.

https://github.com/hassio-addons/addon-glances/releases/tag/v0.19.0

I don't think that most people are using the addon, but indeed that is a problem! The addon should not use a version, which is currently not supported, because of API changes.

On the long term I agree that we need to make that change anyways.

In order to not break older versions it is probably best, if it would be configurable by creating an option such as "Use legacy v3 API". Then when data is pulled this is done according to the flag.

@elmigbot
Copy link
Author

Maybe just look for http://localhost:61208/api/3/containers, but if not available, then look for http://localhost:61208/api/3/docker/containers?

@freeDom-
Copy link

Maybe just look for http://localhost:61208/api/3/containers, but if not available, then look for http://localhost:61208/api/3/docker/containers?

Generally OK and definitely the easy way for implementing, but it would result in two api calls instead of one, slowing everything down unnecessarily and creating more load. Why ask for something when knowing it does not exist?

@elmigbot
Copy link
Author

True...

But, if it calls the new and expected API first, then its only one call for the majority of the time. And as time goes by, it becomes less and less likely to make the second call.

The trade-off is a breaking-change VS unnecessary load for a specific and dissappearing scenario. Maybe if the flag defaults to the latest version, it tips the scale toward the flag approach. (Only if the latest is prevalent).

@vajonam
Copy link

vajonam commented Oct 5, 2023

Can confirm this PR works with latest glances to get the containers information! please pull this in!

@LeeThompson
Copy link

I'm running home assistant in a docker container, I don't think I can use the "add on" if I wanted to so... yeah please fix this.

@elmigbot
Copy link
Author

elmigbot commented Oct 11, 2023

True...

But, if it calls the new and expected API first, then its only one call for the majority of the time. And as time goes by, it becomes less and less likely to make the second call.

The trade-off is a breaking-change VS unnecessary load for a specific and dissappearing scenario. Maybe if the flag defaults to the latest version, it tips the scale toward the flag approach. (Only if the latest is prevalent).

...or the integration uses an ALL endpoint rendering this discussion pointless :)

Good job @engrbm87 Thanks @vajonam !

@vajonam
Copy link

vajonam commented Oct 11, 2023

in the near term,

execute this inside the HA docker container, will need to do this after each update.

cd /usr/local/lib/python3.11/site-packages/glances_api
rm __init__.py
wget https://raw.githubusercontent.com/home-assistant-ecosystem/python-glances-api/0fa529b3c9a10afcdec50b191c559acbeebb6d9f/glances_api/__init__.py

@bratanon
Copy link

So #21 is now merged which fixes this issue. Time to close this one?

@vajonam
Copy link

vajonam commented Oct 22, 2023

not sure how issues are closed, if its done after the release, but I think it can be closed. masted on that merge

@LeeThompson
Copy link

I'm still not seeing containers in the docker version of HomeAssistant's "Glances" provider. (I delete the integration and re-add it.)
The Glances integration is working, it just doesn't show any docker container information.
If I access Glances directly, I see the container information as expected.

HomeAssistant Information:

Version: 2023.11.0
Frontend 20231030.1

I should note I'm using linuxserver.io's docker image: https://hub.docker.com/r/linuxserver/homeassistant
The image is linuxserver/homeassistant:latest@sha256:7a307f78e79168bdd6d19a493f08b7646607e45ff22a956c97ae32fe521c8235

The glances image is docker.io/nicolargo/glances:latest@sha256:d79dd333a67008403a8b05dfcd827283b453ebc5732801519a39fa545c9bbb91

@vajonam
Copy link

vajonam commented Nov 2, 2023

Yeah not sure its been merged in. @bratanon do you know which HA release this will be included in?

@freeDom-
Copy link

freeDom- commented Nov 2, 2023

Yeah not sure its been merged in. @bratanon do you know which HA release this will be included in?

First of all @fabaff would need to release a new version of the Glances API. Afterwards the Glances API version needs to be bumped in the Home Assistant repository before the changes will be applied to the Glances Home Assistant Integration.

@vajonam
Copy link

vajonam commented Jan 9, 2024

@fabaff , can you please release a version that addresses this? so that HA can then be bumped to use it please?

@XtracT
Copy link

XtracT commented Jan 25, 2024

Hello!

I assume that now with 0.5.1 released, the only thing missing is to bump the version number here @cohenchris ?:

https://github.com/home-assistant/core/blob/dev/homeassistant/components/glances/manifest.json

@engrbm87
Copy link
Contributor

Version 0.5.0 already includes provision for 'containers' as well as 'dockers' keys. This is already in the latest HA core.

@LeeThompson
Copy link

I'm running HA 2024.3.3 Frontend 20240307.0 (docker) and Glances info is still greatly reduced from what it used to be.
For docker data I get the number of active containers, and a summary of CPU and memory usage (for all containers, not individually)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants