JasperServer Integration

From OpenNMS

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]

Image:Jasperserver-integration.jpg

How does the client works internal ...

Image: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

Image:Manage-jasperserverrepository.jpg

  • Create a new folder for your reports for OpenNMS

Image:Create-folder.jpg

  • Thats the folder for your report_base in jasperclient.enabled

Image:Report-base.jpg

  • Create Datasource for your OpenNMS-Database and use JDBC

Image:Datasource-step1.jpg

  • Setup JDBC-Driver

Image:Datasource-step2.jpg

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

Image: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>
Personal tools
DevJam 2008 Sponsors
DevJam 2008 Sponsor: Google
DevJam 2008 Sponsor: Netregistry
DevJam 2008 Sponsor: Papa John's
NewEdge Networks
OpenNMS takes home the gold award!
Join the Free Software Foundation
Support This Project Commercial OpenNMS Support OpenNMS Italia Get OpenNMS at SourceForge.net. Fast, secure and Free Open Source software downloads Our Network Simulator Our Java Profiler