Send reports (stats) automatically

Moderator: crythias

Post Reply
bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Send reports (stats) automatically

Post by bmichelot »

Hi all,
I just want to know if there is way of working for periodically generate stat report and send it to a specific email address.
It's like reporting to a manager who are not able to access to the OTRS interface.
I was thinking that generic agent could done the job, but it seems to work only with tickets... no stats.
Thanks in advance for your reply.
Regards
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Send reports (stats) automatically

Post by reneeb »

Create a cronjob that calls

$HOME/bin/otrs.GenerateStats.pl -n 10020 -f CSV -r 123@domain.com -r 123@domain.com -m "Weekly Open Ticket Report" -F WeeklyOpen

(you have to change the values of course ;-) )
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Re: Send reports (stats) automatically

Post by bmichelot »

Thanks a lot for you help.
Regards,
bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Re: Send reports (stats) automatically

Post by bmichelot »

Hi reneeb,
I tried the solution your propose without success.
SO, to resume and to be sure that I did not make a mistake.
I create a cron job using GenericAgent.
I used the "Ticket Commands" function and fulfilled the field CMD as follow :

Code: Select all

$HOME/bin/otrs.GenerateStats.pl -n 10020 -f CSV -r 123@domain.com -r 123@domain.com -m "Weekly Open Ticket Report" -F WeeklyOpen
-n : been replaced by the number 10014 which corresponds to my stats
-f : been kept as I want to choose the CSV output format (according to my stat options)
-r : been replaced by my personal email address
-m : no change, but should correspond to the "subject" of the email
-F : filename of the CSV file
Is this true?
Thanks in advance for the help provided.
Regards,
bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Re: Send reports (stats) automatically

Post by bmichelot »

I was impatient a little... it works... more than expected.
I planed to be send the stats every hour (to test the code), and I received 45 emails for one execution...
I have to investigate a little bit, to tune it better !
Regards,
bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Re: Send reports (stats) automatically

Post by bmichelot »

I understood that the action is done as many as the number of tickets affected by the cron job.
Is this true?
How can I tune the cron job to do one sending only?
Thanks in advance for the help provided.
Regards,
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Send reports (stats) automatically

Post by reneeb »

Can you show us what you have added in the crontab?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Re: Send reports (stats) automatically

Post by bmichelot »

It will be a little bit difficult to paste an image of the settings due to the length of the parameters page.
Ticket filter :
  • Queue filed : 2 items selected which contains 23 tickets
Ticket Commands :
  • Send agent/customer : No
  • CMD : $HOME/bin/otrs.GenerateStats.pl -n 10014 -f CSV -r myemail@mydomain.com -m "Envoi automatique de la stat 10014" -F Stat_10014
  • Delete tickets : No
With those parameters, I received 23 email which corresponds to the number of tickets...
If I do not specify the filtering parameters, I got an error as follow :

Code: Select all

Backend ERROR: OTRS-CGI-10 Perl: 5.8.8 OS: linux Time: Mon Aug 26 16:17:50 2013 Message: Attention: Can't run GenericAgent Job 'Envoi Périodique Stats' because no search attributes are used!. RemoteAddress: 192.168.12.46 RequestURI: /otrs/index.pl?Action=AdminGenericAgent;Subaction=RunNow;Profile=Envoi%20P%C3%A9riodique%20Stats;ChallengeToken=1551925c7b6eaaa1be337ea4832f0c7a; Traceback (9681): Module: Kernel::System::GenericAgent::JobRun (v1.86) Line: 437 Module: Kernel::Modules::AdminGenericAgent::Run (v1.108) Line: 87 Module: Kernel::System::Web::InterfaceAgent::Run (v1.73) Line: 864 Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler (unknown version) Line: 44 Module: (eval) (v1.94) Line: 204 Module: ModPerl::RegistryCooker::run (v1.94) Line: 204 Module: ModPerl::RegistryCooker::default_handler (v1.94) Line: 170 Module: ModPerl::Registry::handler (v1.99) Line: 31
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Send reports (stats) automatically

Post by jojo »

don't create GenericAgents! Create a new Cron job for this
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Re: Send reports (stats) automatically

Post by bmichelot »

I was thinking that cron jobs was similar to GenericAgent.
How can I do a cron job?
Is "cron job" a script located in the home directory of the 'otrs' user?
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Send reports (stats) automatically

Post by jojo »

man cron
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
jfberni
Znuny newbie
Posts: 17
Joined: 03 Mar 2011, 16:51
Znuny Version: 3.0

Re: Send reports (stats) automatically

Post by jfberni »

Jojo : Can you give an example how to used Static stat with GenerateStat.pl ?
kalyana1315
Znuny expert
Posts: 171
Joined: 24 Apr 2013, 12:29
Znuny Version: OTRS3.3
Real Name: kalyanachakravarthy M P
Company: TATA Technologies
Location: Pune,India
Contact:

Re: Send reports (stats) automatically

Post by kalyana1315 »

bmichelot
Znuny newbie
Posts: 88
Joined: 31 Jul 2013, 16:52
Znuny Version: 5.0.20
Real Name: Benoît MICHELOT
Company: Amphenol Air LB France
Contact:

Re: Send reports (stats) automatically

Post by bmichelot »

Hi all,
As I am not able to access to OTRS repertories and I would like to keep to ability to manage easily the automatic sending of report, I use the genericAgent filtered on a "ghost" ticket, which allow me to send only one report.
So, like said previously, I do not have the access the OTRS repertories, and I am not able to get the GenerateStats.pl --help function.
Could you please paste the list of parameter which can be used to?
I have to parameter another scheduled report sending in a pdf output.
Waiting an answer from my IT department will take a long time.
Regards,
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Send reports (stats) automatically

Post by reneeb »

Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
tdtmusic
Znuny newbie
Posts: 1
Joined: 20 Jul 2017, 14:23
Znuny Version: 5.0.21

Re: Send reports (stats) automatically

Post by tdtmusic »

Hello. Sorry to revive an old thread but I recently tried to set up automatic report sending in OTRS and I followed the instructions on this page. It worked fine, but I do have some questions, maybe some of you can help me. So:
- is it possible to set up the email message (the one after -m parameter) with line breaks somehow? Having only one continuous line is kind of ugly :)
- is it possible to have some sort of signature to the email? Like an image or logo;
- I've noticed that the sender of the email is the otrs default email account, but if I use the -s parameter I can use another address, right? If so, how is the authentication being done? I tried to use another address from the same domain but I got an auth error.

That's all, thank you!
Post Reply