Home Assistant Community Add-on: Glances

Is there anyway to create rest template sensor with the Glance addon? I have tried to create the below sensor but it just gives me a “401 Access Denied” as the sensor state. Is there anyway to resolve this error?

- platform: rest
  resource: http://192.168.1.199:61208/api/3/uptime
  name: VM Uptime
  value_template: '{{ value }}'
  scan_interval: 60

Just to follow up on my last message. I was able to get it to work by adding username and password lines to my rest sensor, this isn’t in any of the examples that I have found to read glances sensors. I didn’t realize there was not supposed to be a username/password for glances. I don’t have one in the integration configuration.

I am using this module and it is working fine.

Can I configure it to also show CPU temps or is this not possible in my setup (Hassio in Proxmox VM)?

Hi all. Introduced

glances:
  - host: *my_IP*

When I go to Integrations I see Glances there under “Discovered” with a Configure" button.

When I hit the configure button I get the screen below. Nothing I put in the username/password/port fields seem to matter. It is unable to connect to host. Seems I’m missing a bunch here. What do I use here? Is there a super noob guide somewhere? I did not see one.

Thanks!

Dear @frenck: Would it be possible to add the build-in Prometheus exporter to the add-on?

https://glances.readthedocs.io/en/stable/gw/prometheus.html

Thank You for asking this - I was having the same issues and the config you posted and replies below helped solve for it.

1 Like

As per the add-on documenation (tab) the default port should be 61209 instead of 61208.

image

After changing the port I was able to setup the HA Glances integration.

1 Like

HI guys. Can someone tell me if it’s possible to export the glances sensor info out to mqtt and if so how? I have it outputting into influxdb already so maybe there’s a way out there, but would rather go straight from glances. thx

A while ago I broke some things when updating my Debian host and docker. Now I cannot run Glances anymore, it throws the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 259, in _raise_for_status
    response.raise_for_status()
  File "/usr/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.41/images/7088e20389854f7641923dbb814ac3c6b635609a6cbe5b0c7f3d24f77052d301/json
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/bin/glances", line 11, in <module>
    load_entry_point('Glances==3.1.5', 'console_scripts', 'glances')()
  File "/usr/lib/python3.8/site-packages/glances/__init__.py", line 143, in main
    start(config=config, args=args)
  File "/usr/lib/python3.8/site-packages/glances/__init__.py", line 108, in start
    mode = GlancesMode(config=config, args=args)
  File "/usr/lib/python3.8/site-packages/glances/webserver.py", line 41, in __init__
    self.stats.update()
  File "/usr/lib/python3.8/site-packages/glances/stats.py", line 234, in update
    self._plugins[p].update()
  File "/usr/lib/python3.8/site-packages/glances/plugins/glances_plugin.py", line 925, in wrapper
    ret = fct(self, *args, **kw)
  File "/usr/lib/python3.8/site-packages/glances/plugins/glances_plugin.py", line 935, in wrapper
    ret = fct(*args, **kw)
  File "/usr/lib/python3.8/site-packages/glances/plugins/glances_docker.py", line 221, in update
    container_stats['Image'] = container.image.tags
  File "/usr/lib/python3.8/site-packages/docker/models/containers.py", line 40, in image
    return self.client.images.get(image_id.split(':')[1])
  File "/usr/lib/python3.8/site-packages/docker/models/images.py", line 316, in get
    return self.prepare_model(self.client.api.inspect_image(name))
  File "/usr/lib/python3.8/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/docker/api/image.py", line 245, in inspect_image
    return self._result(
        File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 265, in _result
    self._raise_for_status(response)
  File "/usr/lib/python3.8/site-packages/docker/api/client.py", line 261, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/lib/python3.8/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.ImageNotFound: 404 Client Error: Not Found ("no such image: 7088e20389854f7641923dbb814ac3c6b635609a6cbe5b0c7f3d24f77052d301: No such image: sha256:7088e20389854f7641923dbb814ac3c6b635609a6cbe5b0c7f3d24f77052d301")
Terminated

Completely removing Glances and reinstalling doesn’t seem to work. Anyone any idea?

1 Like

I had the same problem. i was running a docker image with the same name as the docker contianer in the glances error in your case 7088e20389854f7641923dbb814ac3c6b635609a6cbe5b0c7f3d24f77052d301 look in docker/portianer for a container that matches that sting in your error log. when you find it recreate that container. now check if the contrainer got a different string. most likely it will. now reinstall glances and try again.

Hiyas,

Is it possible to add IP addresses to the webview display in the addon?
can you just add something under the network plugins in the glances.conf?
Do I need to do a pull request for it? (i saw that somewhere when skim reading)

Glances doc pdf

# curl http://localhost:61208/api/3/ip
{'address': '192.168.0.49',
'gateway': '192.168.0.254',
'mask': '255.255.255.0',
'mask_cidr': 24,
'public_address': '88.165.169.242'}

Can anyone explain why I often see my ctx_sw in red? Supposedly it is not good but I have found old threads saying that it may not be calculated properly and therefore irrelevant. If it is calculated properly and it is relevant, can someone tell me what I need to do to not have it turn red? It is red when the number is around 5000.

My Home Assistant is running on a Lenovo M920q Tiny PC with an I7-8700T and 32GB of RAM. I’ve assigned plenty of resources to it, likely super overkill.

Anyone else getting this?

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:103
First occurred: 12:03:55 PM (2 occurrences)
Last logged: 12:04:56 PM

Detected integration that called async_timeout.timeout with loop keyword argument. The loop keyword argument is deprecated and calls will fail after Home Assistant 2022.2. Please report issue for glances using this method at homeassistant/components/glances/__init__.py, line 125: await self.api.get_data()
Detected integration that called async_timeout.timeout with loop keyword argument. The loop keyword argument is deprecated and calls will fail after Home Assistant 2022.2. Please report issue for glances using this method at homeassistant/components/glances/__init__.py, line 113: await self.api.get_data()

EDIT: Looks like it’s been reported:

Silly question about Glances configuration from a newbie with HA: where is it stored?

I saved what is in the configuration tab, but I can’t see it in the configuration.yaml.

I tried adding the following on configuration.yaml, but it didn’t work:

glances: !include glances.yaml

The glances.yaml is very similar to yours. I changed refresh_time to 60 to see if it was working, but after rebooting the addon, it still refreshing every 10s …

Hi, I just installed Glances on a remote windows pc. I can use my browser to show the website. I can use the curl command to get a sensor value. I added the integration to hass, filled in the ip address of the remote server and the correct (default) port. But it is not adding any sensors.
In the hass logfile I get the following errors:

2022-04-13 21:27:03 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up glances platform for sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 249, in _async_setup_platform
await asyncio.shield(task)
File “/usr/src/homeassistant/homeassistant/components/glances/sensor.py”, line 50, in async_setup_entry
elif client.api.data[description.type]:
KeyError: ‘docker’

What could be the issue here?

Hello, I just had this exact same issue.
For me, the problem was that I was running glances inside of a docker container and for some reason that breaks the glances integration.
After I installed glances natively on the system, it seems to all work as expected.

Thanks for the hint. This would explain, why glances didn’t work for me as well.

However: How can I monitor an Unraid NAS with glances, if docker is not supported? With unraid, everything has to be dockerized to work, no native installs possible. Is there an alternate solution, to integrate monitoring into HA?

I’ve opened a bug report here: Glances stopped working after update to 2022.4 · Issue #70373 · home-assistant/core · GitHub

I’m not running glances in docker, but I am running home assistant in docker

The issue seems to be with the latest version of Glances. Until a fix is rolled out, try using Glances v3.2.4.2.