Sign in to follow this  
Chris Seiber

Basic Zendesk Integration

Recommended Posts

The following guide is an example of a custom http integration using the Zendesk API along with some of LogicMonitor's token values. 


To start off I would recommend reviewing the following resources. 

LogicMonitor Custom HTTP Delivery Documentation:
https://www.logicmonitor.com/support/settings/integrations/custom-http-delivery/

LogicMonitor Tokens: NOTE: (In this guide I create a token ##zendesk.authorid## using a custom property on the device. This allows me to pass this value through the integration. This can be very useful if you need to use the same integration to create tickets as multiple organizations or users. I've included a screenshot below detailing where this is set on the device.)
https://www.logicmonitor.com/support/settings/logicmodules/tokens-available-in-datasource-alert-messages/

h43UZPW.png

Zendesk API Documentation:
https://developer.zendesk.com/rest_api/docs/core/introduction

Complete these steps in Zendesk prior to creating your integration:

Create a Zendesk User to be used for authentication. 
https://support.zendesk.com/hc/en-us/articles/203661986-Adding-agents-and-administrators

In the below payloads I use the Zendesk author_id as a token to create, update and close tickets. You can find the author_id for a Zendesk user by checking the following. 

b8yrSTn.png

 

Configure your Zendesk API key for authentication.
https://support.zendesk.com/hc/en-us/articles/226022787-Generating-a-new-API-token-

Complete these steps in LogicMonitor to create the Integration:

  • Add a new Custom HTTP Delivery under Integrations using the following payloads as a starting point.
  • Determine if you would like to use a wildcard for things such as your Zendesk author_id or organization_id etc.

Payload Examples:

The following examples will Create, Update and Close ZenDesk tickets with LogicMonitor Alerts.

NOTE: When authenticating with the Zendesk api, you will only need to enter your api key in the password field and your username with /token at the end. 

TDTI4MG.png

 

Active: 

{
  "ticket": {
    "subject":  "##LEVEL## - ##HOST## ##INSTANCE##", "type": "incident",
    "comment":  { "body": "Host: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##"},
    "priority": "normal"
  }
}

nO5wszk.png

 

Escalated:

{
  "ticket": {
    "subject":  "##LEVEL## - ##HOST## ##INSTANCE##", "type": "incident",
    "comment":  { "body": "Alert Escalated/De-escalated:\nHost: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##"},
    "priority": "normal"
  }
}

kpEwqzB.png

 

Acknowledged:

{"ticket": {"status": "open", "comment": { "body": "##MESSAGE##", "author_id": ##zendesk.authorid## }}}

33EI2Hr.png

Cleared: 

{
  "ticket": {
    "subject":  "##LEVEL## - ##HOST## ##INSTANCE##", "type": "incident",
    "comment":  { "body": "Alert Cleared:\nHost: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##"},
    "status": "solved","priority": "normal"
  }
}

uc8TbDB.png

 

 

Here we can see the finished product, a ticket generated and cleared using the above payloads. 

w4yAfLS.png

lCquDdU.png

 

Share this post


Link to post
Share on other sites

Chris, I'm working on implementing this and the test's all work correctly.  However, tickets are not being created when alerts fire.  I have case #83246 entered to see if I can get some assistance and hopefully we can get this flushed out.

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this