DevOps Zone is brought to you in partnership with:

Trevor Parsons is CEO and Co-founder of Logentries, 'the log management and intelligence platform'. Trevor has over 10 years experience in enterprise software and in particular has specialised in developing enterprise monitoring and performance tools for enterprise systems. He is also a research fellow at the Performance Engineering Lab Research Group and was formerly a Scientist at the IBM Center for Advanced Studies. Trevor holds a PhD from University College Dublin, Ireland. Trevor is a DZone MVB and is not an employee of DZone and has posted 63 posts at DZone. You can read more from them at their website. View Full User Profile

Build your own SMS Alerts–Logentries and Clickatell Combined!

07.27.2013
| 2559 views |
  • submit to reddit

This is a guest blog post by Jason Ruane, the technical director at Moposa, a place for brides and grooms to plan and manage their wedding. In this post Jason, describes how he used Logentries webhook alerts and Clickatell to receive Logentries alerts via SMS. Jason and his team are long time users of logentries, analyzing all their logs from multiple servers in one centralized, cloud location.

How I receive my Logentries alerts via SMS

Sometimes you want things to escalate quickly and a storm of errors on your production system is definitely one of them.

With the rise of APIs everywhere it is becoming reminiscent of the Unix pipes of old, to nowadays connect disparate services with a simple flow. For example, having seen the new alert feature on Logentries I set a sample one up to pop me an email if the number of fatal alarms on our webapp exceeded 100 per day, indicating something has gone awry.  However, for a more serious occasion, when 100 error events per hour trigger a Logentries alarm, I felt an SMS might be more appropriate as I would definitely want to escalate this and sort it out immediately. Connecting these dots was easy; I just set the alarm action to make a HTTP call to my SMS provider with an appropriate subject line. It’s a quick 2 step process.

Step 1:

Setup an account with an SMS provider. In this instance I am using Clickatell as they have an API which can accept a HTTP call with URL parameters to initiate an SMS. They offer some initial free text messages when you sign up if you would like to try before you buy. After creating an account, log in to “Developers Central”. In the tab “Manage my Products” add a connection (type http), click submit and then you have your API ID.

Now, by navigating to a particular URL, you can send an SMS. The format is shown below but you will want to substitute your particular info in the appropriate locations:

http://api.clickatell.com/http/sendmsg?user=[your-username]&password=[your-password]&api_id=[your-api-id]&to=[your –phone-numer]&text=[your-sms-content]

For example, my particular URL looks like:

http://api.clickatell.com/http/sendmsg?user=redacted&password=redacted&api_id=123456789&to=353876570028&text=logentries-spotted-an-issue

So here it is in the Clickatell site:

clickatell

Step 2:

Create an alarm in Logentries and for the action, set it to “POST me a notification” to the URL from step 1.

logentries alerts

So now, when an alarm fires in Logentries.com, it pops up in my text messages.

text message

Taking it to the max

But why stop there, the Unix progenitors had bigger dreams, as Brian Kernighan described with the beauty of piping information through these building blocks (@6 mins). The Internet of Things is all about connecting everything, so I purchased a couple of internet connected lightbulbs for home and now the alarms from Logentries can bathe the room in red to grab my attention. Overkill you say? Not at all; That is the next stage, where the alarm will trigger the coffee machine with a proportional ratio of espresso shots to alarm messages, because when things go astray, it’s gonna take some fixin’. J

Who are we

Here at Moposa, we are building a place for brides and groom to plan and manage their wedding. We have been using Logentries from the moment we heard of them. Cloud based logging was the perfect solution, for both our scale-up and then scale-out setups. We are building on .NET with C# and every time I jump into Logentries it is a joy to see the happy humming of multiple servers stream into the one unified location.

Published at DZone with permission of Trevor Parsons, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)