Customizing a Report
Some of the above standard reports can be modified to suit individual needs, such as excluding all SOFT errors from the Weekly Availability report. The following steps can be used to modify an existing report.
Note that if a report or sub-report is customized it should be saved under a new name - all standard reports are reset to default on an upgrade and many sub-reports are used in a number of other reports.
To customize a report, first find the report ‘jrxml’ under /opt/opsview/jasper/reports
on the server. Also, look for 'subreportExpression'
within the file to identify what sub reports (other jrxml files) are called. This will identify all the reports that need to be amended.
When all the required reports and subreports have been identified, copy them to your local machine for amending (the files are later uploaded back into Jasper via a web browser session). Rename each of the files as appropriate (e.g. by using the name suffix ‘Hard’):
cp -p WeeklyAvailability.jrxml WeeklyAvailabilityHard.jrxml
Edit each of the jrxml files and look for all the sub-report references (‘subreportExpression’) to rename each of those to use the same suffix.
Then, edit each of the jrxml files to amend the SQL queries as necessary. To have the report ignore soft errors, look for each of the following database table columns and amend as follows:
Soft error column names | Hard error only column names |
---|---|
seconds_not_ok | seconds_not_ok_hard |
seconds_warning | seconds_warning_hard |
seconds_critical | seconds_critical_hard |
seconds_unknown | seconds_unknown_hard |
This can be achieved by using the following Perl code:
perl -p -i -e 's/(seconds_not_ok|seconds_warning|seconds_critical|seconds_unknown (\W)/${1}_hard${2}/g' *.jrxml
When all the changes have been made, the modified report can be uploaded back into the Reports module (as an admin) by navigating to Reports then selecting Repository from the VIEW menu. Right click on Reports > Add Resource, and select JasperServer Report.
The name should be the main report filename without the jrxml, and the label should be the same but with spaces between words.
Field | Value |
---|---|
Name | WeeklyPerformanceByServiceHard |
Resource ID | WeeklyPerformanceByServiceHard |
Locate the jrxml file from your local filesystem and upload.
Now click on Controls & Resources on the left hand side. Here you first need to specify the sub-reports and then the input controls for the main report.
Add each sub-report like the example here
It should end up looking like this.
Now for the Input Controls. These are the fields required to run the report, he is a reminder of what this report requires to run.
Add each control, example seen here.
With all the sub-reports and control inputs.
Now click the Data Source on the left hand side. Here we would select the location of the data, normally ODW.
The Query and Customization are not changed in this example.
Click the Submit button and the report will be saved and you should now be able to run your report.