You are not logged in.

#1 2010-03-31 14:39:35

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

[Conky] Check which interface is connected

Hi,
I like to display uploads and downloads speeds on my conky bar.
Until today I used to check /proc/net/route and look for eth0 or wlan0 to discriminate if I was connected to the net via cable or wireless:

${if_existing /proc/net/route eth0}...${endif} ${if_existing /proc/net/route wlan0}...${endif}

I don't know why but /proc/net/route doesn't exist anymore on my system so this method doesn't work anymore.

How can I make conky check to what interface I'm connected to the net and display related informtion?
I'm sure ther's plenty of different methods, have your say!

Thanks! smile


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#2 2010-03-31 14:51:55

livibetter
Member
From: Taipei
Registered: 2008-05-14
Posts: 95
Website

Re: [Conky] Check which interface is connected

There is a ${if_up interface}. http://conky.sourceforge.net/variables.html

Offline

#3 2010-03-31 15:23:32

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Conky] Check which interface is connected

Ooopss...
Last time I edited my conky (a long time ago) that option didn't exist: I'll test it and report if it works.

Thanks!


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#4 2010-03-31 15:36:21

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Conky] Check which interface is connected

Uhm... it doesn't work apparently.

Even if I start my computer without any wired/wireless connection I still get the information that shouldn't be displayed.
It seems that this command check if the interface is up but I want to know if the interfce is actually connected to the network.

Any hints?
Thanks,


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#5 2010-03-31 16:50:10

blasse
Member
From: Poland
Registered: 2008-04-24
Posts: 303

Re: [Conky] Check which interface is connected

Try to setup if_up_strictness address in .conkyrc smile

if_up_strictness
              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.


Proud ex-maintainer of firefox-pgo

Offline

#6 2010-03-31 17:40:56

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Conky] Check which interface is connected

Thank you blasse, I just found that parameter some seconds before reading your reply and it seems to work now.
However I've just confirmed that this issue is due to conky 1.8 latest upgrade, as the new conky seems not to recognize the format ${if_existing /path/to/file text} anymore.

I will post my .conkyrc  with the latest changes, just for reference:

#avoid flicker
double_buffer yes

#own window to run simultanious 2 or more conkys
own_window  yes
own_window_transparent no
own_window_type desktop 
own_window_hints undecorate,sticky,skip_taskbar,skip_pager 

#borders
draw_borders no
border_inner_margin 3

#shades
draw_shades no

#position
gap_x 0
gap_y 4
alignment top_middle

#behaviour
update_interval 1

#colour
default_color  606060
#default_shade_color 000000
own_window_colour 303030

#font
use_xft yes
xftfont sans:size=8

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

#to prevent window from moving
use_spacer none
minimum_size 1280 0
maximum_width 1280

# Network interface must have an ip address to be considered up
if_up_strictness address

TEXT
${alignc}${color}Date: ${color ecedee}${time %d/%m/%y}  ${color}Time: ${color ecedee}${time %H:%M}  ${color}|  Kernel: ${color ecedee}$kernel  ${color}Uptime: ${color ecedee}${uptime_short}  ${color}|  Cpu1: ${color ecedee}${cpu cpu1}%  ${color}Cpu2: ${color ecedee}${cpu cpu2}%  ${color}Ram: ${color ecedee}${memperc}%  ${color}Swap: ${color ecedee}${swapperc}%  ${color}|  Root: ${color ecedee}${fs_used_perc /}%  ${color}Home: ${color ecedee}${fs_used_perc /home}%  ${color}|  Mobo: ${color ecedee}${execi 300 sensors | grep temp1 | cut -c15-16 ;}°C  ${color}Cpu1: ${color ecedee}${execi 300 sensors | grep Core\ 0 | cut -c15-16 ;}°C  ${color}Cpu2: ${color ecedee}${execi 300 sensors | grep Core\ 1 | cut -c15-16 ;}°C  ${color}Disk: ${color ecedee}${hddtemp /dev/sda}°C  ${color}|  ${if_up wlan0}Up: ${color ecedee}${upspeedf wlan0} kb/s  ${color}Down: ${color ecedee}${downspeedf wlan0} kb/s ${endif}${if_up eth0}${color}Up: ${color ecedee}${upspeedf eth0} kb/s  ${color}Down: ${color ecedee}${downspeedf eth0} kb/s ${endif}${alignc}

rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#7 2010-04-02 01:32:53

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [Conky] Check which interface is connected

/proc/net/route does exist on my system still, but if_existing seems to have gotten its logic reversed, returning 'true' if the value does NOT exist. Its a bug.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#8 2010-04-05 16:09:57

frigaut
Member
From: Canberra, Australia
Registered: 2009-05-10
Posts: 215
Website

Re: [Conky] Check which interface is connected

ngoonee wrote:

/proc/net/route does exist on my system still, but if_existing seems to have gotten its logic reversed, returning 'true' if the value does NOT exist. Its a bug.

The same bug hit me. ngoonee, did you file a bug upstream?


Archer since 03/2009 - AUR packages

Offline

#9 2010-04-08 15:45:13

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [Conky] Check which interface is connected

frigaut wrote:
ngoonee wrote:

/proc/net/route does exist on my system still, but if_existing seems to have gotten its logic reversed, returning 'true' if the value does NOT exist. Its a bug.

The same bug hit me. ngoonee, did you file a bug upstream?

No I did not. You're welcome to. I should, but don't have any account on any conky-related stuff, so filed it away under 'to-do'.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#10 2010-04-22 23:19:08

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [Conky] Check which interface is connected

Just got off my ass to try to submit a bug, found one already submitted and closed (https://sourceforge.net/tracker/?func=d … tid=757308).

Thanks to ugaciaka, I think he's a member of these forums even.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#11 2010-04-26 18:52:10

arch_angel
Member
From: Cape Town, South Africa
Registered: 2010-04-26
Posts: 2

Re: [Conky] Check which interface is connected

This is my first post ever on any forum as I always seems to get the answers I'm looking for by searching through the forums but I cannot seems to figure out my conky problem. Conky does not display the weather script ie. conkyForecast.py at all but the moment I turn off my router and run conky the information displays (with the outdated weather info). I've gone through the suggestions on this forum but nothing seems to work. Please advise what am I doing wrong. Here is my conky file:

# Use Xft?
use_xft yes
xftfont cure:size=6

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window  yes
own_window_transparent no
# own_window_type widget
own_window_type desktop
#own_window_hints undecorate,sticky,skip_taskbar,skip_pager 

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 87 0

maximum_width 87

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders yes

# Stippled borders?
stippled_borders 0

# border margins
border_inner_margin 5

# border width
border_width 1

# Default colors and also border colors
default_color 303030
#default_shade_color white
#default_outline_color black
own_window_colour 262524

# Text alignment, other possible values are commented
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 1550
gap_y 188

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer right

if_up_strictness address

TEXT
${if_up eth0}${color a4a4a4}${alignc}${execi 3600  python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=CC}
${alignr 43}${font Weather:size=46}${execi 3600 python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=WF}${font} 
${color 668ABF}${voffset -32} ${execi 3600 python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=HT}


${color 9AB7DC}Wind:${color a4a4a4}${alignr}${execi 3600 python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=WS}
${color 9AB7DC}Direction:${color a4a4a4}${alignr 5}${execi 3600 python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=WD}
${color 9AB7DC}Humidity:${color a4a4a4}${alignr}${execi 3600 python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=HM}
${color 9AB7DC}Sunrise:${color a4a4a4}${alignr}${execi 3600 python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=SR}
${color 9AB7DC}Sunset:${color a4a4a4}${alignr}${execi 3600 python ~/scripts/conkyForecast.py --location=SFXX0010 --datatype=SS}${endif}

Last edited by arch_angel (2010-04-26 19:07:49)


2.6.33-ARCH x86_64 | Gnome 2.30.0 | And luvin it...

Offline

#12 2010-04-26 21:45:45

frigaut
Member
From: Canberra, Australia
Registered: 2009-05-10
Posts: 215
Website

Re: [Conky] Check which interface is connected

First of all, welcome. I don't remember when my first post "ever" was, but it's been a while :-)

regarding your issue:
* where did you get conkyForecast.py from? AUR? which one (there are 2)
* do you get any error when you start conky from the command line?


Archer since 03/2009 - AUR packages

Offline

#13 2010-04-27 03:14:01

lpb331
Member
From: Oregon
Registered: 2007-12-18
Posts: 44

Re: [Conky] Check which interface is connected

Welcome, arch_angel! I had a similar problem with a python script in conky. Changing execi to execpi solved it for me.

Offline

#14 2010-04-27 03:17:27

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [Conky] Check which interface is connected

arch_angel, if your question is not related to the OP (as with this thread), its better to ask it in a separate thread.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#15 2010-04-27 21:53:15

arch_angel
Member
From: Cape Town, South Africa
Registered: 2010-04-26
Posts: 2

Re: [Conky] Check which interface is connected

Thank you for the warm welcome, I think I found a new forum to call home cool

big_smile Thanx for the suggestion lpb331, that did the trick.

frigaut, I think I got the script from gnome-look.org when I was still using Ubuntu(last year sometime) not from the AUR.

ngoonee, I'll keep that in mind next time I post.


2.6.33-ARCH x86_64 | Gnome 2.30.0 | And luvin it...

Offline

Board footer

Powered by FluxBB