From OpenNMS
Contents |
Summary
OpenNMS can generate availability reports in a number of different formats.
- The HTML Report is a simple HTML report with embedded style sheet that seems to work well in most browsers.
- The PDF Report (File:AvailReport.pdf) is a multiple page PDF report.
- The SVG Report (File:SVGAvailReport.pdf) is a single page PDF report with embedded SVG graphics.
- Long node names cause issues with the Last Months Top 20 Offenders chart in this report; see XSL/SVG Layout Hacks for workaround pointers
Note: Reports can be customized using categories, which includes changing percentages used; see Categories.xml for configuration information.
Configuration
In OpenNMS version 1.7.10 and later the Availability Reports are configured using two xml files. The driver behind this change is to convert the existing report code to use the new report api.
An unique report id identifies the report itself across both configuration files. One file (database-reports.xml) defines the name, description and reporting engine to be used to generate the report. Another file (availability-reports.xml) defines the parameters for the report including the logo to be used in the PDF reports and the stylesheets to be used to generate the reports. The following examples are taken from the default 1.7.10 configuration files.
database-reports.xml
The following is one of the stock report elements from release 1.7.10:
<report id="defaultCalendarReport" display-name="default calendar report"
report-service="availabilityReportService" description="standard opennms report in calendar format" />
- id is the unique report id that identifies the report across both configuration files.
- display-name is the name that will be given for the report when it is listed.
- report-service defines the reporting engine that will be used to generate the report, in this case it is the OpenNMS built in availabilityReportService engine. This is the only implementation of the report API in 1.7.10. It should not be changed.
- description provides the description that the report will be given when it is listed.
availability-reports.xml
This file provides configuration information for the build in availabilityReportService engine. As such, in release 1.7.10 there will be a report element for every report element in database-reports.xml.
<report id="defaultCalendarReport"
type="calendar">
<logo>/Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/logo.gif</logo>
<svg-template>file:///Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/SVGAvailReport.xsl</svg-template>
<pdf-template>file:///Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/PDFAvailReport.xsl</pdf-template>
<html-template>file:///Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/HTMLAvailReport.xsl</html-template>
<parameters>
<string-parm name="reportCategory" display-name="report category" input-type="reportCategorySelector" />
<date-parm name="endDate" display-name="end date" use-absolute-date="false">
<default-interval>day</default-interval>
<default-count>1</default-count>
</parameters>
</report>
- id is the unique report id that identifies the report across both configuration files.
- type defines whether the report will be provided in calendar or tabular format.
- logo is the path to the logo file used by the PDF reports. This should be an absolute path. I've also found that GIF files seem to work best with the rendering libraries OpenNMS uses.
- svg-template is a resource (it needs the file:/// part) that points to the template used to generate the SVG reports.
- pdf-template is a resource (it needs the file:/// part) that points to the template used to generate the PDF reports.
- html-template is a resource (it needs the file:/// part) that points to the template used to generate the HTML reports.
- parameters is used to define the report parameters that appear in the pages used to invoke or schedule the reports. They are not user-modifiable in this release.
Modifying the Availability Reports
Scope for customisation of the reports is limited, however you can change the templates (for other languages, for instance) and the logo. The safest way to do this would be to add a new report element in each file with a new, unique id:
database-reports.xml
<report id="newCalendarReport" display-name="new calendar report"
report-service="availabilityReportService" description="my new report in calendar format" />
availability-reports.xml
<report id="newCalendarReport"
type="calendar">
<logo>/Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/logo.gif</logo>
<svg-template>file:///Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/newSVGAvailReport.xsl</svg-template>
<pdf-template>file:///Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/newPDFAvailReport.xsl</pdf-template>
<html-template>file:///Users/user/git/opennms/target/opennms-1.7.10-SNAPSHOT/etc/reports/newHTMLAvailReport.xsl</html-template>
<parameters>
<string-parm name="reportCategory" display-name="report category" input-type="reportCategorySelector" />
<date-parm name="endDate" display-name="end date" use-absolute-date="false">
<default-interval>day</default-interval>
<default-count>1</default-count>
</parameters>
</report>
Note that you do not need to define all three template types. If you only define one or two, only those that you define will be available when rendering the reports. You do need to define at least one though.






