From 86d6520c62cb3d5e7f8f0999b96e2ee8691ac591 Mon Sep 17 00:00:00 2001 From: Tomy Guichard Date: Wed, 3 May 2023 21:43:49 +0200 Subject: [PATCH] fix livebox_deviceinfo_memory unit --- README.md | 4 ++-- internal/collector/deviceinfo.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2f93b8b..8464fd9 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ This exporter currently exposes the following metrics: | livebox_devices_total | gauge | The total number of active devices | type | No | | livebox_deviceinfo_reboots_total | gauge | Number of Livebox reboots | | No | | livebox_deviceinfo_uptime_seconds_total | gauge | Livebox current uptime | | No | -| livebox_deviceinfo_memory_total_mbytes | gauge | Livebox system total memory | | No | -| livebox_deviceinfo_memory_usage_mbytes | gauge | Livebox system used memory | | No | +| livebox_deviceinfo_memory_total_bytes | gauge | Livebox system total memory | | No | +| livebox_deviceinfo_memory_usage_bytes | gauge | Livebox system used memory | | No | | livebox_interface_homelan_rx_mbits | gauge | Received Mbits per second | interface | Yes | | livebox_interface_homelan_tx_mbits | gauge | Transmitted Mbits per second | interface | Yes | | livebox_interface_netdev_rx_mbits | gauge | Received Mbits per second | interface | Yes | diff --git a/internal/collector/deviceinfo.go b/internal/collector/deviceinfo.go index 3f990d8..e317cfc 100644 --- a/internal/collector/deviceinfo.go +++ b/internal/collector/deviceinfo.go @@ -36,12 +36,12 @@ func NewDeviceInfo(client livebox.Client) *DeviceInfo { nil, nil, ), memoryTotalMetric: prometheus.NewDesc( - "livebox_deviceinfo_memory_total_mbytes", + "livebox_deviceinfo_memory_total_bytes", "Livebox system total memory.", nil, nil, ), memoryUsageMetric: prometheus.NewDesc( - "livebox_deviceinfo_memory_usage_mbytes", + "livebox_deviceinfo_memory_usage_bytes", "Livebox system used memory.", nil, nil, ), @@ -79,8 +79,8 @@ func (d *DeviceInfo) memoryStatus(c chan<- prometheus.Metric) { return } - c <- prometheus.MustNewConstMetric(d.memoryTotalMetric, prometheus.GaugeValue, memoryStatus.Status.Total) - c <- prometheus.MustNewConstMetric(d.memoryUsageMetric, prometheus.GaugeValue, memoryStatus.Status.Total-memoryStatus.Status.Free) + c <- prometheus.MustNewConstMetric(d.memoryTotalMetric, prometheus.GaugeValue, 1000*memoryStatus.Status.Total) + c <- prometheus.MustNewConstMetric(d.memoryUsageMetric, prometheus.GaugeValue, 1000*(memoryStatus.Status.Total-memoryStatus.Status.Free)) } // Collect collects all DeviceInfo metrics.