Reports

Started by rostyslav, December 25, 2012, 12:11:25 PM

Previous topic - Next topic

rostyslav

I am trying to generate some reports and have some troubles.

I downloaded report from https://svn.netxms.org/public/netxms/tags/version-1.2.4/reports/IP%20Inventory.jrxml and imported it to the NetXMS server.
Then compiled report-generator.jar
apt-get install fastjar
wget -r --no-parent https://svn.netxms.org/public/netxms/trunk/src/java/report-generator/
jar cvf report-generator.jar report-generator/
cp report-generator.jar /opt/netxms/java-lib/


Then added this code to the netxmsd.conf
JavaPath=/usr/bin/java
JavaLibraryDirectory=/opt/netxms/java-lib
JDBCDriver=org.postgresql.Driver
JDBCUrl=jdbc:postgresql://localhost/netxms


But reports not generating.
Thanks for any help.

Lukas

Hi rostyslav,

Did you have any success with the reports generation?

I got the following exception in the java management console stderr or stdout (netxms 1.2.4):

org.simpleframework.xml.core.ValueRequiredException:
Unable to satisfy @org.simpleframework.xml.ElementList(inline=true, entry=, name=, data=false, empty=true, required=true, type=void) on field
'parameters' private java.util.List org.netxms.ui.eclipse.reporter.widgets.helpers.ReportDefinition.parameters
for class org.netxms.ui.eclipse.reporter.widgets.helpers.ReportDefinition at line 2


Do you see the same error?

BTW https://svn.netxms.org/public/netxms/trunk/src/java/report-generator/ contains source files and jar -cvf will create an archive, which can not be used as interpreted java jar file. There is a pom file in that directory which controls the build process and should be invoked via maven if you really need to build the report generator again. I think that it is not necessary.

Best Regards,
Lukas

Alex Kirhenshtein

I temporarily put complete prebuild package here: https://www.netxms.org/tmp/report-generator.jar.
Due to licensing restrictions, we can't redistribute most of JDBC drivers so you have to compile it yourself (we will probably make jar with pgsql/mysql drivers only available on the webpage a bit later). Here is short instruction, how to build it yourself: http://wiki.netxms.org/wiki/How_to_compile_report-generator

When you obtain report-generator.jar, copy it to /opt/netxms/java-lib/ (JavaLibraryDirectory)

I just tried to run "IP Inventory" with your configuration and report-generator from the link above and it works fine.

Alex Kirhenshtein

Management console was unable to parse report definition (it's xml file with root tag "jasperReport").
Can you send me your report definition file?

Quote from: Lukas on January 07, 2013, 02:08:55 PM
I got the following exception in the java management console stderr or stdout (netxms 1.2.4):

org.simpleframework.xml.core.ValueRequiredException:
Unable to satisfy @org.simpleframework.xml.ElementList(inline=true, entry=, name=, data=false, empty=true, required=true, type=void) on field
'parameters' private java.util.List org.netxms.ui.eclipse.reporter.widgets.helpers.ReportDefinition.parameters
for class org.netxms.ui.eclipse.reporter.widgets.helpers.ReportDefinition at line 2


Lukas

Thank you Alex for the detailed how-to.

I am using the report definition file from the netxms svn: https://svn.netxms.org/public/netxms/trunk/reports/IP%20Inventory.jrxml and tried both your and my report-generator.jar.

The ValueRequiredException is printed to the console even in case that the report-generator.jar file is not present. Server log then contains Exception in thread "main" java.lang.NoClassDefFoundError: org/netxms/report/Generator So it seems to be independent of the presence of the generator.

I also made sure that there is only one row in the reports table in the database.

Do you have some other ideas what can be wrong?

The full stacktrace, in case it helps:

org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(inline=true, entry=, name=, data=false, empty=true, required=true, type=void) on field 'parameters' private java.util.List org.netxms.ui.eclipse.reporter.widgets.helpers.ReportDefinition.parameters for class org.netxms.ui.eclipse.reporter.widgets.helpers.ReportDefinition at line 2
at org.simpleframework.xml.core.Composite.validate(Composite.java:705)
at org.simpleframework.xml.core.Composite.readElements(Composite.java:510)
at org.simpleframework.xml.core.Composite.readSection(Composite.java:388)
at org.simpleframework.xml.core.Composite.read(Composite.java:367)
at org.simpleframework.xml.core.Composite.readDefault(Composite.java:262)
at org.simpleframework.xml.core.Composite.read(Composite.java:232)
at org.simpleframework.xml.core.Composite.read(Composite.java:202)
at org.simpleframework.xml.core.Composite.read(Composite.java:150)
at org.simpleframework.xml.core.Traverser.read(Traverser.java:92)
at org.simpleframework.xml.core.Persister.read(Persister.java:625)
at org.simpleframework.xml.core.Persister.read(Persister.java:606)
at org.simpleframework.xml.core.Persister.read(Persister.java:584)
at org.simpleframework.xml.core.Persister.read(Persister.java:562)
at org.simpleframework.xml.core.Persister.read(Persister.java:499)
at org.simpleframework.xml.core.Persister.read(Persister.java:408)
at org.netxms.ui.eclipse.reporter.widgets.helpers.ReportDefinition.createFromXml(ReportDefinition.java:47)
at org.netxms.ui.eclipse.reporter.widgets.ReportExecutionForm.createParamEntryFields(ReportExecutionForm.java:184)
at org.netxms.ui.eclipse.reporter.widgets.ReportExecutionForm.<init>(ReportExecutionForm.java:117)
at org.netxms.ui.eclipse.reporter.views.ReportView.createPartControl(ReportView.java:63)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.WorkbenchPage$ActivationList.setActive(WorkbenchPage.java:4317)
at org.eclipse.ui.internal.WorkbenchPage$18.runWithException(WorkbenchPage.java:3359)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$33.runWithException(Workbench.java:1600)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4330)
at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:94)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1595)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2628)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.netxms.ui.eclipse.console.NXMCApplication.start(NXMCApplication.java:36)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

rostyslav

Alex, thank you for the prebuild package and instruction on how to build it myself.
I've replaced report-generator.jar file with https://www.netxms.org/tmp/report-generator.jar , restarted netxms server and reports are generating.

Lucas, I haven't seen this exception on my ubuntu server.

I will try to generate my own, not prebuild reports, and will post results here.

Best regards,
Rostyslav

rostyslav

I've got this working... kind of.
Created new custom report with http://jasperforge.org/projects/ireport software.

Had some trouble with figuring out how to create a query. Here is what I end with:

SELECT
object_properties.name AS nas_name,
items.name AS parameter,
raw_dci_values.transformed_value AS value
FROM
object_properties
INNER JOIN
items
ON
object_properties.object_id = items.node_id AND items.name = 'OpenVPN.Users'
INNER JOIN
raw_dci_values
ON
items.item_id = raw_dci_values.item_id AND raw_dci_values.transformed_value ~ '^[0-9]+'
ORDER BY
value


object_properties table stores node names, items stores data collection items and raw_dci_values stores actual data.
I've had to slightly change this query to create a pie chart similar to those on dashboards.

I attached my reports for those who might need it.

Now I'm having troubles with scheduling reports. Clicking on "Schedule report execution" do nothing.

Also is there an option on sending reports via email?

Best regards,
Rostyslav

rostyslav

#7
Because the scheduling is not working I've came up with this solution.

Generate report from console:

"/usr/bin/java" -cp "/opt/netxms/java-lib/report-generator.jar" org.netxms.report.Generator "/etc/netxmsd.conf" "/opt/OpenVPN-report.def" "/opt/reports/`date +%d%m%Y`-openvpn-count.output"

/opt/OpenVPN-report.def is our jasper report .jrxml file.

Convert this report to PDF format:

"/usr/bin/java" -cp "/opt/netxms/java-lib/report-generator.jar" org.netxms.report.Exporter "/opt/reports/`date +%d%m%Y`-openvpn-count.output" "/opt/reports/`date +%d%m%Y`-openvpn-count.pdf"

And send this report via email:

sendemail -f "[email protected]" -t "[email protected]" -m "Subject: OpenVPN report `date +%d-%b-%Y`" -u "Header: Report `date +%d-%b-%Y`" -a "/opt/reports/`date +%d%m%Y`-openvpn-count.pdf"

Add all of this to the cron, and we have custom reports scheduling.

All that left is to wait when these features will be available from GUI.

Edited: Attached short instruction with all necessary steps.

Best regards,
Rostyslav