Escalation Notification Solution

English! place to talk about development, programming and coding
Post Reply
stefanp2
Znuny newbie
Posts: 1
Joined: 08 Jun 2011, 09:02
Znuny Version: 3.0.8
Real Name: Stefan
Company: Romsys

Escalation Notification Solution

Post by stefanp2 »

I searched a lot on this forum and I would like to share my version of escalation notification.
First of all, you need to have a working version of cron
For windows, that is a working cronw. This means that the c:\Program Files\OTRS\OTRS\bin\otrs.Cron4Win32.pl should run to convert unix based cron config files (located in C:\Program Files\OTRS\OTRS\var\cron) to windows based cronw config file (c:\Program Files\OTRS\CRONw\crontab.txt). Unfortunately, the default otrs.Cron4win32.pl file that comes with otrs3.0.8 is not working correctly. I have attatched a working file, taken from otrs3.0.4 source code.
Also, for windows, the apache server is always crashing. The only solution I found was this one: http://forums.otrs.org/viewtopic.php?f= ... 81&p=35537

Now, on to notifications:
You need the generic agent for this, and here is the logic.
I run the generic agent at 10 minutes interval. It will then check if any tickets had their Escalation Time (any of them or one in particular) in those last 10 minutes. If it did, I will attach a note to the ticket saying that the escalation point was reached. (You can also move it to another queue or change it's priority and so on).
For a second escalation I run the generic agent again every 10 minutes. I will check which tickets had their escalation time between 60 and 70 minutes ago. This way I will catch tickets that escalated more than 1 hour ago (but not more than 1 hour and 10 minutes) and will atatch another note to them.
If I need more escalation levels I can play with more 10 minutes intervals: 120 to 130 (2 hours), 180 to 190 (3 hours), and so on.

In order to do this I add this code to the GenericAgent.pm file (\OTRS\Kernel\Config\GenericAgent.pm)

Code: Select all

'send L1 escalation notifications' => {
# ticket escalation time of between 0 and 10 minutes ago 
TicketEscalationTimeOlderMinutes => 0,
TicketEscalationTimeNewerMinutes => 10,
# new ticket properties
New => {
            Note => {
                From => 'helpdesk@example.com',
                Subject => 'Escalation!',
                Body => 'This ticket escalation counter  was reached',
                ArticleType => 'note-internal', # note-internal|note-external|note-report
            },
        },
'send L2 escalation notifications' => {
# ticket escalation time of between 0 and 10 minutes ago 
TicketEscalationTimeOlderMinutes => 60,
TicketEscalationTimeNewerMinutes => 70,
# new ticket properties
New => {
            Note => {
                From => 'helpdesk@example.com',
                Subject => 'Escalation!',
                Body => 'This ticket escalation counter  was reached',
                ArticleType => 'note-internal', # note-internal|note-external|note-report
            },
        },
Of course, you can filter the tickets that escalate based on more information, like the SLA, the Queue, Priority, etc. Just add those values After the TicketEscalationTimeXXXXXMinutes filter.
This cannot be done in the web version of the Generic Agent because you can only search for Tickets that escalated before or after a certain point in time. You cannot search just in 10 minutes intevals.

The last thing is the Notification before escalation.
This is run also at ten minutes intervals and otrs will measure what procent of time passed relative to the total escalation time. As soon as this procent is higher than the one you set in your SLA or Queue, the notification will be sent. To prevent multiple notifications (once you pass the threshold the procent will always be bigger than the one you set), the notification script will verify if a notification has already been sent in the ticket history. If no notification was found, it will send the notification.
To do this I had to create a new Generic Agent Module that sends only "before notifications". Also, by default the notifications are sent only if you are in working hours. In my version, notifications are sent if you are in working hours of the SLA (if using different calendars). You will have to place the attached file (WarnAgentGroupWithWritePermission.pm) in \OTRS\Kernel\System\GenericAgent\. This script can be definetly made better. It is just a workaround. In fact I never worked with perl until one week ago when I stumbled upon otrs :)
Now add this code to GenercAgent.pm:

Code: Select all

'send escalation warning' => {
    Escalation => 1,
    New => {
        Module => 'Kernel::System::GenericAgent::WarnAgentGroupWithWritePermission',
    },
},
Actually, Escalation => 1 only means tickets that have an escalation time set. Nothing more. The script will then check the procent of the escalation time that has elapsed and will only send notifications for those tickets that are above the threshold.

Hope this helps somebody. OTRS is great :)
You do not have the required permissions to view the files attached to this post.
Bucko77
Znuny newbie
Posts: 31
Joined: 29 Jun 2011, 16:02
Znuny Version: 3.0.8
Real Name: Stephen Buckton
Company: Kite Packaging

Re: Escalation Notification Solution

Post by Bucko77 »

Thank you very much for this very helpful post. It helped fix an outstanding fetch mail issue I had after upgrading to OTRS 3.0.9.

Stephen.
OTRS 3.0.9 & ITSM 3.0.4 running on Windows Server 2008 R2 with MySQL database, iPhonehandle 1.0.3, Active Directory LDAP integration.
HeY
Znuny newbie
Posts: 10
Joined: 21 Mar 2011, 18:26
Znuny Version: 3.0.5

Re: Escalation Notification Solution

Post by HeY »

Thanks for the post, I understand what you are writing but I see a problem with that configuration.

TicketEscalationTimeOlderMinutes => 0,
TicketEscalationTimeNewerMinutes => 10,

If becuase of some odd reason your cronjob did not runs once, this action is never triggered. I am a bit afraid that this might happen and my ticket does never escalate. I though that if I just set:

TicketEscalationTimeOlderMinutes => 0,

then the action is done on each ticket that expired (it doesnt matter how long ago) but it it not really working correctly like this. Did I understand it correctly?

Thanks
Kolja
HeY
Znuny newbie
Posts: 10
Joined: 21 Mar 2011, 18:26
Znuny Version: 3.0.5

Re: Escalation Notification Solution

Post by HeY »

I think there is a "problem" in OTRS

for testing purposes I have set the escalation times to very short periods (3 minutes) for each of these queues:
q1, q2, q3, ...

And my generic agent is set to the following filter:
TicketEscalationTimeOlderMinutes => 0,
TicketEscalationTimeNewerMinutes => 60,

My cronjob (genericagent) runs every 5 minutes. After escaltion I move the ticket from q1 to q2 and then from q2 to q3 ....

For each queue I have setup a notification email event. What happens now druing testing that q4 is completely skipped (also the notification event here) but the notification event of q5 is fired for each of the skipped queues. So if it skipped 3 queues for example (and the notification event) the notificaion of q5 is sent 3 times.

Is this somehow a bug? Or am I missunderstanding something?

I am running OTRS 3.0.9 on SLES 11
SantaPe
Znuny newbie
Posts: 53
Joined: 13 Mar 2013, 18:02
Znuny Version: 3.2.2

Re: Escalation Notification Solution

Post by SantaPe »

Does anyone know if all of the above has been solved in OTRS 3.2.2 ?

I am running OTRS on windows and I have problems to make CRON work... We are not getting the correct email notifications.
OTRS 3.2 - Windows Server 2008R2 - mysql
Post Reply