These directions were first created by Matthew W Warren during an installation of OpenNMS for Picis,
Inc in Wakefield, MA.
Installing OpenNMS for Ubuntu Linux
OpenNMS version 1.5.9 Postgresql version 8.2 It was thought that “tomcat” packages were required to run OpenNMS however there is a separate web package that comes up as a dependency of the “opennms” package that takes care of the webpage. Add the following to /etc/apt/sources.lists deb http://debian.opennms.org unstable main
deb-src http://debian.opennms.org unstable main
Add the OpenNMS PGP Key to APT wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add –
Update APT or reload Synaptic In Synaptic Package Manager, search for “opennms” Select “opennms” package and all dependencies should be chosen Install packages I have found that a package called “jrrd” is required for the initialization of OpenNMS. No clue to its importance or if it matters but search for it and install it so that things go smoothly towards the end. Once it's installed, make sure the Sun Java is the correct default "java" command: $ java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)
If it does not say HotSpot, it is probably not the Sun JVM, and the user will need to change the default: $ sudo update-alternatives --config java
There are 3 alternatives which provide `java'.
Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
*+ 2 /etc/alternatives/kaffe-system/bin/java
3 /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
Press enter to keep the default[*], or type selection number: 3
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/java' to provide `java'.
For some strange reason that I have yet to understand the user must start the postgresql datbase now
sudo /etc/init.d/postgresql-8.2 start
Next, the user must edit, pg_hba.conf and postgresql.conf Which are located in /etc/postgresql/8.2/main Editing must be done with root privilages. I suggest using
sudo nano filename_here
or
sudo gedit
for a graphical approach In pg_hba.conf, change: local all all ident sameuser
host all all 127.0.0.1/32 ident sameuser
host all all ::1/128 ident sameuser
to:
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
In postgresql.conf, ensure that: listen_addresses = 'localhost'
is not commented out with # Now, restart postgresql with root privilages (it works this way, I don’t get why the user can’t wait to start it until this point but oh well): sudo /etc/init.d/postgresql-8.2 restart
Now the user can start to configure OpenNMS Start by setting a variable for the home directory of OpenNMS export OPENNMS_HOME=/usr/share/opennms
Point OpenNMS to the directory of JRE: sudo $OPENNMS_HOME/bin/runjava -s
runjava: Looking for an appropriate JRE...
runjava: Checking for an appropriate JRE in JAVA_HOME...
runjava: skipping... JAVA_HOME not set
runjava: Checking JRE in user's path: "/usr/bin/java"...
runjava: found an appropriate JRE in user's path: "/usr/bin/java"
runjava: value of "/usr/bin/java" stored in configuration file
In order to save the configuration, the user must run the runjava command as root
Next the user will run the OpenNMS installer to initialize the program and the database as root. sudo $OPENNMS_HOME/bin/install -dis
After that process has finished, the user can start OpenNMS. sudo opennms start
Starting OpenNMS: ok
Now the user can go to http://machine.ip.in.here:8980/opennms and login with Username: admin Password: admin Finally, to configure the discovery of network devices, click on the “Admin” link, then “Configure Discovery”, then “Modify Configuration” and add in IP ranges or specific IP addresses for your network devices. It will take a few minutes for OpenNMS to refresh and recognize all the services on your machines. How to Create a New User Account Navigate to Admin/Configure Users, Groups and Roles/Configure Users
From here the user clicks on “Add New User”
Enter the desired User ID, password and confirm it. Click “OK”
Enter the contact information for the user and a schedule if needed. This is the same screen that shows when a user account is edited. To create/finish editing the account, click “Finish”. How to Create an Alerting path To setup a destination path, the user starts in the Admin/Configure Notifications/Configure Destination Paths screen.
For this walkthrough, the Email-Admin path will be used and set up to send an email to the “Admin” group.
After selecting the “New Path” button the user comes to:
Enter the name of the path in the “Name:” field and if there should be a delay between the event that triggers this path and its action, set it in the “Initial Delay” menu. Next click “Edit” to the left of “Initial Targets”
At this screen, the user has the option of choosing users to send a notification to or a group. Also the user can select certain schedules so only users who are “On Call” will receive a notification. Finally, if someone who should get alerted does not have a user account; the user can add their individual email address. Choose the user(s), group(s), role(s), or address(es) to send to and click “Next”
Set a time interval to wait between contacting each member of a group, if any groups were selected, and click “Next”.
Select the type of alerting service to use (the setup steps for javaEmail are below) and click “Next”.
The user returns to the main screen for configuring the Path Outline. Now the “Admin” group is in the “Initial Targets”. If another alert should be sent out if the event escalates (goes unrepaired/unacknowledged for over 1hr), click “Add Escalation” and go through the steps same as above. When finished, click on “Finish” Adding a User Group
At the Configure Groups screen, click on “Add new group”.
Enter a Group Name and a Comment, if necessary.
Choose the users to add to the group and click the >> button. Schedules for this group may also be added at this time. Note: Alerts will only be sent to the group if they are scheduled to be on duty. Click “Finish” and the group will be created. How to Setup Alerting emails (using Microsoft Exchange as an Email Server) Note: instructions on how to use Gmail or AOL are on the OpenNMS website. By default, OpenNMS uses the JavaMail API for alerting. This is the method used for this how-to. In order to use this method, it is necessary to install the API on your machine so it may be used by OpenNMS to send emails. In Synaptic Package Manager, search for “javamail” and select the “libgnumail-java” package or from the command line enter: sudo aptitude install libgnumail-java
Note: This package may have two dependencies “libgnuinet-java” and “libgnujaf-java” After that is installed, the user needs to configure the file, javamail-configuration.properties in OPENNMS_HOME/etc. From our favorite root-privileged text editor, the user edits: #
# 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
org.opennms.core.utils.useJMTA=false
#
# 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
to read like: #
# This property defines system sender account.
#
# The default setting is root@[127.0.0.1]
org.opennms.core.utils.fromAddress=user@host
#
# These properties define the SMTP Host.
#
org.opennms.core.utils.mailHost=mail_server_address
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=false
#
# 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
On the Exchange Server, the IP address of your monitoring server must be allowed to relay through the Exchange server and send emails. and proceed to Configuring Event Notifications After going to the Admin/Configure Notifications/Configure Event Notifications the user sees the following screen:
Most notifications that you want to add can be found under the heading “OpenNMS-” after clicking on “Add New Event Notification” To add email alerting for a user or users, either add a new event or edit an existing one. For this example, the “admin” user and the “Admin” group that contains only the “admin” user will be used and the interfaceDown event will be edited.
At this screen, the user chooses the event to add a notification for. If editing a notification, the one chosen to edit is selected automatically. Click “Next”.
The “Current Rule” line defines the IP addresses for which you want the notification. If you want all machines that are currently being monitored, enter “IPADDR IPLIKE *.*.*.*”.
If the user wants to narrow the notification for machines running specific services, they can select the services from the box on the left. If they want to narrow the notification for machines NOT running specific services, choose from the box on the right. Then click “Validate rule results” to get to the following screen:
This shows a list of the devices that match the criteria provided in the previous screen. If this list is satisfactory, click “Next”. If not, click “Rebuild”.
At the final screen, the user can customize the event’s name, description, path for emailing (which is explained above), the message that will be sent in the email, the email subject, and key for special values to be used in any of the fields above. Once the fields are suitable, click “Finish”. Congratulations, you have a working monitoring and alerting system. Adding Custom Services or Ports to OpenNMS In order to monitor more than the included services and ports, the user will have to edit two files on the server under OPENNMS_HOME/etc. capsd-configuration.xml poller-configuration.xml To add a Windows Service: In capsd-configuration add: <protocol-plugin protocol="Name-as-you-want-it-displayed" class-
name="org.opennms.netmgt.capsd.plugins.Win32ServicePlugin" scan="on" user-
defined="true">
<property key="timeout" value="2000" />
<property key="retry" value="1" />
<property key="service-name" value="Service Name As Displayed In
Windows Services" />
</protocol-plugin>
This can be copied from the included Windows-Task-Scheduler. NOTE: the name of the service as it will be displayed CANNOT be longer than 32 characters In poller-configuration.xml add: <service name="Service-Name-As-Displayed" interval="300000" user-
defined="true" status="on">
<parameter key="retry" value="2" />
<parameter key="timeout" value="3000" />
<parameter key="port" value="161" />
<parameter key="service-name" value="Service Name As Displayed In
Windows Services" />
</service>
At the end of the file add: <monitor service="Service-Name-As-Displayed" class-
name="org.opennms.netmgt.poller.monitors.Win32ServiceMonitor" />
Again, both of these can be copied from the Windows-Task-Scheduler sections of the .xml files. To add a custom port Note: Port monitoring uses classes for the types of ports. I have not done enough research to know
which class to use in which case. I have enabled monitoring for ports 8900 and 8090 using the HttpPlugin class. Depending on the type of activity used by the port you may find an appropriate class in the poller or capsd .xml files.
In capsd-configuration.xml add: <protocol-plugin protocol="Protocol-Name" class-
name="org.opennms.netmgt.capsd.plugins.HttpPlugin" scan="on" user-
defined="true">
<property key="port" value="port number" />
<property key="timeout" value="3000" />
<property key="retry" value="1" />
</protocol-plugin>
In poller-configuration.xml add: <service name="Protocol-Name" interval="300000" user-defined="true"
status="on">
<parameter key="retry" value="1" />
<parameter key="timeout" value="3000" />
<parameter key="port" value="port number" />
<parameter key="url" value="/" />
<parameter key="rrd-repository"
value="/usr/share/opennms/share/rrd/response" />
<parameter key="rrd-base-name" value="http" />
<parameter key="ds-name" value="http" />
</service>
At the end add:
<monitor service="Protocol-Name" class-
name="org.opennms.netmgt.poller.monitors.HttpMonitor" />
Note: If you use a different class (i.e. FtpMonitor or TcpMonitor) you need to replace the
“HttpMonitor” in the end of the class-name value. After editing capsd and poller files Save these files and type sudo opennms restart
in the console to restart OpenNMS and allow it to poll for the added services and ports. Once it has restarted, the user must “rescan” the nodes that use those services for them to be recognized. Notes: A service rescan occurs every 24 hours automatically
The services must be running when the nodes are rescanned in order to monitor them. If a service is stopped, OpenNMS will assume it is not functioning and declare an interfaceDown
event.