Administration of the stats module by the system administrator

Data base table
List of all files
Automated stat generation - Cronjob
Static stats
Using old static stats
Default stats

Generally, no system administrator is needed for the operation, configuration and maintenance of the statistics module. However, a little background information for the system administrator is given at this point.


File paths refer to subdirectories of the OTRS home directory (in most cases/opt/otrs).

Data base table

All report configurations are implemented and administrated in XML, and therefore stored in the database table "xml_storage". Other modules whose content is presented in xml format use this table as well.

List of all files

The following files are necessary for the stats module to work accurately:

  • Kernel/System/

  • Kernel/Modules/

  • Kernel/System/

  • Kernel/Output/HTML/Standard/AgentStatsOverview.dtl

  • Kernel/Output/HTML/Standard/AgentStatsDelete.dtl

  • Kernel/Output/HTML/Standard/AgentStatsEditSpecification.dtl

  • Kernel/Output/HTML/Standard/AgentStatsEditRestrictions.dtl

  • Kernel/Output/HTML/Standard/AgentStatsEditXaxis.dtl

  • Kernel/Output/HTML/Standard/AgentStatsEditValueSeries.dtl

  • Kernel/Output/HTML/Standard/AgentStatsImport.dtl

  • Kernel/Output/HTML/Standard/AgentStatsPrint.dtl

  • Kernel/Output/HTML/Standard/AgentStatsView.dtl

  • Kernel/System/Stats/Dynamic/

  • bin/


Whether the results of a statistic are to be cached or not can be setup in the configuration. Cached report results are stored as files in the var/tmpdirectory of the OTRS installation (in most cases /opt/otrs/var/tmp).

Cached stats can be recognized by the "Stats" prefix.

If the data is lost, no major damage is caused. The next time the report is called up, the stats module will not find the file any more and so will generate a new report. Of course this will probably take a little longer to run.

This file is saved in the bindirectory. It facilitates the generation of report in the command line.

As an example, see the command line call in Script 19.1.

bin> perl -n 10004 -o /output/dir

Script 19.1. Generating a report from the command line.

A report from the stat configuration "Stat# 10004" is generated and saved as csv in the /output/dir directory.

The generated report can also be sent as an e-mail. More information can be called up with the command in Script 19.2.

bin> perl --help

Script 19.2. Getting information about the file.

Automated stat generation - Cronjob

It usually does not make sense to generate reports manually via the command line, as the stats module has a convenient graphical user interface. However, generating reports manually does make sense when combined with a Cronjob.

Imagine the following scenario: On the first day of every month, the heads of department want to receive a report for the past month. By combining a cronjob and command line call the reports can be sent to them automatically by e-mail.

Static stats

The stats module facilitates the generation of static statistics. For every static stat a file exists in which its content is precisely defined.

This way, very complex stats can be generated. The disadvantage is that they are not particularly flexible.

The files are saved in the directory Kernel/System/Stats/Static/.

Using old static stats

Prior OTRS versions 1.3 and 2.0 already facilitated the generation of stats / reports. Various reports for OTRS versions 1.3 and 2.0 which have been specially developed to meet customers' requirements can be used in recent OTRS versions too.

The files must merely be moved from the Kernel/System/Stats/ path to Kernel/System/Stats/Static/. Additionally the package name of the respective script must be amended by "::Static".

The following example shows how the first path is amended.

    package Kernel::System::Stats::AccountedTime;

    package Kernel::System::Stats::Static::AccountedTime;

Default stats

"It is not always necessary to reinvent the wheel..."

The stats module provides various default reports. Reports which are of interest for all OTRS users will in future be added to the default reports set of the stats module package. Default reports are saved in the stats module xml format in thescripts/test/sample/ directory.