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 




6 comments:

  1. Welcome to Wiztech Automation - Embedded System Training in Chennai. We have knowledgeable Team for Embedded Courses handling and we also are after Job Placements offer provide once your Successful Completion of Course. We are Providing on Microcontrollers such as 8051, PIC, AVR, ARM7, ARM9, ARM11 and RTOS. Free Accommodation, Individual Focus, Best Lab facilities, 100% Practical Training and Job opportunities.

    Embedded System Training in chennai
    Embedded System Training Institute in chennai
    Embedded Training in chennai
    Embedded Course in chennai
    Best Embedded System Training in chennai
    Best Embedded System Training Institute in chennai
    Best Embedded System Training Institutes in chennai
    Embedded Training Institute in chennai
    Embedded System Course in chennai
    Best Embedded System Training in chennai

    ReplyDelete
  2. WIZTECH Automation, Anna Nagar, Chennai, has earned reputation offering the best automation training in Chennai in the field of industrial automation. Flexible timings, hands-on-experience, 100% practical. The candidates are given enhanced job oriented practical training in all major brands of PLCs (AB, Keyence, ABB, GE-FANUC, OMRON, DELTA, SIEMENS, MITSUBISHI, SCHNEIDER, and MESSUNG)

    PLC training in chennai
    Automation training in chennai
    Best plc training in chennai
    PLC SCADA training in chennai
    Process automation training in chennai
    Final year eee projects in chennai
    VLSI training in chennai

    ReplyDelete
  3. Embedded system training: Wiztech Automation Provides Excellent training in embedded system training in Chennai - IEEE Projects - Mechanical projects in Chennai. Wiztech provide 100% practical training, Individual focus, Free Accommodation, Placement for top companies. The study also includes standard microcontrollers such as Intel 8051, PIC, AVR, ARM, ARMCotex, Arduino, etc.

    Embedded system training in chennai
    Embedded Course training in chennai
    Matlab training in chennai
    Android training in chennai
    LabVIEW training in chennai
    Robotics training in chennai
    Oracle training in chennai
    Final year projects in chennai
    Mechanical projects in chennai
    ece projects in chennai

    ReplyDelete
  4. 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
  5. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Mobile Marketing Service
    Mobile Marketing Companies

    ReplyDelete