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() {
4444nvme_version=" $( nvme version | awk ' $1 == "nvme" {print $3}' ) "
4545echo " nvmecli{version=\" ${nvme_version} \" } 1" | format_output
4646
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} ' ) "
4949
5050# 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' )
5253 json_check=" $( nvme smart-log -o json " ${device} " ) "
5354 disk=" ${device##*/ } "
5455
56+ physical_size=$( echo " $device_data " | jq -r ' .PhysicalSize' )
57+ echo " physical_size_bytes{device=\" ${disk} \" } ${physical_size} "
58+
5559 # The temperature value in JSON is in Kelvin, we want Celsius
5660 value_temperature=" $( echo " $json_check " | jq ' .temperature - 273' ) "
5761 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