bookmark_borderSuccess in OpenNMS


Today I setup OpenNMS in Debian sarge

/etc/apt/source/list
deb http://debian.opennms.org/ debian/opennms stable

# apt-get install java-common
# apt-get install sun-jdk1.4-installer
# build-sun-jdk14 ./j2sdk-1_4_2_05-linux-i586.bin
# dpkg -i j2sdk-1_4_2_05-linux-i586.deb

java-virtual-machine meta-package
# apt-get install java-virtual-machine

#apt-get install tomcat4 tomcat4-admin tomcat4-webapps

# apt-get install rrdtool
# apt-get install mrtg

/etc/postgresql/postgresql.conf

tcpip_socket = true
shared_buffers = 1024

/etc/postgresql/pg_hba.conf
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust

#apt-get install opennms opennms-common opennms-contrib opennms-db opennms-server opennms-webapp

Search for a JRE (suggested)
#cd /usr/share/opennms/bin
#./runjava -s

Run the Installer to Setup the PostgreSQL Database
#cd /usr/share/opennms/
#install -disU

Run the Installer to Setup the Web Application
#cd /usr/share/opennms/
# ./install -w /var/lib/tomcat4/webapps -W /var/lib/tomcat4/server/lib

edit /usr/share/opennms/etc/discovery-configuration.xml

include-range retries=”2″ timeout=”3000″
begin 192.168.0.1 begin
end 192.168.0.254 end

start or restart

# /etc/init.d/postgres start
# /etc/init.d/tomcat4 start
# /etc/init.d/opennms start

http://opennms_installed_pc_ip:8180/opennms/

The initial user name is “admin” and the password is “admin”.
(note: 8180 for debian)
(other Linux http://host:8080/opennms/)

edit capsd-configuration.xml for the service your want to monitor

capsd-configuration.xml
==============
scan=”on”

example:
protocol-plugin protocol=”Postgres” class-name=”org.opennms.netmgt.capsd.TcpPlugin” scan=”on” user-defined=”false”
==============

your can finish here if u do not want to enable snmp & notification.

Enable SNMP in a server that you want to monitor. Then…

edit datacollection-config.xml to enable more monitoring graph in opennms.

datacollection-config.xml
===============
snmp-collection name=”default”
maxVarsPerPdu = “50”
snmpStorageFlag = “all”
rrd step = “300”
===============

edit the snmp-config.xml to track servers with snmp

snmp-config.xml
==========
specific 192.168.25.32 specific
range begin=”192.168.25.1″ end=”192.168.25.254″
==========

edit poller-configuration.xml

poller-configuration.xml
===============
status=”on”

example:
service name=”SMTP” interval=”300000″ user-defined=”false” status=”on”
===============

edit notifd-configuration.xml to enable notification
==============================
status=”on”

example:
notifd-configuration
status=”on”
pages-sent=”SELECT * FROM notifications”
next-notif-id=”SELECT nextval(‘notifynxtid’)”
next-group-id=”SELECT nextval(‘notifygrpid’)”
==============================

edit javamail-configuration.properties for mail notification

javamail-configuration.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@localhost

#
# This property defines SMTP Host.
#
org.opennms.core.utils.mailHost=smtp.xyz.net
org.opennms.core.utils.mailer=smtpsend
org.opennms.core.utils.transport=smtp
org.opennms.core.utils.debug=true
#
# This property defines Mail authentication.
# The default setting is false
#org.opennms.core.utils.authenticate=false
#org.opennms.core.utils.authenticateUser=”opennms”
#org.opennms.core.utils.authenticatePassword=”opennms”

# This property controls the use of the JMTA, the
# default is true
#org.opennms.core.utils.useJMTA=true
==========================

set the email address via opennms visual configuration to receive emails.

done 🙂

bookmark_borderWifi in debian

Today I configure Asus Spacelink WL-167g USB2 adapter in debian sid


“Asus Spacelink WL-167g USB2 adapter” which works with the
rt2570 driver, the sources of which can be downloaded on the RALINK website.

more

#apt-get install rt2570-source
#module-assistant

then it will build the rt2570-modules-2.6.17-2-686 (if u use kernel 2.6.17)

#modprobe rt2570

my /etc/network/interfaces
————————–
auto eth1
iface eth1 inet dhcp
wireless-essid your_ID
wireless-mode managed
wireless-key your_secret_key
————————–

bookmark_borderallbn2unicode

i have started a project called allbn2unicode

#include stdio.h
#include stdlib.h
#include string.h
#include wchar.h
#include locale.h
#include langinfo.h

int main(int argc, char *argv[])
{
FILE *fp;
FILE *fp2;
wchar_t wr[80];
wchar_t *wca;
wchar_t hex,*hex2;
char str[80],*store;
int i,len;

/* set locale for bangla */
setlocale(LC_ALL, “bn_BD.UTF-8”);

store = str;

wca = wr;

if(argc!=3){
printf(“name n”);
exit(1);
}

if((fp = fopen(argv[1], “r”)) == NULL) {
printf(“Cannot open file.n”);
exit(1);
}

fgetws(wca, 100, fp);

/* if(fread(store,sizeof(store),1, fp) !=1) {
printf(“Cannot open file.n”);
exit(1);
} */

/* optional for asci file mbstowcs(wca, store,20);*/

fclose(fp);

if((fp2 = fopen(argv[2], “wb”)) == NULL) {
printf(“Cannot write file.n”);
}

if(wr[0]==0x0985)
{
hex=0x0987;
}
else

hex=0x0985;

fputws(wca,fp2);

fclose(fp2);

return 0;
}

bookmark_borderInstall Solaris

Today i install Solaris 10

Cool OS but there was problem in my internet config

my this config was oky
/etc/hosts
/etc/defaultgateway

there was a little problem in
(i have no resolv.conf)
/etc/resolv.conf
(later i add nameserver)

and

cp /etc/nsswitch.dns /etc/nsswitch.conf

for restart network
/etc/init.d/inetsvc stop
/etc/init.d/inetsvc start

source: http://www.computing.net/solaris/wwwboard/forum/4219.html

Later i add debian in /etc/grub/menu.list

title Debian GNU/Linux, kernel 2.6.8-2-386
root (hd0,7)
kernel /boot/vmlinuz-2.6.8-2-386 root=/dev/hda8 ro
initrd /boot/initrd.img-2.6.8-2-386
savedefault
boot

to boot my debian

bookmark_bordermy frist ACM solve

problem 100

#include stdio.h

int calc (unsigned long int i, unsigned long int j, unsigned long int f);

int
main (void)
{
unsigned long int i, j, f;
while(scanf (“%lu”, &i)==1)
{
if (!(0 < i && i < 1000000))
{
scanf (“%lu”, &i);
}
scanf (“%lu”, &j);
if (!(0 < j && j < 1000000)) {
scanf (“%lu”, &j);
}
printf (“%lut %lut”, i, j);
if (i > j)
{
f = i – j;
f = f + 1;
}
else
{
f = j – i;
f = f + 1;
}
calc (i, j, f);
}
return 0;
}

int calc (unsigned long int i, unsigned long int j, unsigned long int f)

{
unsigned long int m, k = 1, n = 0;
unsigned long int l[f];
unsigned long int p;

if (i > j)
{
p = i – j;
p = p + 1;
for (; j 1;)
{
if (m % 2 == 0)
m = m / 2;
else
m = 3 * m + 1;
k = k + 1;
}
l[n] = k;
n = n + 1;
k = 1;
}
}
else
{
p = j – i;
p = p + 1;
for (; i 1;)
{
if (m % 2 == 0)
m = m / 2;
else
m = 3 * m + 1;
k = k + 1;
}
l[n] = k;
n = n + 1;
k = 1;
}
}
p = p-1;
for (n = 0; n < p; n++)
{
if (l[n] > l[n + 1])
{
l[n + 1] = l[n];
}
}
printf (“%lun”, l[p]);
}

bookmark_borderEDGE/GPRS in Linux

Today me (salahuddin66) and Lavluda successfully configured GPRS/EDGE in Linux.

Using wvdial

to check your mobile/modem as a modem
——————————-
#wvdialconf

it will generate /etc/wvdial.conf file for you.

Grameen Phone
For Grameen Phone your need to add

Init3 = AT+CGDCONT=1,”IP”,”gpinternet”

here is a sample of my /etc/wvdial.conf (Grameen Phone EDGE/GPRS)
————————————————————
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,”IP”,”gpinternet”
Modem Type = Analog Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = xyz
Password = xyz
Baud = 115200
———————————————————–
wvdialconf will generate the modem speed/Baud and /dev/xyz path according to your mobile phone

Aktel, Teletalk
here is a sample of my /etc/wvdial.conf
————————————————————
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = xyz
Password = xyz
Baud = 115200
———————————————————–
wvdialconf will generate the modem speed/Baud and /dev/xyz path according to your mobile phone

Start
To start type wvdial in shell

Note:
If you have problem while generating wvdial.conf file in /etc/wvdial.conf then delete the old config file /etc/wvdial.conf and give wvdialconf to create a new configuraton file.

if you have any problem to find the /dev path for your mobile/modem, give

# tail -f /var/log/syslog

Then connect the phone/modem.
You can also use gnome-ppp or other ppp tools to connect.

Using gnome-ppp

Give phone number *99***1#

click on the detect. it will try to detect your phone/modem.
note: If it fails then give your /dev path manually. Search for you modem using #tail -f /var/log/syslog then connect the phone/modem.

it found my phone/modem in /dev/ttyUSB0

click Init Strings.
for Aktel, Teletalk and others (you do not need to change anything)

click Init Strings.
add Init3 only if you are using Grameen Phone EDGE/GPRS (only for GP)

after click connect

connected

details view

Note: If you face any problem using this as user. Run gnome-ppp as root
or check you are a member of dip group.

In Debian or Ubuntu based distro give #adduser your_user_name dip if your are not a member.

bookmark_borderall2theora

here is my all2theora script

(Thanks to my friend Zaher for fixing the Divx problem “-vf harddup”)
(based on Florian Schilhabel dvd2divx script Licence: GPL)

#!/usr/bin/perl

use Getopt::Long;

GetOptions( “help” => $help,
“i=s” => $input,
“divx=s” => $divx, );

if ($help) {
print “Welcome to the ALL2theora Helper Scriptn”;
print “n”;
print “this script encodes a all file to theoran”;
print “Usage:n”;
print “–help show this textn”;
print ” this will only be possible if you are rootn”;
print “–i Specify the Name of your Video filen”;
exit;
}

if ($input eq “”) {
print “No Input file selected – You must specify one with: –i filename.n”;
print “n”;
print “this script encodes a all file to theoran”;
print “Usage:n”;
print “–help show this textn”;
print ” this will only be possible if you are rootn”;
print “–i Specify the Name of your Video filen”;
exit;
}

if ($divx eq “on”) {

system (“mkfifo stream.yuv && chmod 777 stream.yuv && mencoder $input -ovc lavc -oac copy -o tmp.avi -lavcopts vcodec=mpeg1video:vbitrate=1200 -vf harddup -of mpeg && mplayer -vc dummy -vo null -ao pcm:file=stream.wav tmp.avi && encoder_example stream.wav stream.yuv > theora.ogg | mplayer -ao null -nosound -vo yuv4mpeg tmp.avi – 1>/dev/tty7 8>/dev/tty7 && rm stream.yuv && rm stream.wav && rm tmp.avi”);
exit;
}

if ($divx eq “off”) {
system (“mkfifo stream.yuv && chmod 777 stream.yuv && mplayer -vc dummy -vo null -ao pcm:file=stream.wav $input && encoder_example stream.wav stream.yuv > theora.ogg | mplayer -ao null -nosound -vo yuv4mpeg $input – 1>/dev/tty7 8>/dev/tty7 && rm stream.yuv && rm stream.wav”);
exit;
}

if ($divx eq “”) {
system (“mkfifo stream.yuv && chmod 777 stream.yuv && mplayer -vc dummy -vo null -ao pcm:file=stream.wav $input && encoder_example stream.wav stream.yuv > theora.ogg | mplayer -ao null -nosound -vo yuv4mpeg $input – 1>/dev/tty7 8>/dev/tty7 && rm stream.yuv && rm stream.wav”);
exit;
}

print “Video Filename: $inputn”;
print “working…n”;

exit;

Licence: GPL