How to Check SSD Temperature in ESXi 8.0

Monitoring the health and temperature of your SSDs is crucial in any high-performance environment, such as a VMware ESXi server. In the latest ESXi 8.0, you can easily check the SSD temperature and SMART data using the esxcli command-line tool. This blog post will guide you through creating a simple shell script to automate this task.

Creating a Shell Script to Check SSD Temperature

To simplify the process, we can create a shell script named temp.sh. This script will fetch and display the temperature of all SSDs connected to your ESXi server.

Step-by-Step Guide

  1. Create the shell script file:

    Log in to your ESXi server and open a terminal. Then use your favorite text editor (like vi) to create the script file.

    1
    vi /usr/local/bin/temp.sh
  2. Insert the Script Content:

    Copy and paste the following content into the temp.sh file:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    #!/bin/sh

    # Get the list of all device UIDs
    device_list=$(esxcli storage core device list | grep -E '^t10.|^eui.' | awk '{print $1}')

    # Iterate through each device UID and fetch its temperature
    for device in $device_list
    do
    output=$(esxcli storage core device smart get -d $device)
    temperature=$(echo "$output" | grep "Drive Temperature" | awk '{print $3}')
    echo "Drive Temperature for device $device: $temperature°C"
    done
  3. Make the Script Executable:

    Change the file permissions to make the script executable.

    1
    chmod +x /usr/local/bin/temp.sh
  4. Run the Script:

    Execute the script to display the temperature of each SSD.

    1
    /usr/local/bin/temp.sh

Understanding the Script

Fetching Device UIDs:

1
device_list=$(esxcli storage core device list | grep -E '^t10.|^eui.' | awk '{print $1}')

This line extracts all device UIDs (Universal Identifiers) from the ESXi storage core device list.

Iterating Through Devices:

1
2
for device in $device_list
do

This for loop iterates through each device UID.
Getting SMART Data:

1
output=$(esxcli storage core device smart get -d $device)

This line fetches the SMART data for each device.
Extracting Temperature:

1
2
temperature=$(echo "$output" | grep "Drive Temperature" | awk '{print $3}')
echo "Drive Temperature for device $device: $temperature°C"

These lines extract the drive temperature from the SMART data and print it.

Checking Additional SMART Attributes

In addition to temperature, SMART data provides a wealth of information about the health of your SSDs. To view all SMART attributes for a specific device, use the following command:

1
esxcli storage core device smart get -d

This command will display important metrics such as:

• Read Error Rate
• Power On Hours
• Reallocated Sectors Count
• Wear Leveling Count

Conclusion

Keeping track of your SSD’s temperature and overall health is crucial to maintaining the reliability and performance of your VMware ESXi server. By creating and using the temp.sh script, you can quickly and easily monitor these important metrics.

If you have any questions or need further assistance, feel free to ask in the comments below. Don’t forget to share this post if you found it helpful. Stay tuned for more tips and tricks on managing your ESXi environment!

Happy monitoring!