More destinations for MongoHQ Alerts with Zapier


MongoHQ users can now send their database alerts through Zapier’s web integration service. As well as generating mail, SMS or instant messages, Zapier allows those alerts to be used to create new tickets on Jira, ZenDesk, Help Scout, Samanage or the other ten supported help desk applications that have Zapier integration. To access the MongoHQ Alert integration visit the MongoHQ Alerts page on Zapier, accept the invitation to use the app, and sign up for a Zapier account if you don't already have one.

A Refresher on Alerts

If you aren’t familiar with MongoHQ’s support for alerts and notifications, allow us to introduce you to them. When you are using the MongoHQ UI, underneath the database icon is the alerts icon. Clicking on that shows the last 24 hours of alerts that come in three different types, critical for downtime or data loss, warning for when the database is under stress and notice for information about ‘mildly interesting’. If any alerts are shown, you can click on them to get more information including explanation and details of possible causes. These alerts can also be delivered – by mail, via PagerDuty or through a HTTP WebHook request – when they occur. The settings can be found by clicking Edit Settings on the Alerts page.

On the Notifications Settings page you can adjust the threshold, at a per-database level, on when notifications are generated. Below that are the settings for the various contact mechanisms. Email allows all the database users to be notified or specific email accounts and PagerDuty API key entered on the page will enable alerts to be sent to the alert management platform. Finally, the Webhook alerts entry allows the alert to be posted using a HTTP get or post to a specified URL and it's this mechanism we have used to integrate with Zapier.

Using the MongoHQ Alert integration

Once you have access to the MongoHQ integration on Zapier, you will be able to select it when creating a new Zap…

Screenshot 2014-02-27 12.18.24

The next step is to connect MongoHQ to Zapier; the Zapier system will offer up a URL which is where MongoHQ will post its alerts. You’ll need to copy that URL…

Screenshot 2014-02-27 12.18.44

Then you want to go to MongoHQ’s Alert Settings page – ideally in another browser window – turn Webhooks on in the Alert Contacts section, set the HTTP Method to POST and paste the URL into the URL field. Save your Alert notification settings and return to Zapier.

Webhook alerts

We’ve got this far and we haven’t mentioned what data is actually passed in the alert. If you consult the MongoHQ documentation for Webhook alerts, you’ll find a table of names of the various fields passed. Briefly, there is a severity level (1: Critical, 2: Warning, 3: Notice), a type of alert as a string, a title for the alert, a source for the alert and a human readable message about the alert. Where the alert is triggered by passing a level, that trigger level is also passed. An array of databases that were affected by the alert is supplied along with three “alerttype” fields (causes, description and resolution) which are markdown text related to the kind of alert being passed. The latter fields are useful for populating operator guidance in a help desk application.

Zapier gives you the option to filter on any of these fields if you want to, for example, log only critical and warning alerts. These fields can be used when deciding how to interact with the outgoing action. We have used an example of a Google Talk instant message action and inserted the various fields into a message like so:

Screenshot 2014-02-27 12.19.07

Once saved, this Zap generates Google Talk messages with the core details of the alert included. It is just a simple example of what you can achieve with the MongoHQ Alert integration on Zapier and massively expands your alert handling options.

Dj Walker-Morgan
Dj Walker-Morgan was Compose's resident Content Curator, and has been both a developer and writer since Apples came in II flavors and Commodores had Pets. Love this article? Head over to Dj Walker-Morgan’s author page to keep reading.

Conquer the Data Layer

Spend your time developing apps, not managing databases.