Administration of the stats module by the system administrator

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

Note

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

Data base table

All stat configurations are implemented and administrated in XML. Therefore all stats configurations are 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/Stats.pm

  • Kernel/Modules/AgentStats.pm

  • Kernel/System/CSV.pm

  • 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/Ticket.pm

  • bin/mkStats.pl

Caching

Whether the results of a stat are to be cached or not can be defined in the pre-configuration. Cached stat 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 stat is called up the stats module will not find the file any more and thus will generate a new stat which will probably take a little longer.

mkStats.pl

This file is saved in the bin/directory. It facilitates the generation of stats in the command line.

The following command line call is exemplary:

bin> perl mkStats.pl -n 10004 -o /output/dir

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

The generated stat can also be sent as an e-mail. More information can be called up with the following call

bin> perl mkStats.pl --help

Automated stat generation - Cron

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

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

Static stats

The stats module facilitates the generation of static stats. For every static stat a file exists in which the stat 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 following directory Kernel/System/Stats/Static/.

Using old static stats

Standard OTRS versions 1.3 and 2.0 already facilitated the generation of stats. Various stats for OTRS versions 1.3 and 2.0 which have been specially developed to meet customers' requirements can be used in more recent 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 stats. Stats which are interesting for all OTRS users will in future be added to the default stats of the stats module package. Default stats are saved in the stats module xml format in thescripts/test/sample/ directory.