2019-08-14 22:34:49 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
metricSmartctlVersion = prometheus.NewDesc(
|
|
|
|
"smartctl_version",
|
|
|
|
"smartctl version",
|
|
|
|
[]string{
|
|
|
|
"json_format_version",
|
|
|
|
"smartctl_version",
|
|
|
|
"svn_revision",
|
|
|
|
"build_info",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceModel = prometheus.NewDesc(
|
|
|
|
"smartctl_device",
|
|
|
|
"Device info",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"interface",
|
|
|
|
"protocol",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"ata_additional_product_id",
|
|
|
|
"firmware_version",
|
|
|
|
"ata_version",
|
|
|
|
"sata_version",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceCapacityBlocks = prometheus.NewDesc(
|
|
|
|
"smartctl_device_capacity_blocks",
|
|
|
|
"Device capacity in blocks",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceCapacityBytes = prometheus.NewDesc(
|
|
|
|
"smartctl_device_capacity_bytes",
|
|
|
|
"Device capacity in bytes",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceBlockSize = prometheus.NewDesc(
|
|
|
|
"smartctl_device_block_size",
|
|
|
|
"Device block size",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"blocks_type",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceInterfaceSpeed = prometheus.NewDesc(
|
|
|
|
"smartctl_device_interface_speed",
|
|
|
|
"Device interface speed, bits per second",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"speed_type",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceAttribute = prometheus.NewDesc(
|
|
|
|
"smartctl_device_attribute",
|
|
|
|
"Device attributes",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
2019-08-17 12:18:48 +02:00
|
|
|
"attribute_name",
|
|
|
|
"attribute_flags_short",
|
|
|
|
"attribute_flags_long",
|
|
|
|
"attribute_value_type",
|
|
|
|
"attribute_id",
|
2019-08-14 22:34:49 +02:00
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDevicePowerOnSeconds = prometheus.NewDesc(
|
|
|
|
"smartctl_device_power_on_seconds",
|
|
|
|
"Device power on seconds",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceRotationRate = prometheus.NewDesc(
|
|
|
|
"smartctl_device_rotation_rate",
|
|
|
|
"Device rotation rate",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDeviceTemperature = prometheus.NewDesc(
|
|
|
|
"smartctl_device_temperature",
|
|
|
|
"Device temperature celsius",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"temperature_type",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
|
|
|
metricDevicePowerCycleCount = prometheus.NewDesc(
|
|
|
|
"smartctl_device_power_cycle_count",
|
|
|
|
"Device power cycle count",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2019-08-15 23:01:16 +02:00
|
|
|
metricDeviceExitStatus = prometheus.NewDesc(
|
|
|
|
"smartctl_device_smartctl_exit_status",
|
|
|
|
"Exit status of smartctl on device",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2020-07-26 21:54:54 +02:00
|
|
|
metricDeviceState = prometheus.NewDesc(
|
|
|
|
"smartctl_device_state",
|
|
|
|
"Device state (0=active, 1=standby, 2=sleep, 3=dst, 4=offline, 5=sct)",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2019-08-17 12:18:48 +02:00
|
|
|
metricDeviceStatistics = prometheus.NewDesc(
|
|
|
|
"smartctl_device_statistics",
|
|
|
|
"Device statistics",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"statistic_table",
|
|
|
|
"statistic_name",
|
|
|
|
"statistic_flags_short",
|
|
|
|
"statistic_flags_long",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2019-12-19 11:17:35 +01:00
|
|
|
metricCriticalWarning = prometheus.NewDesc(
|
|
|
|
"critical_warning",
|
|
|
|
"Critical warning counter",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2020-07-26 21:31:04 +02:00
|
|
|
metricDeviceStatus = prometheus.NewDesc(
|
|
|
|
"smartctl_device_status",
|
|
|
|
"Device status",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2019-12-19 11:17:35 +01:00
|
|
|
metricAvailableSpare = prometheus.NewDesc(
|
|
|
|
"available_spare",
|
|
|
|
"Available spare",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2020-07-26 22:48:49 +02:00
|
|
|
metricDeviceErrorLogCount = prometheus.NewDesc(
|
|
|
|
"smartctl_device_error_log_count",
|
|
|
|
"Device SMART error log count",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"error_log_type",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2019-12-19 11:17:35 +01:00
|
|
|
metricMediaErrors = prometheus.NewDesc(
|
|
|
|
"media_errors",
|
|
|
|
"Media errors counter",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2020-07-26 23:16:08 +02:00
|
|
|
metricDeviceSelfTestLogCount = prometheus.NewDesc(
|
|
|
|
"smartctl_device_self_test_log_count",
|
|
|
|
"Device SMART self test log count",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"self_test_log_type",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2019-12-19 11:17:35 +01:00
|
|
|
metricSmartStatus = prometheus.NewDesc(
|
|
|
|
"smart_status",
|
|
|
|
"Smart status",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2020-07-26 23:16:08 +02:00
|
|
|
metricDeviceSelfTestLogErrorCount = prometheus.NewDesc(
|
|
|
|
"smartctl_device_self_test_log_error_count",
|
|
|
|
"Device SMART self test log error count",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"self_test_log_type",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2020-07-26 23:37:43 +02:00
|
|
|
metricDeviceERCSeconds = prometheus.NewDesc(
|
|
|
|
"smartctl_device_erc_seconds",
|
|
|
|
"Device SMART Error Recovery Control Seconds",
|
|
|
|
[]string{
|
|
|
|
"device",
|
|
|
|
"model_family",
|
|
|
|
"model_name",
|
|
|
|
"serial_number",
|
|
|
|
"op_type",
|
|
|
|
},
|
|
|
|
nil,
|
|
|
|
)
|
2019-08-14 22:34:49 +02:00
|
|
|
)
|