sunrat Posted July 22, 2014 Share Posted July 22, 2014 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) Quote Link to comment Share on other sites More sharing options...
amenditman Posted July 22, 2014 Share Posted July 22, 2014 (edited) 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 July 22, 2014 by amenditman 1 Quote Link to comment Share on other sites More sharing options...
jimg Posted July 22, 2014 Share Posted July 22, 2014 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 1 Quote Link to comment Share on other sites More sharing options...
amenditman Posted July 22, 2014 Share Posted July 22, 2014 Beautiful, and you didn't even need ugly old (super powerful) sed! Quote Link to comment Share on other sites More sharing options...
jimg Posted July 23, 2014 Share Posted July 23, 2014 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 2 Quote Link to comment Share on other sites More sharing options...
sunrat Posted July 24, 2014 Author Share Posted July 24, 2014 Thanks jimg, you win the script-fu award! 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 1 Quote Link to comment Share on other sites More sharing options...
ichase Posted July 24, 2014 Share Posted July 24, 2014 Thanks jimg, you win the script-fu award! 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 Quote Link to comment Share on other sites More sharing options...
sunrat Posted July 25, 2014 Author Share Posted July 25, 2014 Almost the same as the last screenshot I posted: Quote Link to comment Share on other sites More sharing options...
ichase Posted July 25, 2014 Share Posted July 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
securitybreach Posted July 26, 2014 Share Posted July 26, 2014 Almost the same as the last screenshot I posted: Very nice Sunrat!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.