Page 1 of 2

Help needed getting SSD temperature displayed

Posted: Wed Sep 12, 2018 6:28 am
by idle
I want to display HDD temperatures in Conky but I've hit a bit of a snag.

I followed this tutorial: https://forums.bunsenlabs.org/viewtopic.php?id=789 and I have a HDD 'sda' displaying the temperature. But that hard drive is my storage drive. My main hard drive is a SSD. I did some searching with the command lsblk and my SSD is called nvme0n1 which is the drive I want temperature displayed.

This is the area of code in Conky:

Code: Select all

${voffset 5}${font Freesans:size=16}${color3}TEMPS:${hr}
${voffset 5}${font}${color0}${goto 20}GPU1:  ${execi 5 nvidia-settings -t -q [gpu:0]/GPUCoreTemp} °C${goto 140}SDA:${goto 180}${hddtemp /dev/sda} °C${goto 240}SDB:${goto 280}${hddtemp /dev/sdb} °C
${goto 20}GPU2:  ${execi 5 nvidia-settings -t -q [gpu:1]/GPUCoreTemp} °C${goto 140}SDC:${goto 180}${hddtemp /dev/sdc} °C${goto 240}SDD:${goto 280}${hddtemp /dev/sdd} °C
What do I need to change/do to get my SDD to display temperature in Conky?

Re: Help needed getting SSD temperature displayed

Posted: Wed Sep 12, 2018 9:42 pm
by zcot
If you have 2 drives, then you would want to address the area where it has SDA and SDB(and just remove the stuff for SDC and D from the next line.. same with dual GPU).

A single section of each drive has this format in the area: ${goto 140}SDA:${goto 180}${hddtemp /dev/sda} °C

if your case has your nvme drive(instead of sd drive) named as nvme0n1, then you would address it as /dev/nvme0n1. (of course you can just open a terminal and enter the command to see what happens: hddtemp /dev/nvme0n1 but maybe you need to sudo the command for testing like that?).

Who knows if you want to label it as SDA or SDB or maybe you want the label to say SSD?! :D

${goto 240}SSD:${goto 280}${hddtemp /dev/nvme0n1} °C

Re: Help needed getting SSD temperature displayed

Posted: Thu Sep 13, 2018 1:35 am
by idle
Hey thanks for the help :D

I tried

Code: Select all

hddtemp /dev/nvme0n1
and got

Code: Select all

GT72-6QD ~ $ sudo hddtemp /dev/nvme0n1
ERROR: /dev/nvme0n1: can't determine bus type (or this bus type is unknown)

Re: Help needed getting SSD temperature displayed

Posted: Thu Sep 13, 2018 3:12 am
by greywolf
Try having a look through this page:

https://itpeernetwork.intel.com/finding ... -not-scsi/

Try the commands therein; may give you a clue what to look for.

greywolf.

Re: Help needed getting SSD temperature displayed

Posted: Thu Sep 13, 2018 9:36 pm
by idle
I can't see anything related to temperature readouts, but thanks for the link, it has some interesting information.

Re: Help needed getting SSD temperature displayed

Posted: Thu Sep 13, 2018 10:54 pm
by zcot
I did a little searching. It seems like hddtemp isn't going to be the right tool for that?

various articles are talking about using smartctl.

This user is doing something with an nvme tool: https://askubuntu.com/questions/1038701 ... 11#1038711

Keep us posted.

Re: Help needed getting SSD temperature displayed

Posted: Thu Sep 13, 2018 11:19 pm
by idle
Yeah found that post yesterday and got the same readout using nvme-cli. It does display temperatures of the NVMe SSD but nothing I can find to translate that to work in Conky unfortunately. Even in his example (the .gif image he posted) there is no SSD temperature readout being displayed. The only readout Conky is displaying is NVMe Win 10 displaying the storage space.

Still a mystery ...

Re: Help needed getting SSD temperature displayed

Posted: Fri Sep 14, 2018 2:04 am
by smurphos
What output do you get from nvme smart-log /dev/nvme0n1?

If it includes the temperature you could isolate that output with grep e.g something like this - you'd probably need to fine tune the grep parameter.

nvme smart-log /dev/nvme0n1 | grep "^temperature"

Re: Help needed getting SSD temperature displayed

Posted: Sat Sep 15, 2018 2:09 am
by idle
smurphos wrote: Fri Sep 14, 2018 2:04 am What output do you get from nvme smart-log /dev/nvme0n1?

If it includes the temperature you could isolate that output with grep e.g something like this - you'd probably need to fine tune the grep parameter.

nvme smart-log /dev/nvme0n1 | grep "^temperature"
That actually worked!

Code: Select all

GT72-6QD ~ $ sudo nvme smart-log /dev/nvme0n1 | grep "^t

Code: Select all

temperature: 35 C
How would I translate that into Conky code? Is there a line in Conky that it could be placed in to display the temperature?

Re: Help needed getting SSD temperature displayed

Posted: Sat Sep 15, 2018 2:34 am
by smurphos
idle wrote: Sat Sep 15, 2018 2:09 am How would I translate that into Conky code? Is there a line in Conky that it could be placed in to display the temperature?
You can try exec e.g ${exec nvme smart-log /dev/nvme0n1 | grep "^t"}

If it doesn't work - maybe because of the sudo requirement - another approach would be to use the root crontab (sudo crontab -e) to start a background script running as root to write the output of nvme smart-log /dev/nvme0n1 | grep "^t" to a text file somewhere on a regular basis and then in conky read that text file content using cat.

Example

sudo crontab -e to open the root crontab

Add the line with the correct path to the script

@reboot /path/to/SSDtemp,sh

Save.

The script would be something like this (as written writes the temp every 10 seconds to /tmp/SSDtemp)

Code: Select all

#!/bin/bash
while :
do
nvme smart-log /dev/nvme0n1 | grep "^t" > /tmp/SSDtemp
sleep 10
done 
Then in conky use ${exec cat /tmp/SSDtemp} to read the value in the text file.

Re: Help needed getting SSD temperature displayed

Posted: Sun Sep 16, 2018 1:38 am
by idle
You really know your stuff. Okay I did as you suggested and it works, displaying the temperature, but the temperature doesn't fluctuate. I use the drive and it sits at a constant 35c. This has me baffled and I did some searching and the only thing I can come up with is this: (My readout)

Code: Select all

Smart Log for NVME device:nvme0n1 namespace-id:ffffffff
critical_warning                    : 0
temperature                         : 35 C
available_spare                     : 100%
available_spare_threshold           : 10%
percentage_used                     : 0%
data_units_read                     : 10,095,905
data_units_written                  : 17,494,164
host_read_commands                  : 81,638,034
host_write_commands                 : 142,198,348
controller_busy_time                : 811
power_cycles                        : 237
power_on_hours                      : 14,658
unsafe_shutdowns                    : 85
media_errors                        : 0
num_err_log_entries                 : 76
Warning Temperature Time            : 0
Critical Composite Temperature Time : 0
Temperature Sensor 1                : 0 C
Temperature Sensor 2                : 0 C
Temperature Sensor 3                : 0 C
Temperature Sensor 4                : 0 C
Temperature Sensor 5                : 0 C
Temperature Sensor 6                : 0 C
Temperature Sensor 7                : 0 C
Temperature Sensor 8                : 0 C
If you go to this link: https://askubuntu.com/questions/1038701 ... 11#1038711

You will see this guys readout is different than mine:

Code: Select all

Smart Log for NVME device:nvme0 namespace-id:ffffffff
critical_warning                    : 0
temperature                         : 35 C
available_spare                     : 100%
available_spare_threshold           : 10%
percentage_used                     : 0%
data_units_read                     : 9,328,609
data_units_written                  : 5,383,685
host_read_commands                  : 169,669,400
host_write_commands                 : 51,959,850
controller_busy_time                : 387
power_cycles                        : 568
power_on_hours                      : 401
unsafe_shutdowns                    : 77
media_errors                        : 0
num_err_log_entries                 : 216
Warning Temperature Time            : 0
Critical Composite Temperature Time : 0
Temperature Sensor 1                : 35 C
Temperature Sensor 2                : 41 C
Temperature Sensor 3                : 0 C
Temperature Sensor 4                : 0 C
Temperature Sensor 5                : 0 C
Temperature Sensor 6                : 0 C
Temperature Sensor 7                : 0 C
Temperature Sensor 8                : 0 C
His temperature Sensors 1 & 2 are reading 35c and 41c and mine are reading nothing. That's all I can come up with. Maybe the 35c is some default readout/display and the actual reading needs to come from sensors 1 through 8? Hence why there is no usage fluctuation in temperature?

Re: Help needed getting SSD temperature displayed

Posted: Sun Sep 16, 2018 1:55 am
by smurphos
Do you get any output including temperature info from smartctl e.g.

sudo smartctl -a /dev/nvme0n1

Re: Help needed getting SSD temperature displayed

Posted: Sun Sep 16, 2018 10:15 am
by idle

Code: Select all

GT72-6QD ~ $ sudo smartctl -a /dev/nvme0n1
sudo: smartctl: command not found

Re: Help needed getting SSD temperature displayed

Posted: Sun Sep 16, 2018 10:36 am
by Laurent85
idle wrote: Sun Sep 16, 2018 10:15 am

Code: Select all

sudo: smartctl: command not found
Install smartmontools and rerun the smartctl command:

Code: Select all

apt install smartmontools
sudo smartctl -a /dev/nvme0n1

Re: Help needed getting SSD temperature displayed

Posted: Sun Sep 16, 2018 11:38 am
by idle

Code: Select all

/dev/nvme0n1: Unable to detect device type
Please specify device type with the -d option.

Re: Help needed getting SSD temperature displayed

Posted: Sun Sep 16, 2018 11:47 am
by Laurent85
idle wrote: Sun Sep 16, 2018 11:38 am

Code: Select all

Please specify device type with the -d option.
Try with the device type command option:

Code: Select all

sudo smartctl -d nvme -a /dev/nvme0n1

Re: Help needed getting SSD temperature displayed

Posted: Sun Sep 16, 2018 10:06 pm
by idle

Code: Select all

/dev/nvme0n1: Unknown device type 'nvme'

Re: Help needed getting SSD temperature displayed

Posted: Mon Sep 17, 2018 12:23 am
by smurphos
Give this a try - sudo smartctl --scan-open just to see if it can see the disc at all.

smartctl NVMe support is labelled as experimental but it should find something.

Re: Help needed getting SSD temperature displayed

Posted: Mon Sep 17, 2018 1:35 am
by idle

Code: Select all

/dev/sda -d sat # /dev/sda [SAT], ATA device

Re: Help needed getting SSD temperature displayed

Posted: Mon Sep 17, 2018 1:52 am
by smurphos
OK scrap smartctl - it clearly isn't seeing your NVMe drive.

At this point I would be visiting the manufacturer's support site - checking to see if there is a firmware update available for the device, or if the manufacturer provides any device specific linux tools that you could use to get proper temperature outputs, or if other linux users are reporting issues getting drive stats via the command line. I'm assuming they have a support forum.