Time range for stat reports via CLI

Moderator: crythias

Post Reply
pvalser
Znuny newbie
Posts: 2
Joined: 06 Jan 2021, 13:20
Znuny Version: 6.0.30
Real Name: Pierre Valser

Time range for stat reports via CLI

Post by pvalser »

Greetings

We have some statistics configured in our OTRS 6.0.30 installation and exporting them via web ui works as intended.

Now we would like to create a task to export and mail these statistics monthly and I discovered, that it can be done via CLI and a cronjob. The following command almost produces the desired result:

Code: Select all

otrs/bin/otrs.Console.pl Maint::Stats::Generate --number 10014 --format Excel --timezone 'Europe/Zurich' --language de --target-filename 10014_queue_stats --mail-recipient someone@example.com --mail-sender 'OTRS Stats <otrs-stats-noreply@example.com' --quiet
The only issue left is the selected time range for the exported data. Right now, all tickets until today's date are included in the statistics, but we're only interested in last month's data.

Apparently some parameters can be passed to the statistic via the "--params" CLI flag, but I could not figure out how to do this correctly to set the correct timeframe.

Any help would be appreciated :)
root
Administrator
Posts: 3966
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Time range for stat reports via CLI

Post by root »

Hi,

I recommend using relative time periods. If you configure last month and run the report on the 1st of January you get the data from December.And then you don't need any parameter.

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
skullz
Znuny superhero
Posts: 624
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: Time range for stat reports via CLI

Post by skullz »

Param \ filtering only available for Static stats..
For dynamic stats, you wont be able to use the param value..it will be based on default selected value or all value.

As per root stated, you want to change the default filter
pvalser
Znuny newbie
Posts: 2
Joined: 06 Jan 2021, 13:20
Znuny Version: 6.0.30
Real Name: Pierre Valser

Re: Time range for stat reports via CLI

Post by pvalser »

Hi everyone

Nice! I managed to get working.

Thank you very much for the swift responses and have a nice day :)
Post Reply