Pages

An Custom Python SMS/E-mail Alert Manager using the Google Calendar API's

Thursday, January 6, 2011

Hi all,

This week I was working on a recommendation engine project (By the way it is the activity that I am focused on for about two months) and I faced a simple problem during the deploy. Since I was the administrator responsible for the execution of the scripts scheduled for processing the recommendations  it was important to me to be alerted whether the execution of these scripts was successful or a failure.  I haven't searched deeply more for a solution in the web so I decided to develop a simple script in python that would solve my problem in a fast way.

Here in the company we have a custom e-mail responsible for receiving and sending any kind of e-mails related to problems or reports about the operation of the website.  Since the e-mail was an account registered at Google Webmail, I remembered that I could use the Google Calendar Reminders/Events features for this task. 

How did I manage that ? 

Simple, first I looked for the GoogleCalendar APIs and found a API written in Python that could help me. The API is gdata and can be downloaded at this link. After I wrote this simple script generic enough for any kind of events that could send me an e-mail or  a text message to my cellphone anytime that the server scripts faced some problems during their execution.

Using the gdata API, the idea is to set an event to start after 1 hour and 15 minutes after the problem occurred (so if the problem occurred now, I would put probably in the except clause to set this event to start 1 hour and 15 min later).  The script also set a reminder that it is defined by the number of minutes before the event start that you want to be alerted of. So by the default I put 60 minutes (1 hour) before the event (but you can change if the problem occurred is a critical issue).  If you pay attention, you will receive the message, in this case, 15 minutes after the problem happened at the server.  In other words, it is the difference between the Start Time and the Reminder Time  (75 - 60 = 15 min).  

So after 15 minutes, you receive an alert (SMS message at your cellphone registered of course at the Google Calendar and an email if you set up with the message that you define).

I know it isn't a sophisticated solution and maybe there are other solutions out there better than this one. But it solved my problem with a few of lines of code and uses the Google Infrastructure to handle with the SMS/E-mail manager with no costs. It is a simple solution special for system analysts that want to monitor the statuses of their databases or servers.    

I've put the code in Github and is totally open-source. I expect it may help anyone facing this problem and wants a simple solution for an e-mail/text message report manager!


That's all! Any suggestions or improvements feel free to comment or ask!

Marcel Caraciolo 




14 comments:

  1. http://www.marketing92.com/branded-sms-in-pakistan/
    Branded sms marketing has appeared as a significant advertising aspect of Branded SMS and it is replacing email advertising with every day entry. Marketing92.com in Pakistan accompanies corporate branded sms Solution in Pakistan and offers Branded sms in Pakistan and Non-Branded sms benefits in Pakistan in volume to its drawing closer clients. The Branded sms administrations center for better client affiliations

    ReplyDelete
  2. Marketing92 Offering the top quality Services of Branded SMS in Lahore, and all over Pakistan. with Online Store you will increase your sales. Really good Blog i appreciate your hard work and research. Very helpful information. we also providing services ofWeb Development in Lahore, to expand Your business.

    ReplyDelete
  3. Keep on posting these types of articles. I like your blog design as well. Cheers!

    Best B.Tech College in Noida

    ReplyDelete
  4. I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update. Thanks
    DedicatedHosting4u.com

    ReplyDelete
  5. I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update. Thanks
    DedicatedHosting4u.com

    ReplyDelete
  6. This professional hacker is absolutely reliable and I strongly recommend him for any type of hack you require. I know this because I have hired him severally for various hacks and he has never disappointed me nor any of my friends who have hired him too, he can help you with any of the following hacks:

    -Phone hacks (remotely)
    -Credit repair
    -Bitcoin recovery (any cryptocurrency)
    -Make money from home (USA only)
    -Social media hacks
    -Website hacks
    -Erase criminal records (USA & Canada only)
    -Grade change
    -funds recovery

    Email: onlineghosthacker247@ gmail .com

    ReplyDelete
  7. Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work.

    seo services in lahore

    ReplyDelete
  8. Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign.

    seo company in lahore

    ReplyDelete
  9. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up.

    digital marketing agency in lahore

    ReplyDelete
  10. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free.

    web hosting in lahore

    ReplyDelete
  11. Hey, this day is too much good for me, since this time I am reading this enormous informative article here at my home. Thanks a lot for massive hard work.
    Digital Marketing Agency Lahore

    ReplyDelete
  12. Studyprovider has experts team are giving the homework help, assignment help, report, thesis, research writing services and statistics assignment help available 24/7 seven days a week contact now.

    ReplyDelete
  13. I love it here. Keep sharing your good vibes. I love them Are you also searching for dissertation writing help? we are the best solution for you. We are best known for delivering cheap assignments to students without having to break the bank

    ReplyDelete