Netmon - a lightweight tray network monitor useful with netctl

I rewrote it from Tidybattery.
Here is the code, and the AUR package.

Hello,
I have ported this little script to use Python 3 and PyQt4, because I found it usefull and I'm using razor-qt as my desktop. It's not finished (I have no wired connection to test), but works for my wireless connection.
#!/usr/bin/env python3
import os
import re
import sys
from subprocess import check_output
from PyQt4 import QtCore, QtGui
ENC = sys.getfilesystemencoding() or 'utf-8'
eth_re = re.compile(r'(inet6? [^ ]*) ', re.I)
def _get_interfaces(exclude_localhost=True):
if exclude_localhost:
return [x for x in os.listdir('/sys/class/net') if x != 'lo']
else:
return os.listdir('/sys/class/net')
def get_default_interface():
"""Returns the interface for the default route."""
ifaces = _get_interfaces()
out = check_output(['ip', 'route', 'list', 'scope', 'global']).decode(ENC)
for line in out.split('\n'):
if line.startswith('default'):
for iface in ifaces:
if ' {0} '.format(iface) in line:
return iface
def check_carrier(iface):
with open(os.path.join('/sys/class/net', iface, 'carrier')) as fp:
return fp.read().strip() == '1'
def get_wireless_status():
return check_output(['wpa_cli', 'status']).decode(ENC).strip()
def get_wired_status(iface):
out = check_output(['ip', 'addr', 'show', 'dev', iface]).decode(ENC)
res = []
for match in eth_re.finditer(out):
res.append(match.group(1))
return '\n'.join(res)
def get_interface_type(iface):
iface_type = 'wired'
iface_dir = os.path.join('/sys/class/net', iface)
_dir = os.listdir(iface_dir)
with open(os.path.join(iface_dir, 'type')) as fp:
_id = fp.read().strip()
if _id == '1' and ('wireless' in _dir or 'phy80211' in _dir):
iface_type = 'wireless'
return iface_type
class TrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, parent=None):
QtGui.QSystemTrayIcon.__init__(self, parent)
self.iface = None
self.iface_type = None
self.setup()
if self.iface is not None:
self.showMessage('Network',
'Connected with {0}.'.format(self.iface))
else:
self.showMessage('Network', 'Not connected.')
self.timer = QtCore.QTimer(self)
self.timer.timeout.connect(self.setup)
self.timer.start(5000)
def setup(self):
self.iface = get_default_interface()
self.iface_type = get_interface_type(self.iface)
if self.iface_type == 'wired':
self.setIcon(QtGui.QIcon.fromTheme('network-wired'))
self.setToolTip(get_wired_status(self.iface))
else:
self.setIcon(QtGui.QIcon.fromTheme('network-wireless'))
self.setToolTip(get_wireless_status())
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
tray = TrayIcon()
tray.show()
sys.exit(app.exec_())
Whitie
Edit: I think the better way is to get all the information from dbus. I try to implement it soon.
Last edited by whitie (2013-08-20 21:23:10)

Similar Messages

  • I currently have a D-Link DI-604 broadband router with windows computers.  How can I add wifi to the network for use with ipad?  Can I use AirPort Express?

    I currently have a D-Link DI-604 broadband router with windows computers.  How can I add wifi to the network for use with ipad?  Can I use AirPort Express?

    Yes. You can directly connect an 802.11n AirPort Express Base Station (AXn) using an Ethernet cable. The AXn would then just need to be configured as a bridge to allow the D-Link to continue to provide both NAT & DHCP services for all network clients connected to either router.
    In this configuration, the AXn would broadcast a wireless network for your wireless network clients to connect to.

  • HELP needed creating a Network Monitor using JSNMP

    I would really appreciate if anyone could help me. I'm currently TRYING to develop my final year college project- A network monitor using JSNMP. I don't know how to go about pinging a device using this. Can anyone help me pleez?

    Did you try to build and run their examples? Check out the example called SNMPV*TrapSenderTest where * is the SNMP version you want to use.

  • My printers have become all of a sudden very slow over my network when used with my Macbook. What could this indicate ?

    My two printers on my network (HP 8500 All in one Officejet and Lexmark Pro 805)  have become very slow with processing and printing my documents. When printing, they have also made it not possible to do other applications on my Macbook until finished printing. WHat does ths point in the direction of ?

    Empty your print queue of excess print jobs that didn't go through.
    If you are within 1500 feet (500 meters) of someone who might connect wirelessly, make sure any wireless network you have is WPA2 encrypted, and not using 802.11b.  Reboot the printers, and any routers they may be connected to.

  • Prepare my Wireless network for use with Windows 8

    Hello
    My wireless network has the following:
         (2) Wireless ACS 5.2 (upgrading to 5.3 soon)
         (1) Wireless Control System 7.0.172.0
         (10) Wireless Controllers AIR-CT5508-K9 7.0.116.0 (Lic level: base)
    Most of the (150+) AP's are i3502 with some older 1131AG, 1142N, 1242AG
    We are starting to see more devices with Windows 8
    What is best practice for integrating Win 8 devices onto a Wireless network?

    Shaogin
    Thank you for your reply.
    Wireless Control System s/w would need to be upgraded.
    What about the controllers and ACS?

  • Network Monitor and WebServices

    Hi all,
    my project uses a WebService by means of classes generated by the introspection service in Flash Builder 4. The service is located in a external server, and functions correctly when debugging locally my project, but only if Network Monitor is disabled. In case Network Monitor is enabled, I get a fault event with faultString "HTTP request error". If I reload the swf, it appears a message about a bad formed html. The activity is the following call
    http://localhost:37813/path-to-my-service?WSDL?hostport=myExternalServer:8080&https=N&id=x x
    so I assume that Network Monitor uses a kind of proxy to monitor traffic. It seems to me that for a reason I don't know the soap service get confused with this address because it sees a html page instead of a xml document containg the wsdl.
    Interestingly, the same project but using the classes generated by the introspection service in Flex Builder 3 works correctly with the Network Monitor enabled.
    Do you have any ideas about what I am doing wrong?
    Thank you very much!
    -Ignacio

    Hi Ram,
    I am in Flex web application running on Mac Safari 3.2.3 (5525.28.3) using WebKit r44341 on OsX 10.5.7, but the problem also appears with Firefox (Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; es-ES; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7), with the message "SOAP Response cannot be decoded.".
    In both Firefox and Safari the response header from server has "Transfer-Encoding: chunked".
    Thank you,
    -Ignacio

  • How to use long capture filter with Network Monitor 3.4 command line

    I want to exclude all traffic from a list of subnets in my capture. This makes for a rather long and complex filter. Is there any option on the command line to refer to a file describing this filter or can one only use the /capture "my extremely long
    filter" command? So, I would have to make the entire thing into one line?

    I suppose if it's longer than 2048 or 4096, there will be a command line length limitation.  Maybe there's a way to work around it with a environment variable, but I think there will always be a limit.  Perhaps there's an easier way to right your
    filter?  Can you use something like the subnet example in the library to shorten the filter.
    Also, do you think your filter will affect capturing speed.  The more complex the filter, the longer it takes to evaluate each incoming message.  That means we have to buffer, and if the firehose is too much, we don't catch all the water :) 
    If the UI can keep up, then it shouldn't be a problem, but some firehoses are bigger than others.  Plus, there driver filters which can filter faster for NMCap.
    Moving forward, Message Analyzer (http://blogs.technet.com/blogs), is the replacement for Network Monitor, which can do the same most of the same kinds of capabilities, but using powershell.  I think you'd
    have more flexibility with variable lengths there.  Plus you can script fancy things.
    Paul

  • Is it possible to use a Linksys By Cisco Wireless-G Internet Home Monitoring Camera with Labview

    I was wondering if it is possible to use a 'Linksys By Cisco Wireless-G Internet Home Monitoring Camera' with Labview
    http://www.dabs.com/productview.aspx?Quicklinx=53PX&SearchType=1&SearchTerms=network+cameras&PageMod...
    I wan't to be able to get the raw data from the camera and analyse it.
    Message Edited by Jam.hall on 03-25-2009 09:03 AM
    Solved!
    Go to Solution.

    Hi Jam.Hall
    I am somewhat hesitant to say you will be able to use this camera with LabVIEW.  It all depends on what functionality you are wanting to utilise on the camera, and how much video you want to analyze.
     - If you want to use the wireless functionality, I am concered that the on board web server will compress and embed the video stream.  I do not beleive this is something we can access in LabVIEW.
     - If you wish to use the ethernet connection, if it is Gigabit Ethernet, then you should be able to use our IMAQ for GigE driver to bring in the feed, but looking at the specs for the camera, I'm not sure that this is an option.
     - My other suggestion might be to utilise the record video stream function that the camera has.  Depending on the format of the video file, you may be able to read in the recorded file and analyse it in LabVIEW.
    If you could explain the purpose of your application, and what you would like to achieve with the system, there may be more suitable products that you can use.
    Kind regards,
    Sheela Sujeeun
    Applications Engineer
    National Instruments UK

  • HP Storage Management Pack Conflicts with Network Monitoring SNMP

    The HP Storage management pack that I installed requires starting the Windows SNMP services, which creates a conflict with SNMP used for SCOM network monitoring.  I am spinning up a second SCOM mangement server so I can split these functions. What would
    you recommend to split these functions across the two management servers?  Uninstall the HP Storage Management Pack, and install on the new server?  Or move the network monitoring to the second server?
    Thank you for your help!

    Does the HP Storage pack support resource pools? What I've found with these 3rd party packs that implement connector services is they do not provide true HA via SCOM resource pools - they are standalone systems with a connector service. This is true for
    the NetApp (DataONTAP) pack, and it's a huge disappointment.
    Vendors do this because they have an API, and they think the only way to implement discovery and monitoring in SCOM is to create a service that accesses the API - and then the service is basically a collector in this case, and typically has a handful of
    rules (sometimes just one rule) that scrape events on the management server and they are misinterpreted to be alerts coming from some instance.
    I turn green when I run into this type of problem, because all this can be accomplished with native modules or managed code that are designed to work very well with SCOM.
    I know this doesn't answer your question - it's more a way for me to express my distain for these type of packs.
    Jonathan Almquist | SCOMskills, LLC (http://scomskills.com)

  • Are You Using Spiceworks Network Monitor?

    Are any of you guys using the Spiceworks Network Monitor? I've had it running for about a week now and it's been quite eye-opening. Being a small dept, we do a lot of "set and forget" setups, so it's nice to have something that monitors all of these little installs and servers that we otherwise don't pay much attention to.  
    This topic first appeared in the Spiceworks Community

    Standard Def CRT production monitors with a blue only button on them are still available at a reasonalbe price. But if you're talking HD, LCD's have taken over the landscape pretty much (except for some CRT's from Sony that cost a TON of money)... You'll need a capture card or an Io HD to see it all externally, unless you're only talking HDV... that you could use a less expensive solution for...
    DV can be monitored externally for the least amout of investment if you have a DV camera, you can send it FW DV, then send the analog outputs from a DV camera to a CRT.
    LCD monitors though are close enough for a lot of applications... those with a blue only switch work pretty well actually. Panasonic's 17 and 26" LCD's are quite nice monitors I think.
    Matrox's MXO should allow you to use a 23" Cinema Display as a monitor, but I've heard of problems with it and Color... so might just wait if that's the solution that works for you. They work really well now with the other apps...
    Jerry

  • I just purchased a 28" 4K monitor to use with Premiere Pro CS6 in WIndows 8.1 and the fonts are super tiny.

    No matter what settings I choose, the fonts on the display are impossibly tiny.  The menu fonts at top are readable, but everything else feels like I am taking an eye exam. 
    Is this fixable, or do I need to return the 4K monitor and fuhgedaboutit? 
    Since I am doing some shooting in 4K, I thought this monitor would make sense. 
    If in fact it can't work with PP CS6 on WIn 8.1, what is the best recommended monitor to use with PP CS6?

    Hi Hbrandado,
    hbrandado wrote:
    No matter what settings I choose, the fonts on the display are impossibly tiny.  The menu fonts at top are readable, but everything else feels like I am taking an eye exam. 
    Is this fixable, or do I need to return the 4K monitor and fuhgedaboutit? 
    Since I am doing some shooting in 4K, I thought this monitor would make sense.
    I understand your issue and I don't have a solution for you. Sorry. In Premiere Pro CC 2014, you can increase the size of the fonts in the Project panel, but not in CS6.
    hbrandado wrote:
    If in fact it can't work with PP CS6 on WIn 8.1, what is the best recommended monitor to use with PP CS6?
    You may want to ask this in ourHardware Forum.
    Lots of gear heads that can help you there.
    Thanks,
    Kevin

  • Using a network-stored catalog with Mac OSX

    Greetings all.
    I am using Photoshop Elements 11 on Mac OSX Mountain Lion and want to store my catalog on a local network drive (FreeNAS).  I have encountered many problems while attempting to do this.  Then I noticed in the Elements Organizer help, under the section "Repair a catalog", the following: "Note:  (Mac OS) You cannot access catalogs present on a network drive."
    Is this true. or has someone found a workaround to the problem?
    Thanks!
    --John

    Thanks, for that ( I assume we have to carry on in English due to forum policy even though we are both of German tongue I assume)
    You mean the access problems are part of the "no network drive" thing? I suspected that. Took me a whole day in front of my computer to realign the mess.  So should one better not use the network drives at all? Quite a pity in times where everybody seems to use network storage.
    No, I did not use organizer to use the photos. So there is no way to reconnect them? Should I delete the catalogue and start with the photos from scratch?
    Regards
    Andibuch
    Am 02.01.2013 um 23:35 schrieb Barbara B.:
    Re: Using a network-stored catalog with Mac OSX
    created by Barbara B. in Photoshop Elements - View the full discussion
    Well, yes, these are part of the "no network drive" thing.
    As for moving the photos, did you use organizer to move them? You will always have trouble if you move photos outside of organizer, even on the same drive--you have to let it manage your photos or it doesn't have a clue as to what happened.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4963270#4963270
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4963270#4963270
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4963270#4963270. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Elements by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • To use a router to set up a local wifi network. Would this system be suitable to use with an Apple TV or is internet access require

    I'm considering using Apple TV to connect to a projector in a church hall which does not have any internet access. I intend to use a router to set up a local wifi network. Would this system be suitable to use with an Apple TV or is internet access require

    Welcome to the Apple Community.
    Yes, that will be fine providing you don't want to play any protected content.

  • I'm trying to set up a dual monitor for my new iMac. I'm using a second display I used with my old G5. My iMac recognizes the second monitor but the monitor won't turn on. Power button doesn't do anything on the monitor itself.

    I'm trying to set up a dual monitor for my new iMac. I'm using a second display I used with my old G5. My iMac recognizes the second monitor but the monitor won't turn on. Power button doesn't do anything on the monitor itself.

    If it won't turn on then the monitor is dead (power supply?, video circuits?).  Not worth repairing.
    If you have a new iMac then it has thunderbolt.  So exactly what is that monitor you are trying to connect?  For TB you can connect a mini-displayport monitor.   Probably (not 100% sure with TB) can use dvi or vga too if you have the appropriate adapter.

  • Many of the times my Iphone 5s shows "No Service" in the specific network area, but if the same sim card is used with other mobiles in the same network area, it shows good network.. i did restore but still not working.. please help me..

    My Iphone 5s shows "No Service" in the specific network area, but if the same sim card is used with other mobiles in the same network area, it shows good network.. i did restore,change sim card, reset all the settings but still not working... please help me..

    Please do not double post a subject. Iphone 5S  I answered your other thread.

Maybe you are looking for

  • Migo: field not ready for input

    hello  , i am stuck with an issue , which is ---   I have to add two fields in migo tablecontrol with dyndr- 200, for overdelivery tolerance and under delivery tolerance. I am able to add them with my custom fields (ZZUEBTO,ZZUNTTO). and now fields a

  • Business Partner Transfer using ALE/IDOCS

    Dear Gurus, I am using S.R.M. 5.0 system. I am encountering scenario of transferring the business partners from S.R.M sytem to C project which is again add-on module provided by SAP. I have created Distribution Model and have assigned the message typ

  • Strange Error =   HELP !!!!!!!!!!!!!!!!!!!!!

    Hi everybody,           Trying to start BEA Server, I got a strange error : java.net.UnknownHostException : sproerp07: sproerp07 where sproerp07 is my hostname.           I work on AIX 5.1 with WL 8.1. Can you help me.           I suppose this is a j

  • How to authorize a new PC in itunes?

    how to authorize a new PC in itunes?

  • Can't send texts to ONE person

    I was texting my friend perfectly fine all day through iMessage and then suddenly I couldn't send them anything. iMessage wasn't working and it wouldn't send as a text either. But it's just to them, I can text or use iMessage with any other contact i