You are not logged in.

#1 2017-06-03 16:31:20

Naik
Member
From: the edge of insanity
Registered: 2015-10-03
Posts: 328

[SOLVED] Some conky v1.10 [syntax transition howto & more].

Hello people!

I`m a conky fan too but know i`m cutting the edges of my knowledge (which i do when ever it comes to actual programming wink )

I`m using conky 1.10.6
Am I save to use the ${pre_exec command} comand with this version?
..and another thing:
I would like to show the status of my firewall within the Network-section of my conky but I only found the command sudo ufw status to read it and now I`m curious whether or not there might be a way to let conky use the sudo command or anthing else to come to a state where the system may provide the status of ufw  in a place where $USER is able to read it...

my conky and the tweaked BL_left_conkyrc:

o7S38fav.jpg

# For commands above TEXT check:
# http://conky.sourceforge.net/config_settings.html
#
# For commands available below TEXT check:
# http://conky.sourceforge.net/variables.html

# Bunsen Labs Conky help threads
# http://crunchbang.org/forums/viewtopic.php?pid=371424#p371424

# beta tested by: smacz
# Enjoy! :)

# pkill -xf "conky -q -c $HOME/.config/conky/BL100eft.conkyrc" &
###  Begin Window Settings  #####################
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
own_window_colour 000000
own_window_class Conky
own_window_title Bunsen Labs Left Conky

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes # Options: yes or no

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 50

minimum_size 222 500  ### width | height
maximum_width 223

#conkymove, original value for gap_x: 20
gap_x 7
#conkymove, original value for gap_y: 20
gap_y 13

alignment tl
#######################  End Window Settings  ###
###  Font Settings  #############################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Liberation Mono:bold:size=9
#xftfont Liberation Sans:size=10
xftfont Monospace:size=10

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
#########################  End Font Settings  ###

###  Colour Settings  ###########################
draw_shades no #yes
default_shade_color 000000

draw_outline no # amplifies text if yes
default_outline_color 000000

#default_color f13d42 # Naik-Red
#default_color FAF6F5 # Salomon
#default_color 656667 # Waldorf original colour
#default_color 0F0F0F # Flame  & Bunsen Grey
default_color 929292 # Labs Grey
#default_color f13d42 # Silver
color0 B0E0E6 # PowderBlue
color1 778899 # LightSlateGray
color2 D8BFD8 # Thistle
color3 9ACD32 # YellowGreen
color4 FFA07A # LightSalmon
color5 FFDEAD # NavajoWhite
color6 00BFFF # DeepSkyBlue
color7 5F9EA0 # CadetBlue
color8 BDB76B # DarkKhaki
color9 CD5C5C # IndianRed
#######################  End Colour Settings  ###

###  Borders Section  ###########################
draw_borders no
# Stippled borders?
stippled_borders 5
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 2
# graph borders
draw_graph_borders no
default_graph_size 10,220
########################  End Borders Secton  ###

###  Miscellaneous Section  #####################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 6144

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable the image cache.
imlib_cache_size 0

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit

# How strict should if_up be when testing an interface for being up?
# The value is one of up, link or address, to check for the interface being solely up,
# being up and having link or being up, having link and an assigned IP address. 
if_up_strictness address

# How often will conky be refreshed?
# Values will be taken as seconds to next update
update_interval 0.5
update_interval_on_battery 2

## │ ─ ┌ ┬ ┐ └ ┴ ┘ ├ ┼ ┤
## ║ ═ ╔ ╦ ╗ ╚ ╩ ╝ ╠ ╬ ╣

## ↑ ↓ → ← ↔ ► ◄ ▲ ▼ « »
## ░  ▒  ▓ ☺ ☻ ♥ ♦ ♣ ♠
## • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼
## ¼ ½ ¾ ® ©

#################  End Miscellaneous Section  ###

TEXT
${color AC7B1C}${font 1942 Report:size=42}${time %X}${font}${color}
${font 1942 Report:size=27}${alignr}${time %x}
${color AC7B1C}${font Monospace:size=6}${offset 23}© nlinedesignz@web.de NC-BY-CC-3.0 \#!/AJL${font Monospace:size=8}${color}
${execi 720 gcalcli --military --nocolor agenda}
${execi 7200 curl -H "Accept-Language: de" wttr.in/Leipzig?0pqT}${font}

${color f13d42}${alignc}${execi 14400 whoami} @ ${nodename}${color}

${color f13d42}Uptime${color}${alignr}${uptime_short}
${voffset 3}${color f13d42}OS${color}${alignr}BunSIDLabs${voffset -4}${font Monospace:size=8} 4${font}${voffset 2}H
${font Monospace:size=10}${voffset 2}${color f13d42}Kernel${color}${alignr}${kernel}${font}

${color f13d42}RAM${color}${alignr}${memperc}% = ${mem} / ${memmax}
${font Monospace:size=10}${color f13d42}Swap${color}${alignr}${swap} of ${swapmax}${font}


${color 376A6D}${alignc}${execi 720000 lscpu | grep 'Model name' | cut -c24-43} @ ${freq_g}GHz${color}

${color 376A6D}Core 1/2${color}${alignr}${cpu cpu0}% / ${cpu cpu1}%
${font Monospace:size=10}${color 376A6D}Prozesse${color}${alignr}${running_processes}/${processes}${font}
${font Monospace:size=7}${offset 37}${top name 1}${alignr}${top cpu 1}%
${offset 37}${top name 2}${alignr}${top cpu 2}%
${offset 37}${top name 3}${alignr}${top cpu 3}%${font}
${color 376A6D}Temp${color}$alignr${execi 30 sensors | sed -n 3p | cut -c13-22}
${color 376A6D}Fan${color}$alignr${execi 30 sensors | sed -n 17p | cut -c13-22}
${font Monospace:size=10}${color 376A6D}Entropie${color}$alignr${execi 7 cat /proc/sys/kernel/random/entropy_avail } / 4096 bits


${color 537E55}${alignc}${execi 7200 hwinfo --gfxcard --short | sed -n 2p | cut -c43-56}${color}

${color 537E55}Temp${color}$alignr${execi 30 sensors | sed -n 22p | cut -c13-22}
${color 537E55}VRS1${color}${alignr}${execi 7200 /usr/local/bin/voyager1}
${color 537E55}VRS2${color}${alignr}${execi 7200 /usr/local/bin/voyager2}${font}

${font Monospace:size=10}/ROOT${alignr}${fs_used_perc /}% / ${fs_size /}
${alignr}${diskiograph /dev/sda4 7,222 0F0F0F 537E55 100 -l}
/HOME${alignr}${fs_used_perc /home}% / ${fs_size /home}
${alignr}${diskiograph /dev/sda3 7,222  0F0F0F 537E55 100 -l }
${font Monospace:size=9}/EXT${alignr}${fs_used_perc /space}% / ${fs_size /space}
${alignr}${diskiograph /dev/sda1 7,222  0F0F0F 537E55 100 -l }${font}
${font Monospace:size=9}/USB${alignr}${fs_used_perc /dev/sdb1}% / ${fs_size /dev/sdb1}
${alignr}${diskiograph /dev/sdb1 7,222  0F0F0F 537E55 100 -l}${font}
${voffset 7}
${color C2681F}${font Monospace:size=10}${alignc}${if_up eth0}KabelNetz${endif}${if_up wlan0}${wireless_essid wlan0} 
${alignr}${wireless_link_qual_perc wlan0} % @ ${wireless_bitrate wlan0}${endif}${font}${color}

${font Monospace:size=9}${color C2681F}IP: ${color}${alignr}${if_existing /proc/net/route wlan0}${addr wlan0}${else}${if_existing /proc/net/route eth0}${addr eth0}${else}Keine IP${endif}${endif} / ${exec wget http://ipinfo.io/ip -qO -}
${voffset 3}${color C2681F}TOR: ${color}${alignr}${exec  service tor status | grep 'Active:' | cut -c 12-18}

${font Monospace:size=10}Down${if_up eth0}${alignr}${downspeed eth0}${endif}${if_up wlan0}${alignr}${downspeed wlan0}${endif} 
${if_up eth0}${downspeedgraph eth0 13,222  0F0F0F C2681F }${endif}${if_up wlan0}${downspeedgraph wlan0 13,222  0F0F0F C2681F}${endif}
UP${if_up eth0}${alignr}${upspeed eth0}${endif}${if_up wlan0}${alignr}${upspeed wlan0}${endif} 
${if_up eth0}${upspeedgraph eth0 13,222  0F0F0F C2681F }${endif}${if_up wlan0}${upspeedgraph wlan0 13,222  0F0F0F C2681F}${endif}${font}

${if_running mocp}${color C2681F}MoC${color}${alignr}${moc_state}
${alignr}${scroll 37 ${moc_artist} - ${moc_title} }${endif}

I hope i hit the right place to ask this! Otherwise feel free to move the post or tell me where to go with it.

Thanks in advance and love to all conkyists*!

naik --greetz

Last edited by Naik (2017-06-07 13:36:47)


"Kaum macht [Mensch]* es richtig, funktioniert es sofort!"
BL-Kitchen Codeberg

Offline

#2 2017-06-03 18:03:30

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

It should be in it's own thread.   I'll move it.

Some answers:
${pre_exec command} is OK for v1.9.0 NOT for 1.10.0+

in conky v1.10.0 use ${execi 86400 ...} the command will update once every 24 hours.

Sudo - No not normally, but - well, not me


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3 2017-06-03 18:30:06

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Also the code you posted is for conky 1.9.0  there is a change in format for conky v1.10

Try this code - it has been converted:

conky.config = {
-- Check the man page for commands in conky v1.10

-- pkill -xf "conky -q -c $HOME/.config/conky/BL100eft.conkyrc" &

-- Begin Window Settings
	own_window = true,
	own_window_type = 'normal',
	own_window_transparent = true,
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',
	own_window_colour = '#000000',
	own_window_class = 'Conky',
	own_window_title = 'Bunsen Labs Left Conky',

-- ARGB can be used for real transparency
-- NOTE that a composite manager is required for real transparency.
-- This option will not work as desired (in most cases) in conjunction with
-- own_window_type normal
	own_window_argb_visual = false,

-- When ARGB visuals are enabled, this use this to modify the alpha value
-- Use: own_window_type normal
-- Use: own_window_transparent no
-- Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
	own_window_argb_value = 50,

	minimum_width = 222, minimum_height = 500,
	maximum_width = 223,

-- conkymove, original value for gap_x: 20
	gap_x = 7,
-- conkymove, original value for gap_y: 20
	gap_y = 13,

	alignment = 'top_left',
-- End Window Settings
-- Font Settings
-- Use Xft (anti-aliased font and stuff)
	use_xft = true,
-- font Liberation Mono:bold:size=9
-- font Liberation Sans:size=10
	font = 'Monospace:size=10',

-- Alpha of Xft font. Must be a value at or between 1 and 0
	xftalpha = 1,
-- Force UTF8? requires XFT ###
	override_utf8_locale = true,

	uppercase = false,

-- End Font Settings
-- Colour Settings

	draw_shades = false,
	default_shade_color = '#000000',

	draw_outline = false,
	default_outline_color = '#000000',

-- default_color = '#f13d42', -- Naik-Red
-- default_color = '#FAF6F5', -- Salomon
-- default_color = '#656667', -- Waldorf original colour
-- default_color = '#0F0F0F', -- Flame  & Bunsen Grey
	default_color = '#929292', -- Labs Grey
-- default_color = '#f13d42', -- Silver
	color0 = '#B0E0E6', -- PowderBlue
	color1 = '#778899', -- LightSlateGray
	color2 = '#D8BFD8', -- Thistle
	color3 = '#9ACD32', -- YellowGreen
	color4 = '#FFA07A', -- LightSalmon
	color5 = '#FFDEAD', -- NavajoWhite
	color6 = '#00BFFF', -- DeepSkyBlue
	color7 = '#5F9EA0', -- CadetBlue
	color8 = '#BDB76B', -- DarkKhaki
	color9 = '#CD5C5C', -- IndianRed

-- End Colour Settings
-- Borders Section
	draw_borders = false,
-- Stippled borders?
	stippled_borders = 5,
-- border margins
	border_inner_margin = 5,
	border_outer_margin = 0,
-- border width
	border_width = 2,
-- graph borders
	draw_graph_borders = false,
	default_graph_width = 10,220,

-- End Borders Secton
-- Miscellaneous Section

-- Boolean value, if true, Conky will be forked to background when started.
	background = true,

-- Adds spaces around certain objects to stop them from moving other things
-- around, this only helps if you are using a mono font
-- Options: right, left or none
	use_spacer = 'none',

-- Default and Minimum size is 256 needs more for single commands that
-- "call" a lot of text IE: bash scripts
	text_buffer_size = 6144,

-- Subtract (file system) buffers from used memory?
	no_buffers = true,

-- change GiB to G and MiB to M
	short_units = true,

-- Like it says, ot pads the decimals on % values
	pad_percents = 2,

-- Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
-- $image lots. Set to 0 to disable the image cache.
	imlib_cache_size = 0,

-- Use the Xdbe extension? (eliminates flicker)
-- It is highly recommended to use own window with this one
-- so double buffer won't be so big.
	double_buffer = true,

--   Maximum size of user text buffer, i.e. layout below TEXT line in config file
--  (default is 16384 bytes)
-- max_user_text 16384

-- Desired output unit of all objects displaying a temperature. Parameters are
-- either "fahrenheit" or "celsius". The default unit is degree Celsius.
-- temperature_unit Fahrenheit

-- How strict should if_up be when testing an interface for being up?
-- The value is one of up, link or address, to check for the interface being solely up,
-- being up and having link or being up, having link and an assigned IP address.
	if_up_strictness = 'address',

-- How often will conky be refreshed?
-- Values will be taken as seconds to next update
	update_interval = 0.5,
	update_interval_on_battery = 2,

-- │ ─ ┌ ┬ ┐ └ ┴ ┘ ├ ┼ ┤
-- ║ ═ ╔ ╦ ╗ ╚ ╩ ╝ ╠ ╬ ╣

-- ↑ ↓ → ← ↔ ► ◄ ▲ ▼ « »
-- ░  ▒  ▓ ☺ ☻ ♥ ♦ ♣ ♠
-- • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼
-- ¼ ½ ¾ ® ©

-- End Miscellaneous Section

};

conky.text = [[
${color AC7B1C}${font 1942 Report:size=42}${time %X}${font}${color}
${font 1942 Report:size=27}${alignr}${time %x}
${color AC7B1C}${font Monospace:size=6}${offset 23}© nlinedesignz@web.de NC-BY-CC-3.0 \#!/AJL${font Monospace:size=8}${color}
${execi 720 gcalcli --military --nocolor agenda}
${execi 7200 curl -H "Accept-Language: de" wttr.in/Leipzig?0pqT}${font}

${color f13d42}${alignc}${execi 14400 whoami} @ ${nodename}${color}

${color f13d42}Uptime${color}${alignr}${uptime_short}
${voffset 3}${color f13d42}OS${color}${alignr}BunSIDLabs${voffset -4}${font Monospace:size=8} 4${font}${voffset 2}H
${font Monospace:size=10}${voffset 2}${color f13d42}Kernel${color}${alignr}${kernel}${font}

${color f13d42}RAM${color}${alignr}${memperc}% = ${mem} / ${memmax}
${font Monospace:size=10}${color f13d42}Swap${color}${alignr}${swap} of ${swapmax}${font}


${color 376A6D}${alignc}${execi 720000 lscpu | grep 'Model name' | cut -c24-43} @ ${freq_g}GHz${color}

${color 376A6D}Core 1/2${color}${alignr}${cpu cpu0}% / ${cpu cpu1}%
${font Monospace:size=10}${color 376A6D}Prozesse${color}${alignr}${running_processes}/${processes}${font}
${font Monospace:size=7}${offset 37}${top name 1}${alignr}${top cpu 1}%
${offset 37}${top name 2}${alignr}${top cpu 2}%
${offset 37}${top name 3}${alignr}${top cpu 3}%${font}
${color 376A6D}Temp${color}$alignr${execi 30 sensors | sed -n 3p | cut -c13-22}
${color 376A6D}Fan${color}$alignr${execi 30 sensors | sed -n 17p | cut -c13-22}
${font Monospace:size=10}${color 376A6D}Entropie${color}$alignr${execi 7 cat /proc/sys/kernel/random/entropy_avail } / 4096 bits


${color 537E55}${alignc}${execi 7200 hwinfo --gfxcard --short | sed -n 2p | cut -c43-56}${color}

${color 537E55}Temp${color}$alignr${execi 30 sensors | sed -n 22p | cut -c13-22}
${color 537E55}VRS1${color}${alignr}${execi 7200 /usr/local/bin/voyager1}
${color 537E55}VRS2${color}${alignr}${execi 7200 /usr/local/bin/voyager2}${font}

${font Monospace:size=10}/ROOT${alignr}${fs_used_perc /}% / ${fs_size /}
${alignr}${diskiograph /dev/sda4 7,222 0F0F0F 537E55 100 -l}
/HOME${alignr}${fs_used_perc /home}% / ${fs_size /home}
${alignr}${diskiograph /dev/sda3 7,222  0F0F0F 537E55 100 -l }
${font Monospace:size=9}/EXT${alignr}${fs_used_perc /space}% / ${fs_size /space}
${alignr}${diskiograph /dev/sda1 7,222  0F0F0F 537E55 100 -l }${font}
${font Monospace:size=9}/USB${alignr}${fs_used_perc /dev/sdb1}% / ${fs_size /dev/sdb1}
${alignr}${diskiograph /dev/sdb1 7,222  0F0F0F 537E55 100 -l}${font}
${voffset 7}
${color C2681F}${font Monospace:size=10}${alignc}${if_up eth0}KabelNetz${endif}${if_up wlan0}${wireless_essid wlan0}
${alignr}${wireless_link_qual_perc wlan0} % @ ${wireless_bitrate wlan0}${endif}${font}${color}

${font Monospace:size=9}${color C2681F}IP: ${color}${alignr}${if_existing /proc/net/route wlan0}${addr wlan0}${else}${if_existing /proc/net/route eth0}${addr eth0}${else}Keine IP${endif}${endif} / ${exec wget http://ipinfo.io/ip -qO -}
${voffset 3}${color C2681F}TOR: ${color}${alignr}${exec  service tor status | grep 'Active:' | cut -c 12-18}

${font Monospace:size=10}Down${if_up eth0}${alignr}${downspeed eth0}${endif}${if_up wlan0}${alignr}${downspeed wlan0}${endif}
${if_up eth0}${downspeedgraph eth0 13,222  0F0F0F C2681F }${endif}${if_up wlan0}${downspeedgraph wlan0 13,222  0F0F0F C2681F}${endif}
UP${if_up eth0}${alignr}${upspeed eth0}${endif}${if_up wlan0}${alignr}${upspeed wlan0}${endif}
${if_up eth0}${upspeedgraph eth0 13,222  0F0F0F C2681F }${endif}${if_up wlan0}${upspeedgraph wlan0 13,222  0F0F0F C2681F}${endif}${font}

${if_running mocp}${color C2681F}MoC${color}${alignr}${moc_state}
${alignr}${scroll 37 ${moc_artist} - ${moc_title} }${endif}
]];

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#4 2017-06-03 18:39:45

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

RE: Network

What does:

   $ service iptables status

tell you?

If I'm right, try this:

service iptables status | grep "Active:" | cut -c 12-

If that looks good:

${execi 30 service iptables status | grep "Active:" | cut -c 12-}

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#5 2017-06-03 19:32:26

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Convert v1.9 conkys to v1.10 conkys!

convert.lua will exist (should exist) in /usr/share/doc/conky-all/convert.lua

Copy that to your home directory in it's own directory.  I have it in:
/home/sector11/convert-lua/convert.lua

I copied your conky to:

/home/sector11/convert-lua/naik.conky

To use convert.lua you must be in the same directory:

cd /home/sector11/convert-lua

Now you have two options:

1. - overwrite the old file with the new:

   $ lua convert.lua naik.conky

or
2. - create a new file - keeping the old

   $ lua convert.lua naik.conky naik-10.lua

All old conkys can be converted - However: SOME TWEAKING MAY BE REQUIRED.

To keep "tweaking" to a minimum remove ALL commented out lines above TEXT that are actual conky commands as the convert.lua  will NOT touch those line - they retain the conky v1.9 format.

v1.9

## own_window_argb_visual no -- Options: yes or no
## own_window_argb_value 50

converted to v1.10

--# own_window_argb_visual no -- Options: yes or no
--# own_window_argb_value 50

and the real commands should convert to:

	own_window_argb_visual = false,
	own_window_argb_value = 50,

In other words, make the conky to be converted as simple as possible,
- do not include comments
- do not include variables commented out
- do not include variables not needed.

So far for me: it 'seems' to work better that way.
YMMV


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#6 2017-06-03 21:04:22

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Shouldn't this thread be in "GUI & Applications"? "Scripts, Tutorials & Tips" isn't intended as a place for help requests, but for working ideas.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#7 2017-06-03 23:59:27

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Naik wrote:

Hello people!

I would like to show the status of my firewall within the Network-section of my conky but I only found the command sudo ufw status to read it and now I`m curious whether or not there might be a way to let conky use the sudo command or anthing else to come to a state where the system may provide the status of ufw  in a place where $USER is able to read it...

naik --greetz

Do you just need to verify it was activated on boot, or is the ufw status something you need/want to check periodically?

@S11 - do you know if ufw is started by it's own service so that:

$ service iptables status

can be

$ service gfw status

I guess naik can check that out.

Last edited by PackRat (2017-06-04 00:02:11)


You must unlearn what you have learned.
    -- yoda

Offline

#8 2017-06-04 00:15:10

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

@PackRat - we'll have to wait for Naik to check.

I'm just a desktop with a wired connection and that was from a quick search.

====================
@ damo - right you are - My OOPS! - moved.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#9 2017-06-04 21:01:49

Naik
Member
From: the edge of insanity
Registered: 2015-10-03
Posts: 328

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Hello and thanks for the fast replies!

S11 wrote:

Try this code - it has been converted
[...]

It works like a charm, thank you! Now i will rethink my position on downgrade ability, when relevant config changes appear without me even recognizing :8

I don't have this much different conkys flying  around here so will skip the automation of conversion for now.
Great thanks for the HowTo anyways! I will come back on it as I might.

For the networking problem:
I only want to verify whether or not it is running on boot.

service iptables status returns:

Unit iptables.service could not be found.

I think this is because i "made" the module as build-in. (?)
Accordingly service gfw status gives:

Unit gfw.service could not be found.

Now that Sektor11 mentioned this thread i remeber to once have been gotten around a similar problem by creating a cron-job for root which was about to upgrade apt sources on system boot to provide proper information about upgradeable packages to $USER.
I think ufw should be invoked before any user login takes place, so it should be possible to "echo" the output of this invokation to a file like ~/.ufw_state or similar which is readable to conky. Am i right there?

naik --greetz


"Kaum macht [Mensch]* es richtig, funktioniert es sofort!"
BL-Kitchen Codeberg

Offline

#10 2017-06-04 22:39:41

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

ufw should be invoked before any user login takes place, so it should be possible to "echo" the output of this invokation to a file like ~/.ufw_state or similar which is readable to conky. Am i right there?

That's basically what I was driving at. I've seen some other configs that will use a command/script that require root credentials to send output to a text file, then have conky parse the contents. Sometimes you can put the command in rc.local - which makes things easy.

Last edited by PackRat (2017-06-04 22:40:12)


You must unlearn what you have learned.
    -- yoda

Offline

#11 2017-06-04 22:42:44

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Yes you can read that file ~/.ufw_state

Example:

 04 Jun 17 @ 19:12:15 ~
   $ service iptables status>~/ipt.txt
 
 04 Jun 17 @ 19:12:39 ~
   $ cat ~/ipt.txt
● iptables.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
 
 04 Jun 17 @ 19:12:54 ~
   $ cat ~/ipt.txt | sed -n '3p'
   Active: inactive (dead)

and conky:

${execi 900 cat ~/ipt.txt | sed -n '3p'}

2017-06-04_191954_Scrot11.th.jpg


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#12 2017-06-07 13:29:21

Naik
Member
From: the edge of insanity
Registered: 2015-10-03
Posts: 328

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Thank you very much!
I wasn`t able to call service.ip-tables* but got things going by calling service.ufw in the conky:

${execi 14400 service ufw status | grep 'Active:' | cut -c 12-18}

(The same way i did for months now to get information about tor just in the same conky *facepalm)

Bildschirmfoto_2017-06-07_15-24-16_croped.th.png

*Is this really related to the fact it is a build-in module which has not to be called as a service or am i confused here?

Anyways! Problem solved and i really appreciate your help!

** I edited the title in respect to the detailed instruction Sektor11 provided! May it be of much help to the ones that will follow! It was pure for gold for me and much more than i have asked for!

naik --greetz

Last edited by Naik (2017-06-07 13:38:53)


"Kaum macht [Mensch]* es richtig, funktioniert es sofort!"
BL-Kitchen Codeberg

Offline

#13 2017-06-07 14:47:07

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

@ Naik

Thanks for changing the Subject - I think it will help.  And look at this:

 07 Jun 17 @ 11:45:03 ~
   $ service ufw status
● ufw.service - LSB: start firewall
   Loaded: loaded (/etc/init.d/ufw)
   Active: active (exited) since Tue 2017-06-06 11:15:23 -03; 24h ago
  Process: 400 ExecStart=/etc/init.d/ufw start (code=exited, status=0/SUCCESS)
 
 07 Jun 17 @ 11:45:04 ~
   $ 

Works for me as well.  Coming to a keyboard conky soon.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#14 2017-06-07 19:07:16

Naik
Member
From: the edge of insanity
Registered: 2015-10-03
Posts: 328

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

^ Jeah, that's basically what i did now too.


"Kaum macht [Mensch]* es richtig, funktioniert es sofort!"
BL-Kitchen Codeberg

Offline

#15 2017-06-07 21:41:13

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

You are helping me in my Keyboard Conky quest.  Thank you.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#16 2017-06-08 06:42:39

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,065
Website

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Just for the record, the old `service foo status` (&c) commands are now just wrappers for the systemd equivalents so you should probably just use those instead:

systemctl status ufw

Offline

#17 2017-06-08 18:44:52

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

@ HoaS - how right you are.  The results are identical. 

Searched and found: How To Use Systemctl to Manage Systemd Services and Units that talks about "is-active", "is-enabled" and "is-failed" as well.   This opens a whole new world for me-n-conky. {insert really big grin}

Test conky:

-> service ufw status:
${execi 30 service ufw status}
-> systemctl status ufw:
${execi 30 systemctl status ufw.service}

Or even better!
-> systemctrl is-active ufw
${execi 30 systemctl is-active ufw.service}
-> systemctrl is-enabled ufw
${execi 30 systemctl is-ensbled ufw.service}
-> systemctl is-failed ufw
${execi 30 systemctl is-failed ufw.service}

SO much nicer - no need for grep, cut or sed:
UFW: ${if_match "${execi 30 systemctl is-active ufw.service == "active"}} Active${else}Inactive${endif}

2017-06-08_152950_Scrot11.jpg
Head_on_a_Stick:  You never cease to amaze me.  KUDOS!
Tweak applied to Keyboard Conky!

While the site says it's OK to drop ".service" from the command - I think I'll keep it:

 08 Jun 17 @ 15:39:01 ~
   $ sff "*.service" /
[sudo] password for sector11: 
/run/systemd/generator.late/rpcbind.service
/run/systemd/generator.late/keyboard-setup.service
/run/systemd/generator.late/ntp.service
/run/systemd/generator.late/exim4.service
/run/systemd/generator.late/kbd.service
/run/systemd/generator.late/nfs-common.service
/run/systemd/generator.late/loadcpufreq.service
/run/systemd/generator.late/console-setup.service
/run/systemd/generator.late/netdiag.service
/run/systemd/generator.late/hddtemp.service
/run/systemd/generator.late/cpufrequtils.service
/run/systemd/generator.late/glances.service
/run/systemd/generator.late/networking.service
/run/systemd/generator.late/collectl.service
/run/systemd/generator.late/runlevel5.target.wants/ntp.service
/run/systemd/generator.late/runlevel5.target.wants/exim4.service
/run/systemd/generator.late/runlevel5.target.wants/loadcpufreq.service
/run/systemd/generator.late/runlevel5.target.wants/netdiag.service
/run/systemd/generator.late/runlevel5.target.wants/hddtemp.service
/run/systemd/generator.late/runlevel5.target.wants/cpufrequtils.service
/run/systemd/generator.late/runlevel5.target.wants/glances.service
/run/systemd/generator.late/runlevel5.target.wants/collectl.service
/run/systemd/generator.late/runlevel5.target.wants/dictd.service
/run/systemd/generator.late/runlevel4.target.wants/ntp.service
/run/systemd/generator.late/runlevel4.target.wants/exim4.service
/run/systemd/generator.late/runlevel4.target.wants/loadcpufreq.service
/run/systemd/generator.late/runlevel4.target.wants/netdiag.service
/run/systemd/generator.late/runlevel4.target.wants/hddtemp.service
/run/systemd/generator.late/runlevel4.target.wants/cpufrequtils.service
/run/systemd/generator.late/runlevel4.target.wants/glances.service
/run/systemd/generator.late/runlevel4.target.wants/collectl.service
/run/systemd/generator.late/runlevel4.target.wants/dictd.service
/run/systemd/generator.late/runlevel3.target.wants/ntp.service
/run/systemd/generator.late/runlevel3.target.wants/exim4.service
/run/systemd/generator.late/runlevel3.target.wants/loadcpufreq.service
/run/systemd/generator.late/runlevel3.target.wants/netdiag.service
/run/systemd/generator.late/runlevel3.target.wants/hddtemp.service
/run/systemd/generator.late/runlevel3.target.wants/cpufrequtils.service
/run/systemd/generator.late/runlevel3.target.wants/glances.service
/run/systemd/generator.late/runlevel3.target.wants/collectl.service
/run/systemd/generator.late/runlevel3.target.wants/dictd.service
/run/systemd/generator.late/runlevel2.target.wants/ntp.service
/run/systemd/generator.late/runlevel2.target.wants/exim4.service
/run/systemd/generator.late/runlevel2.target.wants/loadcpufreq.service
/run/systemd/generator.late/runlevel2.target.wants/netdiag.service
/run/systemd/generator.late/runlevel2.target.wants/hddtemp.service
/run/systemd/generator.late/runlevel2.target.wants/cpufrequtils.service
/run/systemd/generator.late/runlevel2.target.wants/glances.service
/run/systemd/generator.late/runlevel2.target.wants/collectl.service
/run/systemd/generator.late/runlevel2.target.wants/dictd.service
/run/systemd/generator.late/dictd.service
/run/systemd/generator.late/hdparm.service
/run/systemd/generator.late/sysinit.target.wants/rpcbind.service
/run/systemd/generator.late/sysinit.target.wants/keyboard-setup.service
/run/systemd/generator.late/sysinit.target.wants/kbd.service
/run/systemd/generator.late/sysinit.target.wants/nfs-common.service
/run/systemd/generator.late/sysinit.target.wants/console-setup.service
/run/systemd/generator.late/sysinit.target.wants/networking.service
/run/systemd/generator.late/sysinit.target.wants/hdparm.service
/run/systemd/generator.late/sysinit.target.wants/ufw.service
/run/systemd/generator.late/ufw.service
/run/systemd/generator.late/rcS.service
/run/systemd/generator.late/rc.service
/run/systemd/generator.late/ifupdown.service
/run/systemd/generator/multi-user.target.wants/rc-local.service
/run/systemd/generator/local-fs.target.wants/systemd-fsck-root.service

= = = = = This is NOT a question not a plea for help; just a thought
Now to figure out why "is-enabled" shows nothing - another day ... too much to play with now.

Last edited by Sector11 (2017-06-08 19:19:41)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#18 2017-06-08 19:09:34

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,065
Website

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Sector11 wrote:

Now to figure out why "is-enabled" shows nothing

Multiple typographical errors, methinks.

I know it sounds unlikely but the text bears me out on this big_smile

Offline

#19 2017-06-08 19:29:07

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

${execi 30 systemctl is-ensbled ufw.service}

yikes roll  lol  lol
Well, I am "Conkystador & Tpyo Knig", how  :8
and it now reports: enabled

GRACIAS!!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#20 2017-06-08 20:20:12

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 1,897

Re: [SOLVED] Some conky v1.10 [syntax transition howto & more].

Sector11 wrote:

${execi 30 systemctl is-ensbled ufw.service}

yikes roll  lol  lol
Well, I am "Conkystador & Tpyo Knig", how  :8
and it now reports: enabled

GRACIAS!!

Lol maybe more coffee is in order big_smile


Real Men Use Linux

Offline

Board footer

Powered by FluxBB