Jump to content

Conky script-foo


sunrat

Recommended Posts

Anyone have enough script-fu to dig out my nouveau gpu temp and fan to display in Conky? I can't just grep temp1 and fan1 as there are 2 instances in sensors.

 

roger@brain:~$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +40.0°C (high = +78.0°C, crit = +100.0°C)
Core 1: +40.0°C (high = +78.0°C, crit = +100.0°C)

it8718-isa-0290
Adapter: ISA adapter
in0: +1.07 V (min = +0.00 V, max = +4.08 V)
in1: +1.90 V (min = +0.00 V, max = +4.08 V)
in2: +3.31 V (min = +0.00 V, max = +4.08 V)
+5V: +3.02 V (min = +0.00 V, max = +4.08 V)
in4: +0.03 V (min = +0.00 V, max = +4.08 V)
in5: +0.00 V (min = +0.00 V, max = +4.08 V) ALARM
in6: +0.10 V (min = +0.00 V, max = +4.08 V)
in7: +3.09 V (min = +0.00 V, max = +4.08 V)
Vbat: +3.15 V
fan1: 806 RPM (min = 10 RPM)
fan2: 790 RPM (min = 0 RPM)
fan3: 0 RPM (min = 0 RPM)
fan4: 918 RPM (min = 0 RPM)
temp1: +29.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
temp2: +23.0°C (low = +127.0°C, high = +70.0°C) sensor = thermal diode
temp3: -2.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
intrusion0: ALARM

nouveau-pci-0100
Adapter: PCI adapter
fan1: 2640 RPM
temp1: +28.0°C (high = +95.0°C, hyst = +3.0°C)
(crit = +105.0°C, hyst = +5.0°C)
(emerg = +135.0°C, hyst = +5.0°C)

Link to comment
Share on other sites

You could differentiate between them with a regular expression and sed.

 

The two fan lines begin the same, but end with different things.

As do the two temp lines.

 

I will think about it a bit and if I have any mental breaks, I will post them back.

Someone who is realy good with RE and sed could do this in their sleep.

Me, I have to fight for every little bit.

fan1: 806 RPM (min = 10 RPM)

 

fan1: 2640 RPM

 

temp1: +29.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor

 

temp1: +28.0°C (high = +95.0°C, hyst = +3.0°C)

 

Edited by amenditman
  • Like 1
Link to comment
Share on other sites

How about using the -A argument for the first grep?

 

$ sensors | grep -A 3 nouveau | grep temp1 | cut -c 17-21
+28.0
$ sensors | grep -A 3 nouveau | grep fan1 | cut -c 17-21
2640 

 

grep -A 3 nouveau finds the line with nouveau and the three lines that follow.

 

Jim

  • Like 1
Link to comment
Share on other sites

Using awk instead of cut:

$ sensors | grep -A 3 nouveau | awk '/temp1/{print $2}'
+28.0°C
$ sensors | grep -A 3 nouveau | awk '/fan1/{print $2}'
2640

  • Like 2
Link to comment
Share on other sites

Thanks jimg, you win the script-fu award! :thumbsup: B)

The Conky line I ended up with is:

$alignc${color #00ff2a}GPU:${color white} ${execi 5 /usr/bin/sensors | grep -A 3 nouveau | awk '/temp1/{print $2}'}   ${execi 5 /usr/bin/sensors | grep -A 3 nouveau | awk '/fan1/{print $2}'}rpm

  • Like 1
Link to comment
Share on other sites

Thanks jimg, you win the script-fu award! :thumbsup: B)

The Conky line I ended up with is:

$alignc${color #00ff2a}GPU:${color white} ${execi 5 /usr/bin/sensors | grep -A 3 nouveau | awk '/temp1/{print $2}'} ${execi 5 /usr/bin/sensors | grep -A 3 nouveau | awk '/fan1/{print $2}'}rpm

 

Well........Lets see a screeny of the working Conky for those of us that are Conky junkies :)

Link to comment
Share on other sites

Nice sunrat. Not over the top but provides you with the info you want to see. Sometimes simple is better though once I get the time, I am sure I will be delving back into the "NOT SO" simple conkys again. :thumbup:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...