Basic Freshdesk Integration
The following guide is an example of a custom http integration using the Freshdesk 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 ##freshdesk.requesterid## 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/
Freshdesk API Documentation:
https://developer.freshdesk.com/api/
Complete these steps in Freshdesk prior to creating your integration:
Create a Freshdesk User to be used for authentication.
https://support.freshdesk.com/support/solutions/articles/37591-adding-new-support-agents-
In the below payloads I use the Freshdesk requester_id as a token to create, update and close tickets. You can find the requester_id for a Freshdesk user by checking the following.
Configure your Freshdesk API key for authentication.
https://support.freshdesk.com/support/solutions/articles/215517-how-to-find-your-api-key
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 Freshdesk requester_id or organization_id etc.
Payload Examples:
The following examples will Create, Update and Close FreshDesk tickets with LogicMonitor Alerts.
NOTE: When authenticating with the Freshdesk api, you will only need to enter your api key in the username field, the password is blank.
Active:
{ "description": "Host: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##", "subject": "##LEVEL## - ##HOST## ##INSTANCE##", "requester_id": ##freshdesk.requesterid##, "priority": 1, "status": 2 }
Escalated:
{ "description": "Alert Escalated/De-escalated\nHost: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##", "subject": "##LEVEL## - ##HOST## ##INSTANCE##", "requester_id": ##freshdesk.requesterid##}
Acknowledged:
{ "body":"Note: ##MESSAGE##" }
Cleared:
{ "description": "Alert Cleared\nHost: ##HOST##\nDatasource: ##DATASOURCE##\nDatapoint: ##DATAPOINT##\nLevel: ##LEVEL##\n Start: ##START##\nDuration: ##DURATION##\nValue: ##VALUE##\nReason: ##DATAPOINT## ##THRESHOLD##", "subject": "##LEVEL## - ##HOST## ##INSTANCE##", "requester_id": ##freshdesk.requesterid##, "priority": 1, "status": 4 }
Here we can see the finished product, a ticket generated and cleared using the above payloads.
Active Warn:
Active Error:
Active Critical:
Active Critical Ack:
Cleared: (Note that the Status changes to Resolved)