Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
infrastructure
Commits
1d22175e
Commit
1d22175e
authored
Jan 19, 2022
by
Jelle van der Waa
🚧
Browse files
Merge branch 'smart_fix' into 'master'
Fix smart data collection See merge request
!523
parents
a0526102
917ef350
Pipeline
#15006
passed with stage
in 45 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
roles/prometheus_exporters/files/smart-textcollector.sh
View file @
1d22175e
...
...
@@ -44,12 +44,23 @@ for ((i=0; i < $devices_total; i++)); do
echo
"smart_device_smart_healthy{disk=
\"
${
disk
}
\"
} 0"
>>
$TMP_FILE
fi
status
=
$(
echo
$info
| jq
'.ata_smart_data.self_test.status.passed'
)
if
[[
"
$status
"
==
"true"
]]
;
then
echo
"smart_device_self_test{disk=
\"
${
disk
}
\"
} 1"
>>
$TMP_FILE
else
echo
"smart_device_self_test{disk=
\"
${
disk
}
\"
} 0"
>>
$TMP_FILE
fi
# NVME ssd's don't have an ata_smart_data table
if
[[
"
$info
"
==
*
"
\"
ata_smart_data
\"
:"
*
]]
;
then
progress
=
$(
echo
$info
| jq
'.ata_smart_data.self_test.status.string'
)
# When a self test in progress, smartctl omits the status key which is a bug in smartctl but we'll work around it.
if
[[
"
$progress
"
==
*
"in progress"
*
]]
;
then
echo
"smart_device_self_test{disk=
\"
${
disk
}
\"
} 1"
>>
$TMP_FILE
else
status
=
$(
echo
$info
| jq
'.ata_smart_data.self_test.status.passed'
)
if
[[
"
$status
"
==
"true"
]]
;
then
echo
"smart_device_self_test{disk=
\"
${
disk
}
\"
} 1"
>>
$TMP_FILE
else
echo
"smart_device_self_test{disk=
\"
${
disk
}
\"
} 0"
>>
$TMP_FILE
fi
fi
else
echo
"smart_device_self_test{disk=
\"
${
disk
}
\"
} 1"
>>
$TMP_FILE
fi
echo
"smart_temperature_celsius{disk=
\"
${
disk
}
\"
}
$(
echo
$info
| jq
'.temperature.current'
)
"
>>
$TMP_FILE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment