Conky: inxi --disk --verbosity=3 gives too much information

So I’m writing my own conky config file from scratch and I’m doing fine, thank you!¹ :grin:

However, I want to read the HDD temperatures to monitor (and eventually graph) them and hddtemp and smartctl need sudo rights so inxi to the recue!

inxi --disk
Drives:
  Local Storage: total: 1.38 TiB used: 900.29 GiB (63.9%) 
  ID-1: /dev/sda vendor: Micron model: 1100 MTFDDAV256TBN size: 238.47 GiB 
  ID-2: /dev/sdb vendor: Micron model: 1100 MTFDDAV256TBN size: 238.47 GiB 
  ID-3: /dev/sdc vendor: Toshiba model: MQ01ABD100 size: 931.51 GiB

Urgh, no temperatures!

inxi --disk --verbosity=3
System:
  Host: fab-manjaro Kernel: 5.7.15-1-MANJARO x86_64 bits: 64 compiler: gcc 
  v: 10.1.0 Console: tty 3 Distro: Manjaro Linux 
Machine:
  Type: Laptop System: Acer product: Predator G9-793 v: V1.13 
  serial: <superuser/root required> 
  Mobo: Acer model: Challenger2_SKS v: V1.13 
  serial: <superuser/root required> UEFI: Insyde v: 1.13 date: 12/04/2017 
Battery:
  ID-1: BAT0 charge: 32.0 Wh condition: 33.5/90.0 Wh (37%) model: AS15B3N 
  status: Charging 
CPU:
  Topology: Quad Core model: Intel Core i7-7700HQ bits: 64 type: MT MCP 
  arch: Kaby Lake rev: 9 L2 cache: 6144 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 44817 
  Speed: 800 MHz min/max: 800/3800 MHz Core speeds (MHz): 1: 800 2: 800 
  3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 
Graphics:
  Device-1: NVIDIA GP104BM [GeForce GTX 1070 Mobile] 
  vendor: Acer Incorporated ALI driver: nvidia v: 440.100 bus ID: 01:00.0 
  Device-2: Chicony HD WebCam type: USB driver: uvcvideo bus ID: 1-9:3 
  Display: server: X.org 1.20.8 driver: nvidia tty: 79x27 
  Message: Advanced graphics data unavailable in console. Try -G --display 
Network:
  Device-1: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter 
  vendor: Bigfoot Networks driver: ath10k_pci v: kernel port: 4000 
  bus ID: 02:00.0 
  IF: wlp2s0 state: up mac: 9c:b6:d0:1a:a5:4f 
  Device-2: Qualcomm Atheros Killer E2400 Gigabit Ethernet 
  vendor: Acer Incorporated ALI driver: alx v: kernel port: 3000 
  bus ID: 03:00.0 
  IF: enp3s0 state: down mac: 8c:0f:6f:7a:71:77 
  Device-3: Qualcomm Atheros QCA61x4 Bluetooth 4.0 type: USB driver: btusb 
  bus ID: 1-7:2 
Drives:
  Local Storage: total: 1.38 TiB used: 900.29 GiB (63.9%) 
  ID-1: /dev/sda vendor: Micron model: 1100 MTFDDAV256TBN size: 238.47 GiB 
  temp: 47 C 
  ID-2: /dev/sdb vendor: Micron model: 1100 MTFDDAV256TBN size: 238.47 GiB 
  temp: 47 C 
  ID-3: /dev/sdc vendor: Toshiba model: MQ01ABD100 size: 931.51 GiB 
Info:
  Processes: 267 Uptime: 11h 37m Memory: 15.58 GiB used: 4.73 GiB (30.4%) 
  Init: systemd Compilers: gcc: 10.1.0 Packages: 1315 Shell: Bash v: 5.0.18 
  inxi: 3.1.05 

What the :fire: just happened? Where is all this other crud coming from? I just want the verbosity of the disk section to be more detailed! (I’m very narrow-minded!)

  1. What am I doing wrong? :sob:
  2. Any other ideas to read disk temperatures without sudo??? :innocent:

:open_mouth:

Note 1: I’m writing this so I haven’t jumped off a building yet!

$ inxi --help
...
 -v, --verbosity      Set inxi verbosity level (0-8). Should not be used with -b or -F. Example: inxi -v 4
...
                          3  Advanced CPU (-C), battery (-B), network (-n); triggers -x. 
...

Try with the -x, -xx, -xxx switches.


edit:

$ inxi --help
...
-x, --extra          Adds the following extra data (only works with verbose or line output, not short form):
...
                         -D  HDD temp with disk data if you have hddtemp installed, if you are root, or if you have added to 
                             /etc/sudoers (sudo v. 1.7 or newer). Example: <username> ALL = NOPASSWD: /usr/sbin/hddtemp 
...

Help mentions hddtemp and either being root or using sudo-rules for temps.

1 Like

Sorry, -xxxxx doesn’t give me any temperatures:

Drives:
  Local Storage: total: 1.38 TiB used: 898.66 GiB (63.8%) 
  ID-1: /dev/sda vendor: Micron model: 1100 MTFDDAV256TBN size: 238.47 GiB 
  speed: 6.0 Gb/s serial: 1710162CCBF9 rev: A020 scheme: GPT 
  ID-2: /dev/sdb vendor: Micron model: 1100 MTFDDAV256TBN size: 238.47 GiB 
  speed: 6.0 Gb/s serial: 1710162CCA53 rev: A020 scheme: GPT 
  ID-3: /dev/sdc vendor: Toshiba model: MQ01ABD100 size: 931.51 GiB 
  speed: 6.0 Gb/s rotation: 5400 rpm serial: 17SJPFKUT rev: 5J scheme: GPT 

:sob:

as for me inxi --disk --verbosity=3 no temperatures …
ok , this command show temp ONLY is sudo is run before :wink: sudo -k; and no temps :sob:
this command use hddtemp if admin rights

I run hddtemp as a daemon for monitoring temps in Conky. :wink:

1 Like

Care to share some config files and how you did that exactly???

:hugs:

Sure, when I’m back at my PC after work.

EDIT: For now, see the Arch wiki:
https://wiki.archlinux.org/index.php/Hddtemp#Daemon

1 Like

workaround use pkexec and rules for inxi (or hddtemp or …):

/usr/share/polkit-1/rules.d/inxi.rules

// for my Conky, i use command as admin without password
polkit.addRule(function(action, subject) {                                                                                                               
    if (action.lookup("command_line") == '/usr/bin/inxi --disk --verbosity=3') {                                                                     
        polkit.log("action=" + action);                                                                                                                  
        polkit.log("cmd=" + action.lookup("command_line"));                                                                                              
        return polkit.Result.YES;                                                                                                                        
    }                                                                                                                                                    
});                                                                                                                                                      
                                                                                                                                                         
/*                                                                                                                                                       
view logs:                                                                                                                                               
journalctl -b0 -u polkit --no-pager                                                                                                                      
*/

comment/remove log lines if ok

now can run pkexec inxi --disk --verbosity=3 without pass

Barbaric American…temps in F. Code is particular to my system. Adjust accordingly.

2020-08-21-175407_599x230_scrot

${font :bold:size=10}${color}Samsung 970 EVO 256GB (/dev/nvme0)${alignr}Temp: ${color2}${hwmon 1 temp 2}°F
${font :bold:size=10}${color}Samsung 860 EVO 500GB (/dev/sda)${alignr}Temp: ${color2}${hddtemp /dev/disk/by-id/wwn-0x5002538e4058609f}°F
${color}${font :bold:size=10}Samsung 860 EVO 500GB (/dev/sdb)${alignr}Temp: ${color2}${hddtemp /dev/disk/by-id/wwn-0x5002538e403271ff}°F
${font :bold:size=10}${color}Hitachi DS723020  1.8 TB (/dev/sdc)${alignr}Temp: ${color2}${hddtemp /dev/disk/by-id/wwn-0x5000cca369e322e3}°F

/usr/lib/systemd/system/hddtemp.service

[Unit]
Description=Hard drive temperature monitor daemon

[Service]
ExecStart=/usr/bin/hddtemp -dF /dev/sda

[Install]
WantedBy=multi-user.target

Override this with systemctl edit hddtemp.service

[Service]
ExecStart=
ExecStart=/usr/bin/hddtemp -dF --unit=F /dev/disk/by-id/wwn-0x5002538e4058609f /dev/disk/by-id/wwn-0x5002538e403271ff /dev/disk/by-id/wwn-0x5000cca369e322e3

This will create the new directory /etc/systemd/system/hddtemp.service.d and the file will be named override.conf

If you use /dev/disk/by-id, you won’t get bitten when a random boot decides to change sda to sdb.

Enable and start the hddtemp daemon:

systemctl enable --now hddtemp.service

Edit: fix location of service file.

3 Likes

Now you don’t have to wait, @merlock has you covered. :point_up:

2 Likes

Did you mean

/usr/lib/systemd/system/hddtemp.service

:wink:

My overide.conf is the same but I have --listen=127.0.0.1 at the end of ExecStart. I’m too tired now to remember why I put that there.

Snippets from my conkyrc:

${hwmon nvme temp 1}°F
${hddtemp}°F

Maybe …
inxi -dza
?

Oh… wait … I see the problem here.

$ man inxi 
...
       -D, --disk
              Show  Hard  Disk  info. Shows total disk space and used percentage. The disk used percentage includes space used by swap partition(s), since those are not usable for data
              storage. Note that with RAID disks, the percentage will be wrong since the total is computed from the disk sizes, but used is computed from mounted  partition  used  per‐
              centages.  This  small  defect  may  get corrected in the future.  Also, unmounted partitions are not counted in disk use percentages since inxi has no access to the used
              amount.

              Also shows per disk information: Disk ID, type (if present), vendor (if detected), model, and size. See Extra Data Options (-x  options)  and  Admin  Extra  Data  Options
              (--admin options) for many more features.

so basically D will skip optical … ok inxi -Dza
But more important…

-x -D  - Adds HDD temperature with disk data if you have hddtemp installed, if you are root or if you have added to /etc/sudoers (sudo v. 1.7 or newer):
              <username> ALL = NOPASSWD: /usr/sbin/hddtemp (sample)

So …

  • A - make sure hddtemp is installed
  • B - Either edit /etc/sudoers for hddtemp like above OR run inxi with sudo

Yup. Good catch. Post fixed.

Thanks for that!

I ended up doing:

[Unit]
Description=Hard drive temperature monitor daemon

[Service]
ExecStart=/usr/bin/hddtemp --daemon --foreground /dev/sda /dev/sdb /dev/sdc

[Install]
WantedBy=multi-user.target

because I have a laptop with just 2 NVMe slots and 1 SATA port: if I ever upgrade any of these, I won’t have to change the IDs…

Final solution:

conky.config =
{
    console_bar_fill   = '»',
    console_bar_unfill = ' ',

    alignment = 'top_left',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
    -- define Manjaro colours:
    default_color = '#1abc9c',  -- Same HTML as current terminal
    color1 = '#709080',         -- Kakhi
    color2 = '#dca3a3',         -- Salmon
    color3 = '#72d5a3',         -- Light Green
    color4 = '#f0dfaf',         -- Yellow
    color5 = '#7eb2e6',         -- Metal blue
    color6 = '#a45ec1',         -- Light aubergine
    font   = 'Envy Code R:bold:size=8',
    default_outline_color = '#1abc9c',  -- Same HTML as current terminal
    default_shade_color = '#1abc9c',  -- Same HTML as current terminal
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    extra_newline = false,
    gap_x = 60,
    gap_y = 60,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'normal',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 2.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}

-- Networking section will not show anything outside of the title if no NICS are up
-- Will show speed and graph per NIC if they are up

conky.text = [[
${color}Info:${color1} ${scroll 32 $nodename $kernel}
${color}$hr
${color}Uptime    :${color1} $uptime
${color}Frequency :${color1} $freq ${color}MHz
${color}RAM Usage :${color1} $mem/$memmax - $memperc% ${membar 4}
${color}Swap Usage:${color1} $swap/$swapmax - $swapperc% ${swapbar 4}
${color}CPU Usage :${color1} $cpu% ${cpubar 4}
${color}Processes :${color1} $processes  ${color}Load:${color1} $running_processes
${color}Name                 CPU%   MEM%   PID
${color1} ${top name 1} ${color2} ${top cpu 1} ${top mem 1} ${top pid 1}
${color1} ${top name 2} ${color2} ${top cpu 2} ${top mem 2} ${top pid 2}
${color1} ${top name 3} ${color2} ${top cpu 3} ${top mem 3} ${top pid 3}
${color1} ${top name 4} ${color2} ${top cpu 4} ${top mem 4} ${top pid 4}
${color}$hr
${color}File systems:
${color} /            ${color1}${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color} /home        ${color1}${fs_used /home}/${fs_size /home} ${fs_bar 6 /home}
${color} /media/Data  ${color1}${fs_used /media/Data}/${fs_size /media/Data} ${fs_bar 6 /media/Data}
${color}$hr
${color}Networking:
${if_existing /sys/class/net/enp3s0/operstate up}Ethernet
Down: ${color1}${downspeed enp3s0}s ${alignr}${color}Up: ${color1}${upspeed enp3s0}/s
${downspeedgraph enp3s0 25,200 dca3a3 ffffff -l} ${alignr}${color1}${upspeedgraph enp3s0 25,200 dca3a3 ffffff -l}
Total: ${color1}${totaldown enp3s0} ${alignr}${color}Total: ${color1}${totalup enp3s0}
${endif}${if_existing /sys/class/net/wlp2s0/operstate up}WiFi
Down: ${color1}${downspeed wlp2s0}/s ${alignr}${color}${color}Up: ${color1}${upspeed wlp2s0}/s
${downspeedgraph wlp2s0 25,100 dddddd ffffff 150} ${alignr}${color1}${upspeedgraph wlp2s0 25,100 dddddd ffffff 18}
Total: ${color1}${totaldown wlp2s0} ${alignr}${color}Total: ${color1}${totalup wlp2s0}${endif}
${color}$hr
${color}Temperature:
${color} ISA     ${color1}${exec sensors | grep 'Package'                  | awk '{print $4}'}${alignr}${alignr}${color}CPU     ${color1}${exec sensors      | grep 'Core 0'                   | awk '{print $3}'}
${color} ACPI    ${color1}${exec sensors | grep --after-context=2 'acpitz' | awk 'FNR ==3 {print $2}'}${alignr}${color}WiFi    ${color1}${exec exec sensors | grep --after-context=2 'ath10k' | awk 'FNR ==3 {print $2}'}
${color} GPU     ${color1}+${exec nvidia-settings --query=gpucoretemp 2>/dev/null | grep 'GPUCoreTemp' | grep "\[gpu:0\]" | awk '{print $4}'}0°C
${color} SSD     ${color1}+${hddtemp /dev/sda}.0°C${alignr}${color}HDD     ${color1}+${hddtemp /dev/sda}.0°C
${color2}${execgraph "sensors | grep 'Core 0' | awk '{print $3}' | cut -b2,3"}
]]

resulting in a lot of information in very little screen estate:

One thing that I might mention…

If your modified service file is in /usr/lib/systemd/system it will get overwritten if/when hddtemp is upgraded. That’s why I recommended the override; it’s safe and secured from upgrades. :slight_smile:

Have you investigated using conky’s built-in hwmon? Could cut down those greps and awks. :slight_smile:

1 Like

grep 'Package' | awk '{print $4}' == awk '/Package/ {print $4}'

1 Like

I could create my own /etc/systemd/system/drivetemp.service file instead of using the system-provided one…

Nope. Do you have an example / link to a manual?

:innocent:

1 Like

oh so true. Modifying that now…

(it’s due to the logic that I followed: grepping first, awk for printing the right line and column…

:man_facepalming:

See here.

Snippets from my config:

${hwmon k10temp temp 1}°F
${hwmon dell_smm fan 1} RPM
${hwmon nvme temp 1}°F

Yeah, that’s not a very informative manual… :cry:
I read up on the /sys/class/hwmon docs and my system only has:

cat /sys/class/hwmon/hwmon{0..5}/name
acpitz
AC0
BAT0
pch_skylake
coretemp
ath10k_hwmon

so in your particular exxample, how do you know to ${hwmon nvme temp 1}°F ?

:open_mouth: