Add raid monitoring to glances (#56623)
parent
495e5cb1c0
commit
b64b926e13
|
@ -194,4 +194,16 @@ SENSOR_TYPES: tuple[GlancesSensorEntityDescription, ...] = (
|
||||||
native_unit_of_measurement=DATA_MEBIBYTES,
|
native_unit_of_measurement=DATA_MEBIBYTES,
|
||||||
icon="mdi:docker",
|
icon="mdi:docker",
|
||||||
),
|
),
|
||||||
|
GlancesSensorEntityDescription(
|
||||||
|
key="used",
|
||||||
|
type="raid",
|
||||||
|
name_suffix="Raid used",
|
||||||
|
icon="mdi:harddisk",
|
||||||
|
),
|
||||||
|
GlancesSensorEntityDescription(
|
||||||
|
key="available",
|
||||||
|
type="raid",
|
||||||
|
name_suffix="Raid available",
|
||||||
|
icon="mdi:harddisk",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,6 +38,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
description,
|
description,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
elif description.type == "raid":
|
||||||
|
for raid_device in client.api.data[description.type]:
|
||||||
|
dev.append(GlancesSensor(client, name, raid_device, description))
|
||||||
elif client.api.data[description.type]:
|
elif client.api.data[description.type]:
|
||||||
dev.append(
|
dev.append(
|
||||||
GlancesSensor(
|
GlancesSensor(
|
||||||
|
@ -214,3 +217,7 @@ class GlancesSensor(SensorEntity):
|
||||||
self._state = round(mem_use / 1024 ** 2, 1)
|
self._state = round(mem_use / 1024 ** 2, 1)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self._state = STATE_UNAVAILABLE
|
self._state = STATE_UNAVAILABLE
|
||||||
|
elif self.entity_description.type == "raid":
|
||||||
|
for raid_device, raid in value["raid"].items():
|
||||||
|
if raid_device == self._sensor_name_prefix:
|
||||||
|
self._state = raid[self.entity_description.key]
|
||||||
|
|
Loading…
Reference in New Issue