Difference between revisions of "XFCE simple Network Monitor applet"

From ArchWiki
Jump to: navigation, search
m
m (Installation: I bet this was a mistake, the link has been put in the warning above)
Line 82: Line 82:
 
     bool networkAvailable = false;
 
     bool networkAvailable = false;
  
     // search for the proper network interfacehttp://schlunix.org/archlinux/extra/os/i686/xfce4-genmon-plugin-3.2-2-i686.pkg.tar.xz
+
     // search for the proper network interface
 
     strcpy(cad, argv[1]);
 
     strcpy(cad, argv[1]);
 
     strcat(cad, ":");
 
     strcat(cad, ":");
Line 273: Line 273:
 
}</nowiki>
 
}</nowiki>
 
}}
 
}}
 
  
 
== Configuration ==
 
== Configuration ==

Revision as of 11:22, 27 July 2011

Introduction

This little "applet" will add a plain text network monitor for XFCE, without requiring gnome applets support. Unlike the native Xfce netload plugin, this one uses precise plain text figures instead of graphical bars, and also (optionally) reports the CPU usage in percentaje (all system cores). In addition, when placing the mouse over it, it displays a tooltip with extended information. This picture shows how it looks like. The speed units are automatically selected between kbps and Mbps, formatted in a way that allows to ignore the unit type, difficult to track when the speed changes too quickly (when changing from 999 kbps to 1 Mbps or vice-versa, one becomes immediately aware without needing to look at the kbps/Mbps text).

Prerequisites

It runs within the [xfce4-genmon-plugin]. This implies that it is re-run continuously (typically each second) but this does not causes a performance penalty since it is not an script calling several programs, but a single native C++ application, and the binary will be cached by the system. Since it is executed periodically, it needs to save the state information. By default does it in /dev/shm (shared memory) to avoid continuous writes on disk. Make sure that your /etc/fstab file has the following line:

shm   /dev/shm   tmpfs   nodev,nosuid   0   0
Warning: xfce4 genmon 3.3.0 applet is broken and unfixed for nearly half of a year. Until it becomes fixed, a potential temporary solution besides the proposed patch in the bug tasklist, it could be simply to use the previous version. You can download the 3.2-2 version for x86_64 or i686.

Installation

You need to compile the C++ application: save the following file and run the command g++ -O3 -lrt netmon.cpp -o netmon to generate the netmon binary, and place it in a location of your choice (for example, /usr/local/bin).

Template:File

Configuration

Insert in your panel a Generic Monitor applet. In the Command field place a invocation of the tool, selecting the network interface (eth0, ppp0, wlan0, ...) and optionally add the CPU parameter to select reporting the CPU usage (the applet will print a third line). For example:

/usr/local/bin/netmon wlan0 CPU

In the Period(s) field select the refresh rate (1 second recommended). Uncheck the Label field. An excellent text font is Terminus ([terminus-font] package required) but any monospace, fixed or courier font will be ok.

This picture resumes the settings. In case of several network interfaces, you can add as many instances as you want.