You are not logged in.
Hello:
I use Conky on my desktop to show, among other things, CPU temperatures.
Invaluable when your box sits on the floor of a rather unkept home office. =^7
The /etc/conky/conky.conf lines that do it are these ...
--- snip ---
TEMPERATURES
${hr 2}
${execpi 5 sensors | grep Core | awk '{print $1 $2 $3}' | cut -c1-15}
--- snip ---
... and what I get is something akin to this:a
TEMPERATURES
-------------------------------------
Core0: +52.0 |
Core1: +52.0 |
Core2: +52.0 |
Core3: +52.0 |
The output shown above in ASCII (*) is more or less to scale and aligned to the right screen margin, in turn represented by the vertically stacked Alt+179 symbols.
In order to be able to add a couple of readings without having to squint (more) and/or take up additional screen surface, I'd like to be able to format the output in this manner:
TEMPERATURES
-------------------------------------
Core0: +52.0 Core1: +52.0 |
Core2: +52.0 Core3: +52.0 |
How can I get that done?
Thanks in advance,
A.
(*) This in the absence of a quick and convenient way to upload small graphic files to wherever, directly from the post screen. (a hint?)
Last edited by Altoid (2020-04-13 22:51:50)
Offline
fmt is the command you want. https://linux.die.net/man/1/fmt
This is how i do commands for conky sensors, you may need to play around with the fmt (format) values and the awk values.
sensors | awk 'NR==3{print $3} NR==4{print $3} NR==5{print $3} NR==6{print $3}' | fmt -20
You dont need cut or grep commands, awk can do all the hard work itself.
edit: and the way you want it formatted should be below command.
sensors | awk 'NR==3{print $1,$3} NR==4{print $1,$3} NR==5{print $1,$3} NR==6{print $1,$3}' | fmt -30
Last edited by HevyDevy (2020-04-14 00:53:08)
Offline
Hello:
fmt is the command you want. https://linux.die.net/man/1/fmt
Right ...
... the way you want it formatted should be below command.
Thanks a lot .. =-)
I had to tailor it a bit ...
${execpi 5 sensors | awk 'NR==3{print $1 $2 $3} NR==4{print $1 $2 $3} NR==5 {print $1 $2 $3} NR==6 {print $1 $2 $3}' | fmt -24}
... gets me this:
TEMPERATURES
-------------------------------------
Core0: +52.0 Core1: +52.0 |
Core2: +52.0 Core3: +52.0 |
But I have not found a way to separate the readouts.
eg:
TEMPERATURES
-------------------------------------
Core0: +52.0 Core1: +52.0 |
Core2: +52.0 Core3: +52.0 |
It seems that spaces do not count and I don't see a tab or any other argument to use.
How do I separate them?
Thanks in advance,
A.
Offline
I forgot about hwmon inside conky so you could just use hwmon inside conky to get the needed formatting and it will be better than piping commands via sensors, awk and fmt. Just check in /sys/class/hwmon for the correct outputs as per below conky commands.
TEMPERATURES
-------------------------------------
Core0:+${hwmon 1 temp 2}°C Core1:+${hwmon 1 temp 3}°C |
Core2:+${hwmon 1 temp 4}°C Core3:+${hwmon 1 temp 5}°C |
Offline
Hello:
... hwmon inside conky ...
... check in /sys/class/hwmon for the correct outputs ...
Right.
That did it.
TEMPERATURES
-------------------------------------
${hr 2}
Core0: +${hwmon 0 temp 2}°C Core1: +${hwmon 0 temp 3}°C
Core2: +${hwmon 0 temp 4}°C Core3: +${hwmon 0 temp 5}°C
... got me exactly what I was looking for.
TEMPERATURES
-------------------------------------
Core0: +46.0 Core1: +42.0
Core2: +41.0 Core3: +41.0
Thank you very much for your input.
Cheers,
A.
Offline