JasperServer Integration
Subscribe

From OpenNMS

Jump to: navigation, search

Contents

Integration access to JasperServer-Reports

Note: This is the first implementation

With JasperReports there are some very nice possibilities to create complex reports on the OpenNMS-PostgreSQL database. I have written my first little OpenNMS-Application to integrate a JSP-Page, to use a JasperServer-Reportrepository directly from OpenNMS. I have used the JasperServer-Webservice-API to run exports on the JasperServer. The SQL-Query, report-filling and maybe some heavy calculations runs on the JasperServer. The result can be PDF, XLS or CSV-format. The scenario in the followed picture shows an setup for very large environments, every service runs on dedicated hardware. For small environments or very good serverhardware, you can also run all the stuff on one server. For better understanding and my bad english i have created some pictures to describe this stuff ;)

I have added an enhancement-bug in Bugzilla [1]

Jasperserver-integration.jpg

How does the client works internal ...

Jasperserver-request-response.jpg

Setup your JasperServer

  • Installing JasperServer [2]
  • Download JDBC-PostgreSQL-Driver [3]
  • Copy postgresql-8.2-508.jdbc3.jar to JasperServer for example: /opt/jasperserver-2.1/scripts/drivers
  • Create user and password with read-only access to use your JasperServer.. Please do not use "jasperadmin"! The account are stored in plaintext in the configuration-file.
  • Manage your repository

Manage-jasperserverrepository.jpg

  • Create a new folder for your reports for OpenNMS

Create-folder.jpg

  • Thats the folder for your report_base in jasperclient.enabled

Report-base.jpg

  • Create Datasource for your OpenNMS-Database and use JDBC

Datasource-step1.jpg

  • Setup JDBC-Driver

Datasource-step2.jpg

  • Try a connection-test to be sure all things do work

Datasource-step3.jpg

  • Upload your reports. It should be the best to do that with iReport 2.0.5 [4]
  • If you are using JasperReports 2.0.5 the JasperServer-Plugin is already installed and ready to run.

Preparing your OpenNMS

  • Environment-variable (OPENNMS_HOME=/usr/share/opennms)
  • java version "1.6.0" / Java(TM) SE Runtime Environment (build 1.6.0-b105) / Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)
  • Create Temporary Folder in your webapplication:
 mkdir $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp
 mkdir $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp/pdf
 mkdir $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp/xls
 mkdir $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp/csv
  • Creating configurationfile in $OPENNMS_HOME/etc/jasperclient.enabled

If you are using Tomcat use webapps instead of jetty-webapps.

#
# This is the configurationfile for Jasperclient
#
# To access the JasperServer the following parameter must be set:
#
# $OPENNMS_HOME Environment     - $OPENNMS_HOME/etc/jasperclient.enabled
#                               - $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp
#                               - $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp/pdf
#                               - $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp/xls
#                               - $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/tmp/csv
#
# If you are using Apache Tomcat then create the folders in:
#
#   $OPENNMS_HOME/webapps/opennms/WEB-INF
#
# Configure access to your JasperServer Repository
# 
# Webservicelocation:
# -------------------
# repositoryurl=http://<your-jasperserver-ip>:8080/jasperserver/services/repository
# jasperuser=<user to access the repository>
# jasperpassword=<password to access>
# report_base=/<Folder which contains the reportunits to integrate in OpenNMS>
#
repositoryurl=http://<jasperserverip>:8080/jasperserver/services/repository
jasperuser=<your-user>
jasperpassword=<your-password>
report_base=/<your-OpenNMS-Reportlocation>

Check out the source

The full source patched with OpenNMS is available

 https://opennms.svn.sourceforge.net/svnroot/opennms/opennms/branches/feature-jasper/

For setup read https://opennms.svn.sourceforge.net/svnroot/opennms/opennms/branches/feature-jasper/INSTRUCTION/README.txt

Patch your sourcecode

Download the code here.

This needs to get reviewed and integrated into OpenNMS, but for now, that's where you can get it.  ;)

If you patch your source, then be sure your pom.xml contains the right version number.

 vi $OPENNMS_SOURCE/opennms-webapp/pom.xml

Edit the XML-Tag for correct version:

 <version>1.7.0-SNAPSHOT</version>

More info on patching

Patching the source is not a must. You can run and schedule reports in Jasperserver.

The new reporting is not part of OpenNMS 1.6x.

You only need to patch the source if you compile OpenNMS from source AND you need the jasperclient and new reporting integration in the webinterface.

If you need complete integration of new reporting you can upgrade to OpenNMS 1.8.

In 1.8 there is no need for a separate JasperServer installation.