Skip to main content
Topic: editing conky to generate swap file size and amount used (Read 156 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

editing conky to generate swap file size and amount used

So is it even possible to use conky to generate output os swap file size and amount used?  If it is then i am clearly doing it wrong.  My conky line in question looks like this

Code: [Select]
${font OpenDyslexic:size=12}${voffset 0}${exec lsb_release -d | awk '{print $2" "$3}'} | Kernel: ${kernel} | Ram: ${mem}/${memmax} | Root: ${fs_used /}/${fs_size /} Swap: ${swap_used /}/${swap_size /}  | Cpu: ${cpu cpu0}%

]]

and the output is shown in the pic.  i tried to copy the root info format but that wasnt the way.
Cat Herders of Linux

Re: editing conky to generate swap file size and amount used

Reply #1
ok i got it.  it's
Code: [Select]
${font OpenDyslexic:size=12}${voffset 0}${exec lsb_release -d | awk '{print $2" "$3}'} | Kernel: ${kernel} | Ram: ${mem}/${memmax} | Root: ${fs_used /}/${fs_size /} Swap: ${fs_used /swap}/${fs_size /swap}  | Cpu: ${cpu cpu0}%
Cat Herders of Linux

Re: editing conky to generate swap file size and amount used

Reply #2
no that doesnt work either.  i turned swap on and conky didnt update the swap info

Code: [Select]
sudo swapon
NAME          TYPE      SIZE USED PRIO
/dev/nvme0n1p5 partition  16G  0B  -2



so i edited fstab to be sure i have it right and rebooted.  inxi see it plainly enough.  so clearly it can be read.

Code: [Select]
Swap:
  ID-1: swap-1 type: partition size: 16 GiB used: 0 KiB (0.0%)
    dev: /dev/nvme1n1p5


i think i've gotten closer to right?

Code: [Select]
${font OpenDyslexic:size=12}${voffset 0}${exec lsb_release -d | awk '{print $2" "$3}'} | Kernel: ${kernel} | Ram: ${mem}/${memmax} | Root: ${fs_used /}/${fs_size /} Swap: ${fs_used /dev/nvme1n1p5}/${fs_size /dev/nvme1n1p5}  | Cpu: ${cpu cpu0}%


that's still not quite right but it seems a step closer?  it's showing my swap size as 3.45gb when it should show as 16gb.  inxi and gparted show it correctly.  why can't i from conky?  is it a root privilege issue?  cant be or i wouldnt have a root file size reported in conky...

Cat Herders of Linux

Re: editing conky to generate swap file size and amount used

Reply #3
So from googleing it it seems i need the mount point for a partition for conky to read it and not a dev id  i e i need /mount/swap or something like that is that right?  but when i do a

Code: [Select]
mount | grep nvme1n1p5

nothing gets returned to me

according to conky.sourceforge.net these commands are relevant

Code: [Select]
fs_bar (height),(width) fs
Bar that shows how much space is used on a file system. height is the height in pixels. fs is any file on that file system.
fs_bar_free (height),(width) fs
Bar that shows how much space is free on a file system. height is the height in pixels. fs is any file on that file system.
fs_free (fs)
Free space on a file system available for users.
fs_free_perc (fs)
Free percentage of space on a file system available for users.
fs_size (fs)
File system size.
fs_type (fs)
File system type.
fs_used (fs)
File system used space.
fs_used_perc (fs)
Percent of file system used space.

so it looks like i'm doing part of it correctly.  so it seems like i need the mount point for swap to to /swap in fstab for that to work but when i set it to /swap and reboot i get nothing reported by adjusating the path to the swap as /swap in conky.  and i get some crazy output when i set it to /dev/nvme1n1p5 which is the dev path reported in inxi and gparted
Cat Herders of Linux

Re: editing conky to generate swap file size and amount used

Reply #4
Code: [Select]

$ swap Shows the amount of SWAP used
$ swapbar (Height, wide) It shows the use of the SWAP in the form of a bar. Height and width are the height and width of the bar in pixels.
$ swapgraph (height, width color1 color2) Show a graph with the use of SWAP. Height and width are the height and width of the graph in pixels. Color1 and color2 are the gradient colors that the graph will take, with color 1 being the most to the left and color 2 being the most to the right
$ swapmax Shows the amount of SWAP we have
$ swapperc Shows the percentage of SWAP used



guess i was overthinking it?



Code: [Select]
conky.text = [[
${font OpenDyslexic:size=12}${voffset 0}${exec lsb_release -d | awk '{print $2" "$3}'} | Kernel: ${kernel} | Ram: ${mem}/${memmax} | Root: ${fs_used /}/${fs_size /} Swap: $swap/$swapmax  | Cpu: ${cpu cpu0}%
]]


there's 3 hrs of my life i wont get back..lol
Cat Herders of Linux

 

Re: editing conky to generate swap file size and amount used

Reply #5
tada!


(thanks for playing)
Cat Herders of Linux