Ad Widget

Collapse

email integration with request tracker (ticketing)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fjrial
    Senior Member
    • Feb 2010
    • 140

    #1

    email integration with request tracker (ticketing)

    Hi:

    It's possible that, on an alert, justs before zabbix sends the email, it checks in another application (Request Tracker (RT) is ours, but could be different one) if there is an opened ticket for the alert mentioned??

    Would you think it would be hard to develop??

    I'm looking into this, modifying source code in zabbix_server.. and what I found is that the main file of the alarm process is
    alerter.c
    Code:
    if (MEDIA_TYPE_EMAIL == mediatype->type)
            {
                    alarm(40);
                    res = send_email(mediatype->smtp_server, mediatype->smtp_helo, mediatype->smtp_email,
                                    alert->sendto, alert->subject, alert->message, error, max_error_len);
                    alarm(0);
            }
    I thinks this is the right place to start, isn't it??

    Thanks for any help.
  • fjrial
    Senior Member
    • Feb 2010
    • 140

    #2
    Looking further into the C code I found that
    zabbix_server/actions.c (zabbix 1.8.3)

    is a much better place to me to do this.

    In line 361:
    Code:
    else if (condition->conditiontype == CONDITION_TYPE_EVENT_ACKNOWLEDGED)
    It checks for the conditions "Event acknowledged = "Not Ack""
    I'll make a new "else if" check in order to search in RT before sending mail.

    Comment

    • fjrial
      Senior Member
      • Feb 2010
      • 140

      #3
      Done!..

      Attached patch allows you to stop executing the actions belonging to an action with a specified name (TICKET RT in my case). It will performs a mysql query to another host, (our request tracker (RT)) and if there is a ticket opened/new for that hostname, the actions will not be processed.. if there isn't a ticket open, it will execute actions (which basically are, sending an email to RT in order to create the ticket).

      Patch for zabbix server v 1.8.3

      Credit goes to James Wells for doing the function DBget_item_id_by_triggerid:
      Attached Files
      Last edited by fjrial; 09-09-2010, 09:54. Reason: added credits to James Wells

      Comment

      • DSon
        Member
        • Sep 2009
        • 44

        #4
        Excellent idea



        At first I thought it was unnecessary due to Trigger Dependecies, however I can see a situation where a trigger has already fired, meaning an Action condition would be the only way to prevent a trigger continually firing (other than using an Acknowledgement, which requires manual intervention, of course).

        .. this would be great if it were integrated into a future version of the main Zabbix build.

        Danny.

        Comment

        • tserreyn
          Junior Member
          • Jun 2012
          • 26

          #5
          any update on this for 2.04?

          Now that we are running 2.04 I would like to integrate my existing RT ticket system. Has anyone done any integration with zabbix and RT under 2.04?

          Comment

          • fjrial
            Senior Member
            • Feb 2010
            • 140

            #6
            yes

            Hi:

            After my first approach on RT integration, which involves making changes to zabbix_server, I developed a second approach that should work with zabbix 2 and whatever.. (in fact I´m migrating my zabbix installation from 1.8.2 to 2.0.4, but didn´t have the time to test this)

            This time, it´s a shell script which is run as "external-command" by an action.

            This script performs a query to rt database in order to check for open tickets for that host.

            If there is one ticket open, shell script does nothing (it could do some task, like update ticket, etc.. , but We (at CESGA) want this behaviour (do nothing))

            If there isn´t any ticket open for that host, it creates one ticket with prefilled custom fields and fields.

            Tomorrow in the morning I will post the script (now, I´m at home)

            Cheers

            Comment

            • fjrial
              Senior Member
              • Feb 2010
              • 140

              #7
              script for creating a ticket in RT

              Hi.

              The script as I promised.
              GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.


              If you have any problems, let me know.

              Cheers and hope it helps you.

              Comment

              • Colttt
                Senior Member
                Zabbix Certified Specialist
                • Mar 2009
                • 878

                #8
                the most ticketsystems (ie OTRS) you can send a mail to this, and otrs create a ticket.. when zabbix send a new mail with OK, otrs close the ticket, or when zabbix send a new mail with the same host, otrs can check if exist a ticket for this host and if yes, dont create a new one..
                Debian-User

                Sorry for my bad english

                Comment

                • fjrial
                  Senior Member
                  • Feb 2010
                  • 140

                  #9
                  understook

                  Originally posted by Shad0w
                  the most ticketsystems (ie OTRS) you can send a mail to this, and otrs create a ticket.. when zabbix send a new mail with OK, otrs close the ticket, or when zabbix send a new mail with the same host, otrs can check if exist a ticket for this host and if yes, dont create a new one..
                  that's exactly what the script does..

                  I setup an action on PROBLEM condition to execute this script. It checks if exists a ticket, if not, create one.

                  I didn´t setup a recovery action, let me explain,

                  A ticket in our RT does not get solved until a technician "takes it" and post what happened and why.. that is the reason why this script does not automatically close tickets. It has to be a human

                  Edit: this also prevents creating/closing tickets for a trigger that gets fired too much in a short period of time and being notified by RT for those created/updated/closed tickets.

                  Cheers
                  Last edited by fjrial; 24-01-2013, 12:14. Reason: adding more info

                  Comment

                  Working...