Note: A new version of RPi-Monitor is available.
For all details about RPi-Monitor refer to RPi-Monitor Documentation.
For internet connection, it could be interesting to add a WiFi connection to the Raspberry Pi.
Raspberry Pi with WiFi 802.11n dongle |
This article is explaining how to configure WiFi n a Raspberry Pi and how to monitor this new network interface with RPi-Monitor.
Installing the WiFi network
I did purchase a dongle Ralink on the Internet for few euros.Once plugged, the dongle automatically appears in usb list:
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
pi@raspberrypi ~ $ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether b8:27:eb:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT qlen 1000
link/ether 7c:dd:90:xx:xx:xx brd ff:ff:ff:ff:ff:ff
To see the network present and validate the WiFi connection, lets use the command iwlist
pi@raspberrypi ~ $ sudo iwlist wlan0 scan
You should see a lot of information about all the WiFi network present in your environment.
The network can be configured manually with the command iwconfig but it is more interesting modify the network configuration file to have the WiFi connection configured automatically at startup.
Here are the line to add to the configuration file /etc/network/interfaces:
auto wlan0
iface wlan0 inet static
wpa-ssid XxXxXxXxX
wpa-psk xXxXxXxXx
wireless-power off
address 192.168.0.123
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.254
You can see the static network configuration address, network, netmask and gateway.
The parameters wpa-ssid, wpa-psk and wireless-power are specific to the WiFi configuration:
- wpa-ssid : The name of your network
- wpa-psk : The password of the network
- wireless-power off : To turn off the power management which, for a server, could cause some network latency and connection loss.
pi@raspberrypi ~ $ sudo ifup wlan0
And check the configuration:
pi@raspberrypi ~ $ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether b8:27:eb:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 10.42.0.123/24 brd 10.42.0.255 scope global eth0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 7c:dd:90:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 192.168.0.123/24 brd 192.168.0.255 scope global wlan0
Configuring RPi-Monitor to manage this new network interface
Adding the new information and graph is done by the following configuration:
Warning: Be sure to use Linux filefeed format with line ending with LF (and not CR/LF like in Windows).
Warning: Be sure to use Linux filefeed format with line ending with LF (and not CR/LF like in Windows).
######################################################################## # Graph WLAN ######################################################################## dynamic.17.name=wifi_received dynamic.17.source=/sys/class/net/wlan0/statistics/rx_bytes dynamic.17.regexp=(.*) dynamic.17.postprocess=$1*-1 dynamic.17.rrd=DERIVE dynamic.18.name=wifi_send dynamic.18.source=/sys/class/net/wlan0/statistics/tx_bytes dynamic.18.regexp=(.*) dynamic.18.postprocess= dynamic.18.rrd=DERIVE web.status.1.content.9.name=WiFi web.status.1.content.9.icon=wifi.png web.status.1.content.9.line.1="WiFi Sent: <b>"+KMG(data.wifi_send)+"<i class='icon-arrow-up'></i></b> Received: <b>"+KMG(Math.abs(data.wifi_received)) + "<i class='icon-arrow-down'></i></b>" web.statistics.1.content.9.name=WiFi web.statistics.1.content.9.graph.1=wifi_send web.statistics.1.content.9.graph.2=wifi_received web.statistics.1.content.9.ds_graph_options.net_send.label=Upload bandwidth (bits) web.statistics.1.content.9.ds_graph_options.net_send.lines={ fill: true } web.statistics.1.content.9.ds_graph_options.net_send.color="#FF7777" web.statistics.1.content.9.ds_graph_options.net_received.label=Download bandwidth (bits) web.statistics.1.content.9.ds_graph_options.net_received.lines={ fill: true } web.statistics.1.content.9.ds_graph_options.net_received.color="#77FF77"
This configuration is basically a copy of eth0 configuration. the value in blue have been updated:
Thank Xavier...
ReplyDeleteGood ide for adding printer status with "lpstat -p".
ReplyDeleteto what file the configuration should be added ?
ReplyDeleteYou should refer to "Rpi-Monitor Articles" accessible in the top menu.
DeleteYou will find the answer to your question and even much more...