Time range for stat reports via CLI

Moderator: crythias

Post Reply
pvalser
OTRS newbie
Posts: 2
Joined: 06 Jan 2021, 13:20
OTRS 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: 2563
Joined: 18 Dec 2007, 12:23
OTRS Version?: Znuny LTS and 4/5/6
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 LTS and ((OTRS) Community Edition CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

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

Do you want to contribute or want to know why ?

skullz
OTRS wizard
Posts: 382
Joined: 24 Feb 2012, 03:58
OTRS Version?: OTRS 6
Real Name: Skullz
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
My Github
OTRS Quick Links
If you are lucky, i write it for you 8)

pvalser
OTRS newbie
Posts: 2
Joined: 06 Jan 2021, 13:20
OTRS 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