Thursday, October 16, 2008

Activate Map Feature on OpenNMS

After Installing OpenNMS standard, when we see on the web browser, we can't see Map feature on their tab feature. This is normal, because basically OpenNMS doesn't over Map feature, but offer a Map with a different concept. Map that viewed by OpenNMS depends on some category and range of IP Address. In this post I would like to share how to activate the Map feature on OpenNMS:

1. Stop Operation of OpenNMS and Tomcat:
# /etc/init.d/opennms stop
# /etc/init.d/tomcat5.5 stop

2. And then, type this command on terminal:
# cp /etc/opennms/map.disable /etc/opennms/map.enable

3. And then, activate again OpenNMS and Tomcat:
# /etc/init.d/opennms start
# /etc/init.d/tomcat5.5 start

And then, see the result on your web browser, Map feature will be appear on the taskbar of OpenNMS. The other way to see the map:
http://:8980/opennms/Index.map
But, this method can't view the map feature on the OpenNMS taskbar.
Here is the figure:

Java Conviguration for Email Notification on OpenNMS

In OpenNMS, there are several ways for notification. This notification can be configured for such events, for example when one interface is down. In this time I would like to share configuration for email.

Configuration for email is like this:
1. After doing instalation for OpenNMS, here is the file of /etc/opennms/javamail-configuration.properties

################################################################################
# This file is the configuration for the the JavaMailer class. It is used to
# specify the details of the JavaMailer system properties
################################################################################
#
# Properties are defined but commented out indicating the default values.
#

#
# This property defines system sender account.
#
# The default setting is root@[127.0.0.1]
#org.opennms.core.utils.fromAddress=root@[127.0.0.1]

#
# These properties define the SMTP Host.
#
#org.opennms.core.utils.mailHost=127.0.0.1
#org.opennms.core.utils.mailer=smtpsend
#org.opennms.core.utils.transport=smtp
#org.opennms.core.utils.debug=true
#org.opennms.core.utils.smtpport=25
#org.opennms.core.utils.smtpssl.enable=false
#org.opennms.core.utils.quitwait=true
#
# This property controls the use of the JMTA, the default is true
#org.opennms.core.utils.useJMTA=true
#
# These properties define the Mail authentication.
#
#org.opennms.core.utils.authenticate=false
#org.opennms.core.utils.authenticateUser=”opennms”
#org.opennms.core.utils.authenticatePassword=”opennms”
#org.opennms.core.utils.starttls.enable=false

#
# These properties configure message content
#
#org.opennms.core.utils.messageContentType=text/plain
#org.opennms.core.utils.charset=us-ascii

2. In this time, I configure this notification using google mail (gmail). Change the file in the /etc/opennms/javamail-configuration.properties using this file (there are several lines are changed):

################################################################################
# This file is the configuration for the the JavaMailer class. It is used to
# specify the details of the JavaMailer system properties
################################################################################
#
# Properties are defined but commented out indicating the default values.
#

#
# This property defines system sender account.
#
# The default setting is root@[127.0.0.1]
org.opennms.core.utils.fromAddress=root@[127.0.0.1]

#
# These properties define the SMTP Host.
#
org.opennms.core.utils.mailHost=smtp.gmail.com
org.opennms.core.utils.mailer=smtpsend
org.opennms.core.utils.transport=smtp
org.opennms.core.utils.debug=true
#org.opennms.core.utils.smtpport=25
#org.opennms.core.utils.smtpssl.enable=false
#org.opennms.core.utils.quitwait=true
#
# This property controls the use of the JMTA, the default is true
org.opennms.core.utils.useJMTA=true
#
# These properties define the Mail authentication.
#
#org.opennms.core.utils.authenticate=false
#org.opennms.core.utils.authenticateUser=”opennms”
#org.opennms.core.utils.authenticatePassword=”opennms”
#org.opennms.core.utils.starttls.enable=false

#
# These properties configure message content
#
#org.opennms.core.utils.messageContentType=text/plain
#org.opennms.core.utils.charset=us-ascii


3. Restart OpenNMS, and then we can check the notification on our email when some events are happen.

Tuesday, October 7, 2008

Install Ubuntu Server 7.10 Gutsy Gibbon on Compact Flash for Soekris net4801

Before we decide to install Ubuntu Server 7.10 on Compact Flash, we have tried installed Pyramyd Linux. But, it is very difficult to install another application on Pyramid Linux. In this project we need another application to support the project, for example apache2, MySQL, Postfix, Squirrelmail, PhpMyAdmin, Webmin, OLSRd, PhP, so we choose to install Ubuntu on our Compact Flash.

The first step is preparing tools that we need, here is:

1. Host computer using Linux. We use Notebook with Ubuntu 7.10 Desktop
2. Compact Flash (CF). We use CF 1 GByte.
3. Card Reader. We use Card Reader Apacer AP450
4. ISO from Ubuntu 7.10 Server. You can download from www.ubuntu.com

First, plug card reader which CF has plugged there.
Make a partition on the CF. Make a bootable partition.

sudo cfdisk /dev/sdc

Make a ext3 paritition on CF:

sudo mke2fs -j /dev/sdc1


Remember the UUID from your CF (/dev/sdc1) that will need later.

blkid

Mount CF on /mnt/target:

sudo mkdir /mnt/target
sudo mount /dev/sdc1 /mnt/target

Mount file ISO Ubuntu Server on /mnt/iso:

sudo mkdir /mnt/iso
sudo mount -t iso9660 -o ro,loop=/dev/loop0 /path/ke/filenya/ubuntu-7.10-server-i386.iso /mnt/iso


Do deboostrap on CF. If you don't have deboostrap application, install it first:

sudo apt-get install debootstrap
sudo debootstrap --arch i386 feisty /mnt/target file:/mnt/iso


Installation for Ubuntu to CF finish. But, because Ubuntu usual install on computer desktop that has monitor and keyboard, on the other hand, Soekris doesn't have port video and keyboard, so we must do some modification in order to Ubuntu can run on Soekris.

Chroot to the target. Chroot is a command to run shell on root directory that different from usual root:

sudo chroot /mnt/target /bin/bash

Now we work with /mnt/target as our root.
Make file /etc/fstab:

vi /etc/fstab


Fill the file with this:

# file system mount point type options dump pass
UUID=xxxxxx-xxxx-...-xxxxxx / ext3 defaults 0 0
tmpfs /tmp tmpfs size=128m,mode=1777 0 0
proc /proc proc defaults 0 0
sys /sys sysfs defaults 0 0


Fill the UUID with the previous UUID that you have remember.

Mount all the file system:

mount /proc
mount /sys

Verify the result of mount. If the command result a blank directory, the file system doesn't mount yet:

ls /proc

Configure the keyboard (This not important, because Soekris doesn't have a keyboard):

dpkg-reconfigure console-setup

Setup the network:

vi /etc/network/interfaces

Fill this file using your configuration of your networkm here is the example:

auto lo
iface lo inet loopback
iface eth0 inet static
address 167.205.64.106
netmask 255.255.255.192
gateway 167.205.64.65
auto eth0


Set hostname. We wil give the name "ubuntu-soekris"

echo ubuntu-soekris > /etc/hostname

Make a nonroot user for login. Set password too. In this example we use "aswantara":

adduser aswantara
echo 'aswantara ALL=(ALL) ALL' >> /etc/sudoers
chmod 0440 /etc/sudoers

Setup /etc/apt/sources.list

vi /etc/apt/sources.list

Fill this file using your Ubuntu repository. Here is the example for our repository:

deb http://kambing.ui.edu/ubuntu gutsy-backports multiverse main restricted universe
deb http://kambing.ui.edu/ubuntu gutsy-proposed multiverse main restricted universe
deb http://kambing.ui.edu/ubuntu gutsy-security multiverse main restricted universe
deb http://kambing.ui.edu/ubuntu gutsy-updates multiverse main restricted universe
deb http://kambing.ui.edu/ubuntu gutsy multiverse main restricted universe

Setup /etc/hosts

vi /etc/hosts


Fill the file /etc/hosts with this:

127.0.0.1 localhost
127.0.1.1 ubuntu-soekris
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Setup /etc/resolv.conf

vi /etc/resolv.conf


Fill according to your DNS on your network, here is the example:

search ee.itb.ac.id
nameserver 167.205.23.1
nameserver 167.205.22.123
nameserver 167.205.64.158

Make file /etc/event.d/ttyS0

vi /etc/event.d/ttyS0

Fill this file with this:

start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on runlevel 0
stop on runlevel 1
stop on runlevel 6
respawn
exec /sbin/getty -L ttyS0 9600 vt102


Edit file /etc/initramfs-tools/modules

vi /etc/initramfs-tools/modules

Add this line to file /etc/initramfs-tools/modules

ext3
ide_generic

Update your initramfs:

update-initramfs -u


Install kernel and configure the grub. Deboostrap doesn't install bootloader on CF, so we have to install manually:

apt-get update
apt-get install linux-image-generic grub memtest86+


Configure grub:

mkdir -p /boot/grub
cp /usr/lib/grub/i386-pc/* /boot/grub
vi /boot/grub/menu.lst

Fill file /boot/grub/menu.lst with this script:

default 0
timeout 5


serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console

title Ubuntu, kernel 2.6.22-14-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/hda1 ro console=tty0 console=ttyS0,9600n8
initrd /boot/initrd.img-2.6.22-14-generic
quiet
savedefault

title Ubuntu, memtest86+
root (hd0,0)
kernel /boot/memtest86+.bin console=tty0 console=ttyS0,9600n8
quiet


Exit from chroot

exit

To install the grub, do this command outsode of chroot():

sudo grub-install --no-floppy --root-directory=/mnt/target /dev/sdc1

Finnally, finish. Now you can check your CF this by plug it on Soekris. Make sure your Soekris bitrate is 9600. Enter username "aswantara" and password.

Install Protocol Routing AODV on Ubuntu 7.10 Gutsy Gibbon

AODV (Adhoc On Demand V) is one of the reactive (on-demand) routing protocol that developed by Uppsala University dan University of Basel.

The method to install it are:

1. First, we must have installed build-essential correctly. If not, use this command:
apt-get install build-essential

2. After that, download the file from here. When I write this tutorial, the newest version is 0.9.5. I suggest you to download the newest version.

3. And then extract the file.

4. Enter to the file using:
cd aodv-uu-0.9.5

5. Install it using command:
make && make install

6. After that, load the kaodv modul on Ubuntu, using:
modprobe kaodv

7. After all the step finish, activate aodv using command:
aodvd -l -d -D -r 3

Command -l mean write aoutput of this command in the /var/log/aodvd.log
Command -D mean non-activate waiting time (15 second) as a reboot delay when the protocol fail to run
Command -d mean run the protocol in background
Command -r 3 mean save the routing table in the /var/log/aodvd.log every 3 second

And finally, aodv has ran. And then we must determine the IP address statically.

Automatic Startup Wireless Network Configuration on Ubuntu 8.04

In this time we would like to build Wireless Network Configuration that will be start automatically when start up. Wireless card that used here is Atheros Chipset. The configuration is like this:

IP Static
IP: 192.168.100.1
netmask: 255.255.255.0
wireless mode: adhoc
wireless essid: telecom_mesh
wireless channel: 2

To get this configuration, we must do some configuration.
1. In the /etc/network/interfaces, fill with this:
auto ath0
iface ath0 inet static
address 192.168.100.1
netmask 255.255.255.0
post-down wlanconfig ath0 destroy
pre-up sleep 3
pre-up wlanconfig ath0 create wlandev wifi0 wlanmode adhoc
pre-up sleep 3
pre-up iwconfig ath0 essid "telecom_mesh" channel 2
pre-up ifconfig ath0 up


But, if only using this configuration, it takes no effect. So, we must do another way again. The problem is Ubuntu can't execute command "pre-up wlanconfig ath0 create wlandev wifi0 wlanmode adhoc". The solution for this is:
We must make some script to change wireless mode become adhoc when first booting of Ubuntu without using file /etc/network/interface.

Make files in /etc/init.d, for example named netwmn. You can use another file name, no problem. The content of the file like this:
#! /bin/sh

/sbin/wlanconfig ath0 destroy
/bin/sleep 3
/sbin/wlanconfig ath0 create wlandev wifi0 wlanmode adhoc
/bin/sleep 3
/sbin/iwconfig ath0 essid telecom_mesh channel 2


exit 0

After that, making this file execute when Ubuntu start-up, using command:
chmod +x /etc/init.d/netwmn

This file also must can be execute when start up on SystemV Ubuntu, using command:
cd /etc/init.d/
update-rc.d netwmn

After that, change /etc/network/interfaces using:
auto ath0
iface ath0 inet static
address 192.168.100.1
netmask 255.255.255.0
broadcast 192.168.100.255
network 192.168.100.0


That's final. Now the wireless is configured well when startup.