Sunday, September 03, 2006

Success 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 :)

12 comments:

zaher14 said...

congrats, man! way 2 go!

lavluda said...

great work :)

shahid said...

for the notifications on email

org.opennms.core.utils.mailHost=smtp.xyz.net

in place of smtp.xyz.net i am mentioning my SMTP mail server address, but i am getting the error
04-Feb-2008 16:13:20 alt.dev.jmta.JMTA sendMessage
WARNING: Invalid Addresses

pls help me to rectify the problem

shahid said...

Hi;
I am runnning openms-1.3.9 on windows xp. it is running since last two months perfectly. Now, i want to configure the alerts
or notification for email alerts to my boss and to me.
i have edited the javamail-configuration.properties file and only changes in the configurations are as follows, all other lines are cmmented.
the uncommented or active segment of the file are as follows

org.opennms.core.utils.fromAddress=shahi18464@headoffice.org01
org.opennms.core.utils.mailHost=172.16.143.29
org.opennms.core.utils.mailer=smtpsend
org.opennms.core.utils.transport=smtp
org.opennms.core.utils.debug=true
org.opennms.core.utils.smtpport=25


shahi18464@headoffice.org01 ---- is mine internal mail id.
172.16.143.29 ----is SMTP mail server IP address (we r using lotus notes)

sender email address is configured via opennms web interface throuh group and user roles.

when opennms is sending the email alerts to the ids then it is giving the following erros.
06-Feb-2008 10:02:53 alt.dev.jmta.JMTA sendMessage
WARNING: Invalid Addresses

can somebody help how to rectify this problem and which other files need to be modified.

In one article i have read that in the notifications command.xml file

for javaemail
command binary value is to be set to "true".
right now, it is false in my configration. whether i really needs to do this.

pls reply ASAP. Thanks for yours help
Regards,
Shahid Iqubal

salahuddin66 said...

I think it is checking for the smtp.* as prefix.

(example: smtp.headoffice.org01)

http://java.sun.com/products/javamail/Third_Party.html


You can try by installing sendmail or use other type of mail system instead of JMTA for OpenNms

shahid said...

Thanks a lot for yours commnets. can you tell me how i can integrate sendmail with opennms like which file and config needs to be modifies.

i have downloaded senmail but how to got about it...got stuck there.

pls help me to overcome this problem.
Thanks and Regards,
Shahid Iqubal

salahuddin66 said...

you can try with other smtp for testing
org.opennms.core.utils.mailHost=smtp.gmail.com

if you got success using the smtp.* prefix then, setup a DNS server (BIND) in that server, and add that IP as your DNS address in the OpenNms server.


http://www.opennms.org/documentation/ReleaseNotesStable.html

"The < command > tag now has an attribute called 'binary' that when set to "true" will cause the notification process to attempt to execute a system command specified in the < execute > tag. When not set or set to anything other than "true", the notification process assumes it is an OpenNMS notification class and will instantiate it and execute its 'send()' method. By convention, the "binary" attribute will be set to "false" when new notification classes are implemented."

main documentation:
http://www.opennms.org/index.php/Docu-overview

http://www.opennms.org/index.php/FAQ-Configuration#Q:_How_Do_I_Add_Custom_Notification_Commands.3F
http://www.opennms.org/index.php/Email_to_Event

salahuddin66 said...

Instead of
shahi18464@headoffice.org01

try with
shahi18464@headoffice.org

shahid said...

i have made the certain changes in the email addresses .
apart from that i have changed the

org.opennms.core.utils.mailHost=172.16.143.29

and now i am getting the following error

09-Feb-2008 10:56:44 alt.dev.jmta.JMTA sendMessage
WARNING: Unknown SMTP host: bac.com

actually this server 172.16.143.29 is dscsd02.bac.com

so i have experimented with the following changes also.
org.opennms.core.utils.mailHost=dscsd02.bac.com

still i am getting the same error.
then i modified with the following changes

org.opennms.core.utils.mailHost=smtp.bac.com

and added in /etc/hosts file

172.16.1143.29 smtp.bac.com

still i am getting the same error.
because rather than the DNS server it will first look into the etc/hosts file.

yours other suggestion such as smtp.gmail.com will work only with the Mail Exchange Records.

i have yet to try that.

email to event ---documents i am yet to try.
based on it , can you suggest what i should to rectify this problem.
Thanks a lot for yours all help and suggestions.

Regards,
Shahid Iqubal

salahuddin66 said...

Check with smtp.gmail.com first, to ensure that your JMTA is working.

Then try other things.....

shahid said...

the problem is rectified.

with the following modifications.
Now, my javamail-configuration.properties looks like this
org.opennms.core.utils.fromAddress=OpenNMS-Alerts@bac.com
org.opennms.core.utils.mailHost=smtp-dscsd02.bac.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.useJMTA=false

i have added the ip for smtp-dscsd02.bac.com in th host file.

Now, i am able to recieve the mail for two users : Attcahed is the log file for that.
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 220 DSCSD02.BAC.COM ESMTP Service (Lotus Domino Release 7.0.2) ready at Sun, 10 Feb 2008 17:51:55 +0400 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DEBUG SMTP: connected to host "smtp-dscsd02.bac.com", port: 25
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: for transport name 'smtp' got: com.sun.mail.smtp.SMTPTransport@17fdebe
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: not authenticating to smtp-dscsd02.bac.com
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: useEhlo true, useAuth false
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: trying to connect to host "smtp-dscsd02.bac.com", port 25, isSSL false
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: EHLO ltgwac67 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 250- DSCSD02.BAC.COM Hello ltgwac67 ([172.17.70.18]), pleased to meet you
250-HELP
250-SIZE 5120000
250 PIPELINING 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DEBUG SMTP: Found extension "HELP", arg ""
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DEBUG SMTP: Found extension "SIZE", arg "5120000"
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DEBUG SMTP: Found extension "PIPELINING", arg ""
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DEBUG SMTP: use8bit false
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: MAIL FROM:OpenNMS-Alerts@bac.com 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 250 OpenNMS-Alerts@bac.com... Sender OK 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: RCPT TO:rmohan@bac.com 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 220 DSCSD02.BAC.COM ESMTP Service (Lotus Domino Release 7.0.2) ready at Sun, 10 Feb 2008 17:51:55 +0400 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 250 rmohan@bac.com... Recipient OK 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: connected to host "smtp-dscsd02.bac.com", port: 25
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DEBUG SMTP: Verified Addresses
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DEBUG SMTP: rmohan@bac.com
2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: DATA 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: 354 Please start mail input. 2008-02-10 17:51:17,488 DEBUG [Thread-25588] JavaMailer: Date: Sun, 10 Feb 2008 17:51:17 +0400 (GST)
From: OpenNMS-Alerts@bac.com
To: rmohan@bac.com
Message-ID: <11944274.981202651477488.JavaMail.shahi18464@ltgwac67>
Subject: RESOLVED: Notice #1007: HTTP down on 192.192.1.11 (192.192.1.11) on
node ZCHWAP01.
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Mailer: smtpsend

RESOLVED: The HTTP service poll on interface 192.192.1.11 (192.192.1.11)
on node ZCHWAP01 failed at Sunday, 10 February 2008 17:50:27 o'clock GST.

. 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: EHLO ltgwac67 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 250- DSCSD02.BAC.COM Hello ltgwac67 ([172.17.70.18]), pleased to meet you
250-HELP
250-SIZE 5120000
250 PIPELINING 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: Found extension "HELP", arg ""
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: Found extension "SIZE", arg "5120000"
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: Found extension "PIPELINING", arg ""
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: use8bit false
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: MAIL FROM:OpenNMS-Alerts@bac.com
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 250 OpenNMS-Alerts@bac.com... Sender OK 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: RCPT TO:shahid@bac.com 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 250 shahid@bac.com... Recipient OK 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: Verified Addresses
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DEBUG SMTP: shahid@bac.com
2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: DATA 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: 354 Please start mail input. 2008-02-10 17:51:17,488 DEBUG [Thread-25587] JavaMailer: Date: Sun, 10 Feb 2008 17:51:17 +0400 (GST)
From: OpenNMS-Alerts@bac.com
To: shahid@bac.com
Message-ID: <13046338.991202651477488.JavaMail.shahi18464@ltgwac67>
Subject: RESOLVED: Notice #1007: HTTP down on 192.192.1.11 (192.192.1.11) on
node ZCHWAP01.
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Mailer: smtpsend

RESOLVED: The HTTP service poll on interface 192.192.1.11 (192.192.1.11)
on node ZCHWAP01 failed at Sunday, 10 February 2008 17:50:27 o'clock GST.

. 2008-02-10 17:51:17,551 DEBUG [Thread-25592] JavaMailer: NOOP 2008-02-10 17:51:17,551 DEBUG [Thread-25591] JavaMailer: NOOP 2008-02-10 17:51:17,551 DEBUG [Thread-25592] JavaMailer: 250 OK 2008-02-10 17:51:17,551 DEBUG [Thread-25592] JavaMailer: QUIT 2008-02-10 17:51:17,551 DEBUG [Thread-25591] JavaMailer: 250 OK 2008-02-10 17:51:17,551 DEBUG [Thread-25592] JavaMailer: 221 Closing connection. Good bye. 2008-02-10 17:51:17,551 DEBUG [Thread-25591] JavaMailer: QUIT 2008-02-10 17:51:17,551 DEBUG [Thread-25592] NotificationTask: command javaEmail return code = 0
2008-02-10 17:51:17,551 DEBUG [Thread-25591] JavaMailer: 221 Closing connection. Good bye. 2008-02-10 17:51:17,551 DEBUG [Thread-25591] NotificationTask: command javaEmail return code = 0
2008-02-10 17:51:17,660 DEBUG [Thread-25587] JavaMailer: 250 Mail queued for delivery. 2008-02-10 17:51:17,660 DEBUG [JavaMail-EventQueue] JavaMailer: message delivered: valid sent addresses: shahid@bac.com
2008-02-10 17:51:17,660 DEBUG [Thread-25588] JavaMailer: 250 Mail queued for delivery. 2008-02-10 17:51:17,660 DEBUG [JavaMail-EventQueue] JavaMailer: message delivered: valid sent addresses: rmohan@bac.com
2008-02-10 17:51:17,723 DEBUG [Thread-25587] JavaMailer: NOOP 2008-02-10 17:51:17,723 DEBUG [Thread-25587] JavaMailer: 250 OK 2008-02-10 17:51:17,723 DEBUG [Thread-25587] JavaMailer: QUIT 2008-02-10 17:51:17,723 DEBUG [Thread-25587] JavaMailer: 221 Closing connection. Good bye. 2008-02-10 17:51:17,723 DEBUG [Thread-25587] NotificationTask: command javaEmail return code = 0
2008-02-10 17:51:17,723 DEBUG [Thread-25588] JavaMailer: NOOP 2008-02-10 17:51:17,723 DEBUG [Thread-25588] JavaMailer: 250 OK 2008-02-10 17:51:17,723 DEBUG [Thread-25588] JavaMailer: QUIT 2008-02-10 17:51:17,723 DEBUG [Thread-25588] JavaMailer: 221 Closing connection. Good bye. 2008-02-10 17:51:17,723 DEBUG [Thread-25588] NotificationTask: command javaEmail return code = 0

To one admin ----rmohan@bac.com
and one user ---- shahid@bac.com

i have added the two more addresses for two more higher perons without uses in the option add email addresses as
pritpal@bac.com
mohank@bac.com

but they are not receiving the message.
whether i need to create the user ids for then so that javamail can be send instead of email.

can you tell me how to set the intermode map view in openNMS
and if i want only particular person to be notified for some particular node of networking devices then how to do it. i know it is feasible in openNMS.
IS IT FEASIBLE TO MONITOR THE layer 2 (Trunk) interfacce apart form SNMP parameters so that alert can be generated for that also when it goes down.
i think it id possible only for layer 3 interfaces.

Looking forward to urs reply.
Thanks for all yours help.
Regards,
Shahid Iqubal

salahuddin66 said...

The version of OpenNMS I was using. JMTA was true by default.


For mail notification problem, main reason may be cache.


You need to write a SNMP trap for it.
http://net-snmp.sourceforge.net/docs/man/snmptrapd.html