Conky: Choose CPUs to make average data

Created on 7 Sep 2018  路  5Comments  路  Source: brndnmtthws/conky

We can get now common average data for all CPUs and pass it into LUA, or we can get data for separate CPU e.g. cpu0, cpu1..... cpuN.

How Can we get for 4 CPUs( cpu0 cpu1 cpu2 cpu3) get (cpu0+cpu1)/2 or (cpu2+cpu3)/2
to get 2 averaged values from 4 CPU? (And how pass it to LUA)

question

Most helpful comment

Here is the corrected file - and should work. I have changed a few things to dot notation. Also keep in mind the count starts with cpu1 while cpu0 is average of all your cpus. The data for cpu 3 and 4 is commented out as you just need data for 2 cpus.

Kindly close this issue if things are working as desired.

clock_rings.lua.zip

All 5 comments

You can do something like this in LUA script

local ct = {}

ct[1] = tonumber(conky_parse('${cpu cpu1}'))
ct[2] = tonumber(conky_parse('${cpu cpu2}'))
ct[3] = tonumber(conky_parse('${cpu cpu3}'))
ct[4] = tonumber(conky_parse('${cpu cpu4}'))

local avg1 = (ct[1] + ct[2])/2
local avg2 = (ct[3] + ct[4])/2

print('avg 1: ' .. avg1, ct[1], ct[2])
print('avg 2: ' .. avg2, ct[3], ct[4])

Just tried but no success - still thinking(arg or name seems has not suitable format), if it is interesting and if your please - mine simple config:

Conky_Antergos.zip

Here is the corrected file - and should work. I have changed a few things to dot notation. Also keep in mind the count starts with cpu1 while cpu0 is average of all your cpus. The data for cpu 3 and 4 is commented out as you just need data for 2 cpus.

Kindly close this issue if things are working as desired.

clock_rings.lua.zip

@Ygarr - I should also suggest that you use current version of conky - and not the legacy 1.9x variant. We are not using that and is quite impossible to support it.

@plikhari Thanks for the help. I think we're done here. Kindly closing this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akorop picture akorop  路  3Comments

mreinhardt picture mreinhardt  路  3Comments

fonic picture fonic  路  3Comments

leahneukirchen picture leahneukirchen  路  3Comments

nwwt picture nwwt  路  5Comments