JasperReports measurements data-source step returning null

Description

From support ticket:

noformat
in the Report the Request locks like:
<queryString language="measurement">
<![CDATA[<query-request step="1" start="$P{startDateTime}" end="$P{endDateTime}" maxrows="0">
<source aggregation="AVERAGE" label="IfHCInOctets" attribute="ifHCInOctets" transient="false" resourceId="$P{nodeResourceDescriptor}.interfaceSnmp[$P{interface}]"/>
<source aggregation="AVERAGE" label="IfHCOutOctets" attribute="ifHCOutOctets" transient="false" resourceId="$P{nodeResourceDescriptor}.interfaceSnmp[$P{interface}]"/>
</query-request>]]>
</queryString>
<field name="Step" class="java.lang.Double">
<fieldDescription><![CDATA[Step]]></fieldDescription>
</field>
<field name="IfHCInOctets" class="java.lang.Double">
<fieldDescription><![CDATA[IfHCInOctets]]></fieldDescription>
</field>
<field name="IfHCOutOctets" class="java.lang.Double">
<fieldDescription><![CDATA[IfHCOutOctets]]></fieldDescription>
</field>

And the Debug Log says this:
o.o.n.j.m.MeasurementQueryExecutor: Create datasource for query '<query-request step="1" start="1457564400000" end="1457650800000" maxrows="0">
<source aggregation="AVERAGE" label="IfHCInOctets" attribute="ifHCInOctets" transient="false" resourceId="nodeSource[Switches:1404393057866].interfaceSnmp[Ethernet127_1_48-mac]"/>
<source aggregation="AVERAGE" label="IfHCOutOctets" attribute="ifHCOutOctets" transient="false" resourceId="nodeSource[Switches:1404393057866].interfaceSnmp[Ethernet127_1_48-mac]"/>
</query-request>'

If I print the Field Step on the Output, I get only "null".

Environment

Customer identified in ticket https://mynms.opennms.com/Ticket/Display.html?id=4403

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Markus von Rüden March 17, 2016 at 6:19 AM

The Measurements Datasource works as expected.

Markus von Rüden March 17, 2016 at 6:18 AM
Edited

I investigated and I could not find any issue related to this issue.
I noticed two things:

1. As originally stated the Field "Step" does not exist, it must be "step".
In addition it must be of type "java.lang.Long" instead of type "java.lang.Double":

<field name="step" class="java.lang.Long">
<fieldDescription><![CDATA[The step]]></fieldDescription>
</field>

See http://docs.opennms.org/opennms/branches/develop/guide-admin/guide-admin.html#ga-database-reports-fields for more details.

2. If the request does not return any data, all fields return "null". For this case a "NO DATA" section should be created for the used subreport. Our "TotalBytesTransferredByInterface" subreport shows how to do this: https://github.com/OpenNMS/opennms/blob/develop/opennms-base-assembly/src/main/filtered/etc/report-templates/subreports/TotalBytesTransferredByInterface_subreport1.jrxml

Markus von Rüden March 16, 2016 at 6:41 AM

can you please provide the rrd data from demo.opennms.org?
I do not have any data which the measurement api can provide and I do not have access to demo.opennms.org.

Jeff Gehlbach March 16, 2016 at 1:21 AM

Report template now available on ticket (see above for link).

Jeff Gehlbach March 15, 2016 at 1:12 PM

Requested.

Won't Fix

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

PagerDuty

Created March 14, 2016 at 2:03 PM
Updated March 17, 2016 at 6:19 AM
Resolved March 17, 2016 at 6:19 AM