Pruned /dev/ prefix from device label

Now label matched with `node_exporter` labels

Signed-off-by: Konstantin Shalygin <k0ste@k0ste.ru>
This commit is contained in:
Konstantin Shalygin 2022-10-17 14:44:07 +07:00
parent d3d5180048
commit e385b4a351

View file

@ -46,7 +46,7 @@ func NewSMARTctl(logger log.Logger, json gjson.Result, ch chan<- prometheus.Metr
json: json,
logger: logger,
device: SMARTDevice{
device: strings.TrimSpace(json.Get("device.name").String()),
device: strings.TrimPrefix(strings.TrimSpace(json.Get("device.name").String()), "/dev/"),
serial: strings.TrimSpace(json.Get("serial_number").String()),
family: strings.TrimSpace(json.Get("model_family").String()),
model: strings.TrimSpace(json.Get("model_name").String()),