Step-by-step guide to collect NVMe and storage SMART data on ESXi using esxcli and shell scripting for health, temperature, and drive metrics.
How to Collect NVMe Storage and SMART Information on ESXi
This guide explains how to retrieve NVMe and storage device SMART data on VMware ESXi hosts using esxcli and shell scripting.
Prerequisites
- SSH access to the ESXi host
- Administrative privileges
- Knowledge of storage device identifiers (e.g., eui.*, t10.*)
1. Retrieve NVMe Temperature Information
Using NVMe SMART Log
esxcli hardware nvme smart log get -d eui.<device_id>
Example:
esxcli hardware nvme smart log get -d eui.3643563054b143140025384e00000001
Using Storage Core SMART Data
esxcli storage core device smart get -d eui.<device_id>
To extract only temperature:
esxcli storage core device smart get -d eui.<device_id> | grep Temperature
2. Retrieve SMART Data for Specific Devices
Example using a device identifier:
esxcli storage core device smart get -d t10.<device_id> | grep Temperature
This provides key SMART attributes including drive temperature.
3. Full SMART Output Example
Parameter Value Threshold Worst Raw
------------------------ ----- --------- ----- ---
Health Status OK N/A N/A N/A
Power-on Hours 19445 N/A N/A N/A
Power Cycle Count 530 N/A N/A N/A
Reallocated Sector Count 0 90 N/A N/A
Drive Temperature 61 80 N/A N/A
Key fields:
- Health Status – overall drive condition
- Power-on Hours – total runtime
- Power Cycle Count – number of power cycles
- Reallocated Sector Count – disk health indicator
- Drive Temperature – current operating temperature
4. Collect SMART Data for All Storage Devices
The following shell script loops through all storage devices and extracts key SMART metrics:
#!/bin/sh
storList="$(esxcli storage core path list | grep 'Device:' | sed 's/ *Device: *//')"
echo "$storList"
printf "%s\n" "$storList" | while IFS= read -r storItem; do
echo "Processing device: $storItem"
esxcli storage core device smart get -d "$storItem" | grep "Health Status"
esxcli storage core device smart get -d "$storItem" | grep "Power-on Hours"
esxcli storage core device smart get -d "$storItem" | grep "Power Cycle Count"
esxcli storage core device smart get -d "$storItem" | grep "Reallocated Sector Count"
esxcli storage core device smart get -d "$storItem" | grep "Drive Temperature"
echo ""
done
This script:
- Enumerates all storage devices
- Queries SMART data per device
- Outputs key health and performance metrics
5. Optional Output Formatting Enhancements
For improved readability, additional formatting can be applied using sed:
sed 's/ */\t/g' | sed 's/N\/A/#/g'
This replaces multiple spaces with tabs and substitutes "N/A" values.
Best Practices
- Monitor drive temperature regularly to prevent overheating
- Track reallocated sector counts for early failure detection
- Automate SMART checks using scheduled scripts
- Correlate SMART data with storage performance issues
- Maintain backups before acting on failing drives
Summary
Using esxcli and shell scripting, administrators can efficiently monitor NVMe and storage device health on ESXi hosts. Regular monitoring helps detect hardware issues early and maintain system stability.