Skip to content

Instantly share code, notes, and snippets.

@lunix33
Last active January 24, 2020 00:47
Show Gist options
  • Select an option

  • Save lunix33/ec1556ca22a81d2d7b1778a28fab67d7 to your computer and use it in GitHub Desktop.

Select an option

Save lunix33/ec1556ca22a81d2d7b1778a28fab67d7 to your computer and use it in GitHub Desktop.
Simple monitor configuration for Conky.
--
-- Edit this section by filling in the information you want the monitor to display for specific section.
--
-- The title to display at the top of the monitor.
local title = "${nodename}"
-- The list of storage mount points to display.
-- Use `df` to see the list of drive with mount point.
local storageList = {"/", "/mnt/array"}
-- The list of network interfaces to display.
-- Use `ip a` to see the list of network interfaces available.
local interfacesList = {"eno2"}
---- You should not edit past that point to preserve the current monitor features -----------------
-- Generate a list of storage data.
-- mount (table) : The list of mount point for which the list is generated.
function genStorage(mount)
local rtn = [[]]
for i,v in pairs(mount) do
rtn = rtn .. [[
${color gray}]]..v..[[${color}${goto 85}${fs_bar 6 ]]..v..[[}
${voffset -10}${alignr}${font Ubuntu:size=8}${fs_used ]]..v..[[} / ${fs_size ]]..v..[[}${font}${alignr}
]]
end
return rtn
end
-- Generate a list of networking data.
-- interfaces (table): List of networking interfaces for which the list is generated.
function genNetworking(interfaces)
local rtn = [[]]
for i,v in pairs(interfaces) do
rtn = rtn .. [[
${color gray}IP ]]..v..[[${color}: ${addr ]]..v..[[}
${color gray}↑:${color} ${upspeed ]]..v..[[} ${goto 125}${color grey}↓:${color} ${downspeed ]]..v..[[}
${voffset -5}${upspeedgraph ]]..v..[[ 35,115}${goto 125}${downspeedgraph ]]..v..[[ 35,115}
]]
end
return rtn
end
-- Generate a list of processes
-- count (number): The number of process to display.
function genProcessList(count)
rtn = [[]]
for i = 1,count,1 do
rtn = rtn .. [[
${font Ubuntu:size=8}${top name ]]..i..[[}(${top pid ]]..i..[[})${font}${goto 160}${top cpu ]]..i..[[} ${top mem ]]..i..[[}
]]
end
return rtn
end
conky.config = {
alignment = 'top_right',
background = true,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'white',
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
use_xft = true,
font = 'Ubuntu:size=10',
gap_x = 5,
gap_y = 0,
minimum_height = 4000,
minimum_width = 250,
maximum_width = 250,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'desktop',
stippled_borders = 0,
update_interval = 1.0,
uppercase = false,
use_spacer = 'none',
show_graph_scale = false,
show_graph_range = false
}
local header = [[
${alignc}${font Ubuntu:size=20}${time %H:%M:%S}${font}${alignc}
${alignc}${font Ubuntu:size=15}${time %d %B %Y}${font}${alignc}
${voffset 3}
${alignc}${font Ubuntu:size=15}]]..title..[[${font}${alignc}
]]
local performance = [[
$hr
${color red}${alignr}${font Ubuntu:size=13}Performance${font}${alignr}${color}
${color grey}Uptime:$color $uptime
${color grey}CPU:$color
${voffset -5}${cpugraph 35}
${voffset -13}${alignr}${font Ubuntu:size=8}$freq_g GHz ($cpu%)${font}${alignr}
${voffset -10}${color grey}RAM/Swap:$color
${voffset -5}${memgraph 35}
${voffset -13}${alignr}${font Ubuntu:size=8}$mem/$memmax - $memperc%${font}${alignr}
${voffset -8}${swapbar 4}
${voffset -10}${alignr}${font Ubuntu:size=8}$swap/$swapmax - $swapperc%${font}${alignr}
]]
local storage = [[
$hr
${color yellow}${alignr}${font Ubuntu:size=13}Storage${font}${alignr}${color}
]] .. genStorage(storageList)
local networking = [[
$hr
${color blue}${alignr}${font Ubuntu:size=13}Networking${font}${alignr}${color}
]] .. genNetworking(interfacesList)
local processes = [[
$hr
${color green}${alignr}${font Ubuntu:size=13}Processes${font}${alignr}${color}
${color grey}Uptime:$color $uptime
${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes
${color grey}Name (PID)${alignr}CPU% MEM%${alignr}
]] .. genProcessList(10)
conky.text = header .. performance .. storage .. networking .. processes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment