Develop your own reports

Use Centreon report template

To ensure the compatibility of report developped on BIRT with Centreon MBI, you have to start all your new report from a template provided by Merethis. This template is called generic_component_script.rpttemplate and stored in “/usr/share/centreon-bi/Resources/templates” (by default). This template add some mandatory scripting to your report.

To be able to use that template in your BIRT, you have to:

  • Download the file on the reporting server and put it in the Resources folder of your BIRT project to have : “/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 that you create, choose the name and click Next to access the template windows.
  • Select the template called “Component template” and click “Finish”
../_images/componentTemplate.png

Define the project structure

It’s highly recommanded to define and use standards for:

  • directory tree of reports and resources
  • naming directories and files
  • naming components in BIRT libraries, templates and reports

Without this kind of rules, the scalability of your project will be compromised

The next points in this chapter discuss the standards defined by Centreon.

You report can ready to be developed, and will be compatible with Centreon MBI.

Reports (RPTDESIGN)

  • Each report is stored in a directory or sub-directory of the main folder “reports”. The names of the directory are defined according to the type of statistics presented in the report: * Capacity * Availability * Performance ...
  • Every report which parent folder is the main folder “reports” are deprecated
  • Each component of a report (layout component, dataset, etc...) comes from a BIRT library. The report is just integrating and customizing the components imported from different libraries
  • Each report is created from a BIRT report template. This template allows the usage of scripting to manage the multi-select parameters and the CSS management.

Resources

The Centreon MBI resources location contains 4 folders:

  • Images: contains images may in the reports
  • Templates: contains the BIRT template used to start the development of any report
  • Translations: contains the localization properties files. These files will be used to translate a single report into different languages
  • Components: contains all the BIRT libraries organized into sub-folders in the same logic than the reports

Libraries

There are libraries stored directly in the folder “components”, without any classification into sub-folders. These libraries contains components that will be re-used in other libraries but also in reports:

  • Data sources library: this library contains all the data-sources that will be used in the entire report project. Avoid the definition of data-sources in several files. The maintenance of your project will be complex each time you change your development or production environment;
  • Parameters library: this library will contain all the report parameters that will be needed
  • Master pages library: stores the different master that will be re-used in reports.

As there are many layout components created in the different libraries, it can be difficult to navigate in the different files to find a specific component. To facilitate the search, you must follow this method:

  • What kind of statistic are you looking for?
    • Capacity? Performance? Availability? Open the sub-folder of “components” according to your need.
  • What type of object do you want to report?
    • Host? A single host group? Several host groups? You will find this information in the name of the ”.rptlibrary” file.
  • Do you need a data set? With what kind of parameters?
    • All the data set are listed in the panel “Data Explorer”
    • The name of each data set starts with a code. Each digit of this code concerns an object (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 of the object is used as parameter
      • 2 : Multiple values of the object are used as parameter.
  • Do you need a graphical component? With what kind of parameters?
    • All the components are listed in the panel “Outline” in the menu “Report Items”
    • The name of each component starts with a code using the same naming rule than the data set.
    • The name of the component is suffixed with the type of the component: Graph, Text, Table, etc...

Warning

NO modifications should be made to standard reports and libraries.