File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
etc/kayobe/ansible/scripts Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,18 @@ format_output() {
44
44
nvme_version=" $( nvme version | awk ' $1 == "nvme" {print $3}' ) "
45
45
echo " nvmecli{version=\" ${nvme_version} \" } 1" | format_output
46
46
47
- # Get devices
48
- device_list =" $( nvme list -o json | jq -r ' .Devices | .[]. DevicePath' ) "
47
+ # Get devices (DevicePath and PhysicalSize)
48
+ device_info =" $( nvme list -o json | jq -c ' .Devices[] | {DevicePath: . DevicePath, PhysicalSize: .PhysicalSize} ' ) "
49
49
50
50
# Loop through the NVMe devices
51
- for device in ${device_list} ; do
51
+ echo " $device_info " | while read -r device_data; do
52
+ device=$( echo " $device_data " | jq -r ' .DevicePath' )
52
53
json_check=" $( nvme smart-log -o json " ${device} " ) "
53
54
disk=" ${device##*/ } "
54
55
56
+ physical_size=$( echo " $device_data " | jq -r ' .PhysicalSize' )
57
+ echo " physical_size_bytes{device=\" ${disk} \" } ${physical_size} "
58
+
55
59
# The temperature value in JSON is in Kelvin, we want Celsius
56
60
value_temperature=" $( echo " $json_check " | jq ' .temperature - 273' ) "
57
61
echo " temperature_celsius{device=\" ${disk} \" } ${value_temperature} "
Original file line number Diff line number Diff line change
1
+ ---
2
+ features :
3
+ - |
4
+ Nvmemon now reports physical size of the disk.
You can’t perform that action at this time.
0 commit comments