mirror of
https://github.com/prometheus-community/smartctl_exporter.git
synced 2024-11-16 01:33:07 +01:00
Calculate bytes read/written
This commit is contained in:
parent
1b15cbbec2
commit
315d1538aa
2 changed files with 12 additions and 12 deletions
|
@ -206,8 +206,8 @@ var (
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
metricDeviceDataUnitsRead = prometheus.NewDesc(
|
metricDeviceBytesRead = prometheus.NewDesc(
|
||||||
"smartctl_device_data_units_read",
|
"smartctl_device_bytes_read",
|
||||||
"",
|
"",
|
||||||
[]string{
|
[]string{
|
||||||
"device",
|
"device",
|
||||||
|
@ -217,8 +217,8 @@ var (
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
metricDeviceDataUnitsWritten = prometheus.NewDesc(
|
metricDeviceBytesWritten = prometheus.NewDesc(
|
||||||
"smartctl_device_data_units_written",
|
"smartctl_device_bytes_written",
|
||||||
"",
|
"",
|
||||||
[]string{
|
[]string{
|
||||||
"device",
|
"device",
|
||||||
|
|
16
smartctl.go
16
smartctl.go
|
@ -56,8 +56,8 @@ func (smart *SMARTctl) Collect() {
|
||||||
smart.mineCriticalWarning()
|
smart.mineCriticalWarning()
|
||||||
smart.mineMediaErrors()
|
smart.mineMediaErrors()
|
||||||
smart.mineNumErrLogEntries()
|
smart.mineNumErrLogEntries()
|
||||||
smart.mineDataUnitsRead()
|
smart.mineBytesRead()
|
||||||
smart.mineDataUnitsWritten()
|
smart.mineBytesWritten()
|
||||||
smart.mineSmartStatus()
|
smart.mineSmartStatus()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -312,10 +312,10 @@ func (smart *SMARTctl) mineNumErrLogEntries() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (smart *SMARTctl) mineDataUnitsRead() {
|
func (smart *SMARTctl) mineBytesRead() {
|
||||||
blockSize := smart.json.Get("logical_block_size").Float()
|
blockSize := smart.json.Get("logical_block_size").Float() * 1024
|
||||||
smart.ch <- prometheus.MustNewConstMetric(
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
metricDeviceDataUnitsRead,
|
metricDeviceBytesRead,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
smart.json.Get("nvme_smart_health_information_log.data_units_read").Float() * blockSize,
|
smart.json.Get("nvme_smart_health_information_log.data_units_read").Float() * blockSize,
|
||||||
smart.device.device,
|
smart.device.device,
|
||||||
|
@ -325,10 +325,10 @@ func (smart *SMARTctl) mineDataUnitsRead() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (smart *SMARTctl) mineDataUnitsWritten() {
|
func (smart *SMARTctl) mineBytesWritten() {
|
||||||
blockSize := smart.json.Get("logical_block_size").Float()
|
blockSize := smart.json.Get("logical_block_size").Float() * 1024
|
||||||
smart.ch <- prometheus.MustNewConstMetric(
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
metricDeviceDataUnitsWritten,
|
metricDeviceBytesWritten,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
smart.json.Get("nvme_smart_health_information_log.data_units_written").Float() * blockSize,
|
smart.json.Get("nvme_smart_health_information_log.data_units_written").Float() * blockSize,
|
||||||
smart.device.device,
|
smart.device.device,
|
||||||
|
|
Loading…
Reference in a new issue