Statistic tickets created and closed today

Moderator: crythias

Locked
stevros
Znuny newbie
Posts: 8
Joined: 24 Sep 2014, 10:08
Znuny Version: 3.3.9

Statistic tickets created and closed today

Post by stevros »

Hi All,
I want to create a chart showing daily, the number of tickets created and closed.

The idea is something like this

Thanks
You do not have the required permissions to view the files attached to this post.
Eggllo
Znuny newbie
Posts: 79
Joined: 09 Jun 2016, 14:27
Znuny Version: 5.0.10

Re: Statistic tickets created and closed today

Post by Eggllo »

From what I can tell, there isn't really an easy way to do this using the stats module in OTRS. There is however a way to work around it, even if it is a bit messy.

I was able to create a multi select dynamic field for every ticket with 3 options, Closed, Created and Old. The theory here being that a ticket that was created today has created selected, closed today would have closed selected, and since it it multi select, tickets that were both created and closed today would have both attributes selected.

From here you can create some generic agent jobs to monitor tickets to whatever accuracy you want, I chose to run the jobs every hour since that seems accurate enough. You can have a job to search for tickets created within the last 24 hours, another for tickets closed within the last 24 hours, one for tickets that have a closed state, but were also created within the last 24 hours. Just have these jobs select the appropriate values in the dynamic field.

The key thing that I found was that if you want to keep these stats accurate, you should run each of these jobs every 01 minute of each hour, and run a final job every 00 minute of each hour (one minute before you run the others) that is used to reset each ticket to have none of the options selected. This way all old tickets would be neither created or closed today, and all new ones would get set to create/closed only a minute later.

From here you can create a graph using the stats module and your new dynamic field.

I realize this is a pretty bad solution, and that it's quite finicky, but with my limited experience it's the best I could come up with. I'm sure there might be some better way to do it if you were good with coding and/or generic agents.

Eggllo
OTRS v5.0.10 with ITSM extension.
MySQL database
Ubuntu 16.04 LTS
Locked