Oct 26, 2013
Technology###Hardware Preparation
Insert the usb wireless card and view the dmesg information:
$ dmesg | tail
[911884.740000] usb 1-1.3: USB disconnect, device number 4
[911897.530000] usb 1-1.4: new high speed USB device number 5 using oxnas-ehci
[911897.640000] usb 1-1.4: New USB device found, idVendor=0bda, idProduct=8179
[911897.640000] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[911897.650000] usb 1-1.4: Product: 802.11n NIC
[911897.650000] usb 1-1.4: Manufacturer: Realtek
[911897.660000] usb 1-1.4: SerialNumber: 00E04C0001
The model is Mercury FW150US, See details of the lsusb
$ lsusb -v -d 0bda:8179
Bus 001 Device 005: ID 0bda:8179 Realtek Semiconductor Corp.
......
But the output didn’t show its information, we google it, knows:
只是一个8176和8179之分,后来才知道原来这款瑞昱的芯片有两个版本,8176对应的是rtl8192cu,8179对应的是rtl8188eu。
8179 is the rtl8188eu, so we need to find rtl8188eu device driver.
###Driver Preparation
Prepare the cross-compiler, download “gcc-linaro-arm-linux-gnueabi-2012.02-20120222_linux.tar.bz2”, uncompress it and add it into your system path.
Prepare the Linux source code, named “linux-3.1.10.pogoplug.tar.bz2”, uncompress it.
How do we get the cross-compiler version?
$ cat /proc/version
Linux version 3.1.10 (lintel@lintel-ThinkPad-T430) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #10 SMP PREEMPT Fri Jun 7 19:14:08 CST 2013
From the result, we know the cross-compiler is 4.6.3 version.
Download the corresponding cross-compiler and add it to the sytem path. Then we download the PogoPlug Linux Source, uncompress it and also get the rtl8188eu from https://github.com/Red54/linux-shumeipai2/tree/sunxi-3.0/drivers/net/wireless/rtl8188eu, copy the rtl8188eu’s driver under driver/net/wireless, then modify the Kconfig file:
\+source "drivers/net/wireless/rtl8192cu/Kconfig"
source "drivers/net/wireless/rtl8188eu/Kconfig"
and also the Makefile:
obj-$(CONFIG_RTL8192CU) += rtl8192cu/
\+obj-$(CONFIG_RTL8188EU) += rtl8188eu/
obj-$(CONFIG_IPW2100) += ipw2x00/
obj-$(CONFIG_IPW2200) += ipw2x00/
Then, we get the running kernel’s configuration file via:
cat /proc/config.gz | gunzip >running.config
upload the configuration file to the directory of the kernel source, then
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
in menuconfig, load the running.config, then navigate to driver->net->wireless, choose rtl8188eu's driver, compile it to kernel
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
$ sudo yaourt mkimage
Install mkimage, then go to arch/arm/boot
$ mkimage -n 'linux-3.1.10' -A arm -O linux -T kernel -C none -a 0x60008000 -e 0x60008000 -d zImage uImage
upload the generated uImage to pogoplug, then we have to update the kernel image into our own image
# Install mtd-utils first
$ apt-get install mtd-utils
# Erase the mtd partition which contains existing kernel
$ /usr/sbin/flash_erase /dev/mtd1 0xB00000 22
# Write newly generated uImage into the mtd partition
$ /usr/sbin/nandwrite -p -s 0xB00000 /dev/mtd1 /root/uImage
Reboot the pogoplug.
###Wireless Configuration
On pogoplug, install following software:
$ apt-get install iw wireless-tools
Use wpa_supplicant to generate the configuraiton file and generate the password
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
wpa_passphrase NETGEAR79 xxxxxx > /etc/wpa_supplicant/NETGEAR79.conf
With the generated file we can directly connect to the exisint wireless network.
Then we have to update the network configration file,
$ vim /etc/network/interfaces
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/NETGEAR79.conf
After everything is done, we can remove the wired connection, and change the wired-bind ip address to wireless binded ip address, everything will be the same as before. But the bootup may be 1 or 2 seconds than the wired connection.
Oct 25, 2013
Technology###Install Xapian-core
Xapian-core is the Xapian library itself. We have to install it from source-code
$ wget http://oligarchy.co.uk/xapian/1.2.15/xapian-core-1.2.15.tar.gz
$ tar xzvf xapian-core-1.2.15.tar.gz && cd xapian-core-1.2.15/
$ ./configure --prefix=/usr/local && make && make install
###Install Omega
Omega utilities is an application built on Xapianm, consisting of indexers and a CGI search frontend.
$ wget http://oligarchy.co.uk/xapian/1.3.1/xapian-omega-1.3.1.tar.gz
$ tar xzvf xapian-omega-1.3.1.tar.gz && cd xapian-omega-1.3.1/
$ ./configure --prefix=/usr/local && make && make install
###Configure the CGI for apache
Change the “ScriptAlias /cgi-bin/ “/usr/lib/cgi-bin/"", so the httpd knows cgi binaries is put in the /usr/lib/cgi-bin directory. Then we have to copy the omega library to the /usr/lib/cgi-bin/:
$ cd xapian-omega-1.3.1/
$ cp omega /usr/lib/cgi-bin/omega.cgi
$ cp omega.conf /usr/lib/cgi-bin/
$ chmod 755 /usr/lib/cgi-bin/omega.cgi
The Configuration file /usr/lib/cgi-bin/omega.conf should looks like this:
database_dir /var/lib/omega/data
template_dir /var/lib/omega/templates
log_dir /var/log/omega
cdb_dir /var/lib/omega/cdb
Copy the templates to the new directory:
$ cd xapian-omega-1.3.1/
$ cp -ar /templates/* /var/lib/omega/templates/
$ mkdir -p /var/lib/omega/data/default
$ chmod -R 644 /var/lib/omega/data/default
Generate the database file:
$ sudo /usr/local/bin/omindex --db /var/lib/omega/data/default --url / /home/Trusty/code/octo/debian_octopress/public/
###Result
Restart the httpd daemon:
$ systemctl restart httpd
Browser http://localhost/cgi-bin/omega.cgi you will see the following picture:
Oct 25, 2013
Technology###Install packages
Install the following packages
$ sudo pacman -S wicd
$ sudo pacman -S wicd-gtk
$ sudo pacman -S notification-daemon
$ sudo pacman -S python2-notify
###Configure
Add your account to users group
# gpasswd -a USERNAME users
Start Wicd as System Service:
$ systemctl start wicd.service
Automatically start service at boot-up:
$ systemctl enable wicd.service
Add the wicd-client as tray in the rc.lua file
$ wicd-client --tray
Oct 24, 2013
Technology###OpenWRT Configuration
Install mini_snmpd:
$ opkg update
$ opkg install mini-snmpd
Configure mini_snmpd: mainly changes: option enabled 1, then change the option contact and location. But infact we can only fetch list interfaces in cacti:
root@OpenWrt:~# cat /etc/config/mini_snmpd
config mini_snmpd
option enabled 1
option ipv6 0
option community 'public'
option contact 'gwoguowug@gmail.com'
option location 'Asia/China/Nanjing'
# enable basic disk usage statistics on specified mountpoint
list disks '/jffs'
list disks '/tmp'
# enable basic network statistics on specified interface
# 4 interfaces maximum, as named in /etc/config/network
list interfaces 'loopback'
list interfaces 'lan'
list interfaces 'wan'
Restart the mini_snmpd:
$ /etc/init.d/mini_snmpd restart
###Cacti Configuration
Add a new device named OpenWRT, the configuration may like following:
Change the Host Template to Generic SNMP-enabled Host
Downed Device Detection - Ping
Ping Method - ICMP Ping
Then you can add your own data sources, graph templates, new graph, new graph Trees, then display them. the picture may looks like as following:
Oct 23, 2013
Technology###Prepare the script
We get the current system load from /proc/loadavg:
[Trusty@XXXyyy ~]$ cat /bin/online.sh
#!/bin/sh
echo .1.3.6.1.4.1.102.8
cat /proc/loadavg | awk {'print $1'}
Then we have to add this script to our /etc/snmp/snmpd.conf:
extend .1.3.6.1.4.1.2021.53 online_monitor /bin/sh /bin/online.sh
Restart the service:
systemctl restart snmpd
Use snmpwalk to view the newly added item:
snmpwalk -v 2c -c public 10.0.0.221 .1.3.6.1.4.1.2021.53
###Fetch the data
See the following data is what we want:
root@ubuntu:/etc# snmpwalk -v 2c -c public 10.0.0.221 .1.3.6.1.4.1.2021.53.4.1.2.14.111.110.108.105.110.101.95.109.111.110.105.116.111.114.2
iso.3.6.1.4.1.2021.53.4.1.2.14.111.110.108.105.110.101.95.109.111.110.105.116.111.114.2 = STRING: "0.77"
###Draw images in cacti
First, add a data templates:
Console->Data Templates->Add,
Data Template Name: MonitorArchCustomized
Data Source Name: |host_description|-MonitorArchCustomized
Data Input Method: Get SNMP Data
Associated RRA’s: Hourly(1 Minutes Average)
Internal Data Source Name: MonitorArchCustom
Then click “Create”
some additional field will be displayed, in the newly field “Custom Data [data input: Get SNMP Data]” insert the OID field with “.1.3.6.1.4.1.2021.53.4.1.2.14.111.110.108.105.110.101.95.109.111.110.105.116.111.114.1”(which you got from the snmpwalk output result)
Second, add a graph templates:
Templat Name: MonitorArchCustomized
Graph template Title: |host_description|-MonitorArchCustomized
Create and then insert the Graph Template Items, add like following:
Graph Item Data Source Graph Item Type CF Type Item Color
Item # 1 (MonitorArchCustom): AREA AVERAGE FF00FF Move Down Move Up Delete
Item # 2 (MonitorArchCustom): GPRINT LAST F5F800 Move Down Move Up Delete
Item # 3 (MonitorArchCustom): Average GPRINT AVERAGE 8D85F3 Move Down Move Up Delete
Item # 4 (MonitorArchCustom): MAX GPRINT MAX 005D57 Move Down Move Up Delete
Also notice the Data Source should be MonitorArchCustom.
Third, add a new graph under Host of ArchLinux.
Select the Graph template and then click Create.
After some minutes, you will see the newly captured data and the images under graphs-> Arch-> Host:ArchLinux. Maybe Your graphs trees are not the same as mine, you got found your own location.