Developing your own reports

Using Centreon report templates

To make sure the reports you develop with BIRT are compatible with Centreon MBI, you must use the template provided by Merethis as a starting point. This template, called “generic_component_script.rpttemplate”, is stored in /usr/share/centreon-bi/Resources/templates (default template directory). Using this template is mandatory because it adds certain scripting to your report that is required for it to function on our platform.

To use this template in your BIRT report:

  • Download the file from the reporting server to the “Resources” folder of your BIRT project: /Resources/templates/generic_component_script.rpttemplate
  • Click right on the template and select “Register Template with New Report Wizard”.
../_images/registerTemplate.png
  • For each new report you create, select the name and click on Next to access the template window.
  • Select the template called “Component template” and click on “Finish”.
../_images/componentTemplate.png

Define the project structure

We highly recommand defining and applying standard conventions for:

  • Creating a directory tree for reports and resources.
  • Naming directories and files.
  • Naming components in BIRT libraries, templates and reports.

Naming and organizing files in a consistent and descriptive way will help you to maintain and update your projects.

The following information in this chapter discusses the standards defined by Centreon.

Reports (RPTDESIGN)

  • Each report is stored in a folder or subfolder of the main “reports” folder. The name of a folder should be defined according to the type of statistics processed in the report:
    • Capacity
    • Availability
    • Performance.
  • Reports whose parent folder is the main folder “reports” have been deprecated since Centreon MBI version 1.5.
  • All components of a report (e.g., layout, dataset) are imported from a BIRT library.
  • Each report must be created from a BIRT report template, which uses scripting to manage the multi-select parameters and Cascading Style Sheets (CSS).

Resources

The Centreon MBI shared resource directory (/Resources) contains four subdirectories:

  • /images: Contains images used in reports.
  • /templates: Contains the BIRT templates used as a starting point for any report.
  • /translations: Contains the localization (foreign language translation) files.
  • /components: Contains all the BIRT libraries (.rptlibrary) organized into subdirectories named meaningfully according to the reports (e.g., capacity, performance).

Libraries

Some libraries are stored directly under the “/components” directory, without any classification into subdirectories. These libraries contains components that may be reused in other libraries but also in reports:

  • /datasources: Contains all the datasources that will be used for the entire report project. Avoid defining datasources in multiple files in order to simplify the maintenance of your project (in case you change development or production environments).
  • /parameters: Contains all the report parameters that will be required in the reports.
  • /masterpages: Stores the different masters (headers and footers) that will be reused in the reports.

The potentially large number of components in the libraries can make navigating for a specific component complicated. To simplify the way components are organized, ask yourself the following questions:

  • What kind of statistic are you looking for?
    • Capacity? Performance? Availability? Open the subfolder named according to your requirement.
  • For what type of object do you need when designing your report?
    • A host? A single host group? Several host groups? You will find this information in the descriptive name of the ”.rptlibrary” file.
  • Do you require a data set? With what kind of parameters?
    • All the data sets are listed in the “Data explorer” panel.
    • The name of each data set is prefixed by a code. Each digit in this code signifies an object (e.g., hostgroup, host, service category, host category, metric, timeperiod) and can vary from 0 to 2:
      • 0: The object is not used as a parameter.
      • 1: A single value is expected.
      • 2: A list of multiple values is expected.
  • Do you require a graphical component? With which parameters?
    • All graphical components are listed in the “Outline” panel in the menu “Report Items”.
    • The name of each component is prefixed by a code using the same naming convention as the data set (see above).
    • The name of the component is suffixed with the component type (e.g., graph, text, table)

Warning

Do NOT modify any of the original standard report templates or libraries.