fix livebox_deviceinfo_memory unit

This commit is contained in:
Tomy Guichard 2023-05-03 21:43:49 +02:00
parent ed559c5a69
commit 86d6520c62
2 changed files with 6 additions and 6 deletions

View file

@ -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 |

View file

@ -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.