Skip to content

Commit 6fc5867

Browse files
committed
Fix smartmon script
Fixes the smartmon script to detect SMART info values regardless of their case. Previously, this would lead to wrongly formatted .prom files resulting in node_exporter failing to parse them.
1 parent 05d5eae commit 6fc5867

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

etc/kayobe/ansible/scripts/smartmon.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ parse_smartctl_scsi_attributes() {
106106
}
107107

108108
parse_smartctl_info() {
109+
shopt -s nocasematch
109110
local -i smart_available=0 smart_enabled=0 smart_healthy=
110111
local disk="$1" disk_type="$2"
111112
local model_family='' device_model='' serial_number='' fw_version='' vendor='' product='' revision='' lun_id=''
@@ -199,4 +200,4 @@ for device in ${device_list}; do
199200
exit
200201
;;
201202
esac
202-
done | format_output
203+
done | format_output
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes the smartmon script to be case insensitive when checking for
5+
the inital SMART info. This is to ensure that the script works
6+
correctly on systems where the output of `smartctl -i` is not
7+
capitalised as previously expected by the script. This leads to
8+
badly formatted .prom files which lead to node_exporter failing to
9+
scrape the file.

0 commit comments

Comments
 (0)