Glances - Monitor multiple disks

I have just started using Glances and have added them to HASS without issue.
However, I cannot see any way to monitor more than one Disk (FILE SYS) FS as Glances only seems to monitor the first disk: sensor code.

        if self.type == 'disk_use_percent':
            return value['fs'][0]['percent']
        elif self.type == 'disk_use':
            return round(value['fs'][0]['used'] / 1024**3, 1)
        elif self.type == 'disk_free':
            try:
                return round(value['fs'][0]['free'] / 1024**3, 1)
            except KeyError:
                return round((value['fs'][0]['size'] -
                              value['fs'][0]['used']) / 1024**3, 1)

I have looked at SINGLE VALUE FROM A LOCAL GLANCES INSTANCE but cannot make sense of it and think really it should be part of the component code.

Any ideas regarding monitoring more than one disk?

I use the stadadrd glances to report some values and the primary disk and then a rest sensor to grab the other disks (separate Raid for Zoneminder):

- platform: rest
  resource: http://192.168.X.XXX:XXXXX/api/2/fs
  name: WWEServer HD ZM
  value_template: '{{ value_json[1].used| multiply(0.000000001)| round(1) }}'
  unit_of_measurement: GB
- platform: rest
  resource: http://192.168.X.XXX:XXXXX/api/2/sensors
  name: WWEServer HDD Temp
  value_template: '{{ (value_json[3].value| multiply(1.8) + 32)| round(1) }}'
  unit_of_measurement: °F
6 Likes

Brilliant, thank you for your examples. I was really struggling with the JSON templates and started to dig myself into a hole. Looking at the glances component it would be great if someone would be able to do a pull request with an aim to modify the code to count the number of hard drives and return the values for all of them in an array-list or equivalent.

I’ve been using this for a while, but now Glances seems to be changing the array index order in which it reports the disks. It hadn’t done this for a while but seems to have changed it twice within a few days. This means the HA sensor is now reading a totally different drive than before.

How can I prevent this or is there better software to use? Has nobody else come across this?

Edit: Couldn’t be bothered to try and fix Glances. It’s easier to just grab the values manually via SSH and then you there’s no messing with ordering etc.