Difference between revisions of "XFCE simple Network Monitor applet"
m (Bot: Removing from Category:HOWTOs (English))
(doesn't belong in eye candy)
|Line 1:||Line 1:|
== Introduction ==
== Introduction ==
Revision as of 23:35, 8 July 2011
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).
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
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).
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.