[% SET message = l.message.substr(13) %]
[% SET has_type = 1 %]
[% SET type = 'INFO' %]
[% SET info = "" %]

[%    IF l.type == 'CURRENT SERVICE STATE'        %][% SET pic = "info.png"          desc = "Informational Message" %]
[% ELSIF l.type == 'CURRENT HOST STATE'           %][% SET pic = "info.png"          desc = "Informational Message" %]
[% ELSIF l.type == 'SERVICE NOTIFICATION'         %][% SET pic = "notify.gif"        desc = "Service Notification" %]
[% ELSIF l.type == 'HOST NOTIFICATION'            %][% SET pic = "notify.gif"        desc = "Host Notification" %]
[% ELSIF l.type == 'SERVICE ALERT'                %]
                            [%    IF l.state == 0 %][% SET pic = "recovery.png"      desc = "Service Ok" %]
                            [% ELSIF l.state == 1 %][% SET pic = "warning.png"       desc = "Service Warning" %]
                            [% ELSIF l.state == 2 %][% SET pic = "critical.png"      desc = "Service Critical" %]
                            [% ELSIF l.state == 3 %][% SET pic = "unknown.png"       desc = "Service Unknown" %]
                            [% END %]
[% ELSIF l.type == 'HOST ALERT'                   %]
                            [%    IF l.state == 0 %][% SET pic = "recovery.png"      desc = "Host Up" %]
                            [% ELSIF l.state == 1 %][% SET pic = "critical.png"      desc = "Host Down" %]
                            [% ELSIF l.state == 2 %][% SET pic = "critical.png"      desc = "Host Unreachable" %]
                            [% END %]
[% ELSIF l.type == 'SERVICE EVENT HANDLER'        %][% SET pic = "serviceevent.gif"  desc = "Service Event Handler" %]
[% ELSIF l.type == 'HOST EVENT HANDLER'           %][% SET pic = "hostevent.gif"     desc = "Host Event Handler" %]
[% ELSIF l.type == 'EXTERNAL COMMAND'             %][% SET pic = "command.png"       desc = "External Command" %]
[% ELSIF l.type == 'PASSIVE SERVICE CHECK'        %][% SET pic = "passiveonly.gif"   desc = "Passive Service Check" %]
[% ELSIF l.type == 'PASSIVE HOST CHECK'           %][% SET pic = "passiveonly.gif"   desc = "Passive Host Check" %]

[% ELSIF l.type == 'SERVICE FLAPPING ALERT'       %]
          [%    IF l.message.match(';STARTED;')   %][% SET pic = "flapping.gif"      desc = "Service started flapping" %]
          [% ELSIF l.message.match(';STOPPED;')   %][% SET pic = "flapping.gif"      desc = "Service stoppedflapping" %]
          [% ELSIF l.message.match(';DISABLED;')  %][% SET pic = "flapping.gif"      desc = "Service flap detection disabled" %]
          [% END %]
[% ELSIF l.type == 'HOST FLAPPING ALERT'          %]
          [%    IF l.message.match(';STARTED;')   %][% SET pic = "flapping.gif"      desc = "Host started flapping" %]
          [% ELSIF l.message.match(';STOPPED;')   %][% SET pic = "flapping.gif"      desc = "Host stoppedflapping" %]
          [% ELSIF l.message.match(';DISABLED;')  %][% SET pic = "flapping.gif"      desc = "Host flap detection disabled" %]
          [% END %]
[% ELSIF l.type == 'SERVICE DOWNTIME ALERT'       %]
         [%    IF l.message.match(';STARTED;')    %][% SET pic = "downtime.gif"      desc = "Service entered a period of scheduled downtime" %][% SET info = "STARTED" %]
         [% ELSIF l.message.match(';STOPPED;')    %][% SET pic = "downtime.gif"      desc = "Service exited a period of scheduled downtime" %][% SET info = "STOPPED" %]
         [% ELSIF l.message.match(';CANCELLED;')  %][% SET pic = "downtime.gif"      desc = "Service scheduled downtime has been cancelled" %][% SET info = "CANCELLED" %]
         [% END %]
[% ELSIF l.type == 'HOST DOWNTIME ALERT'          %]
         [%    IF l.message.match(';STARTED;')    %][% SET pic = "downtime.gif"      desc = "Host entered a period of scheduled downtime" %][% SET info = "STARTED" %]
         [% ELSIF l.message.match(';STOPPED;')    %][% SET pic = "downtime.gif"      desc = "Host exited a period of scheduled downtime" %][% SET info = "STOPPED" %]
         [% ELSIF l.message.match(';CANCELLED;')  %][% SET pic = "downtime.gif"      desc = "Host scheduled downtime has been cancelled" %][% SET info = "CANCELLED" %]
         [% END %]
[% ELSIF l.type == 'LOG ROTATION'                 %][% SET pic = "logrotate.png"     desc = "Log Rotation" %]
[% ELSIF l.type.match('TIMEPERIOD TRANSITION')    %][% SET pic = "info.png"          desc = "Timeperiod Transition" %][% SET has_type = 0 %][% SET type = 'TIMEPERIOD TRANSITION' %]
[% ELSIF l.type.match('restarting\.\.\.')         %][% SET pic = "restart.gif"       desc = "Program Restart" %][% SET has_type = 0 %][% SET type = 'RESTART' %]
[% ELSIF l.type.match('starting\.\.\.')           %][% SET pic = "start.gif"         desc = "Program Start" %][% SET has_type = 0 %][% SET type = 'START' %]
[% ELSIF l.type.match('shutting down\.\.\.')      %][% SET pic = "stop.gif"          desc = "Program End" %][% SET has_type = 0 %][% SET type = 'SHUTDOWN' %]
[% ELSIF l.type.match('Bailing\ out')             %][% SET pic = "stop.gif"          desc = "Program End" %][% SET has_type = 0 %][% SET type = 'SHUTDOWN' %]
[% ELSIF l.type.match('active mode\.\.\.')        %][% SET pic = "active.gif"        desc = "Active Mode" %][% SET has_type = 0 %]
[% ELSIF l.type.match('standby mode\.\.\.')       %][% SET pic = "standby.gif"       desc = "Standby Mode" %][% SET has_type = 0 %]
[% ELSE                                           %][% SET pic = "info.png"          desc = "Informational Message" %][% SET has_type = 0 %]
[% END %]
