Get notified per Mail by Azure Logic App when your Website is down
Today I want to demonstrate how one could monitor the online status of a website with the help of Azure Logic Apps.
Please be aware that the steps I describe in this article may cost you money. Please see the Azure pricing page first.
Azure Logic Apps are basically workflows that will help you to accomplish certain tasks in a very smiple way. Microsoft made it very easy to build a workflow, it is done with a visual designer, a lot of templates and Logic Apps integrate with a lot of online services out of the box.
Create a new Azure Logic App
On the new Azure Portal hit the small plus button on the left side and then type “Logic”.
After selecting “Logic Apps” you have to provide a few basic informations.
Enter a name for the App, select your subscription, a resoruce group or create a new one, and your desired location.
Next you can select a template, for our purpose, getting notified when our website is down, we want to select “Blank LogicApp”.
Setup you Logic App
Afer we have selected the blank template, we will get forwarded to the visual desginer. Here we select “Recurrence” and set the inteval in which our app will perform the actions we define later on.
Next hit “New step” and “Add an action”. In the popup search for HTTP and select it.
Fill the mandatory fields, “Method” with the HTTP verb “GET” and at “Uri” we want to define the address of our website.
Then we want to define a condition. Again, hit “New step”, but this time we select “Add a condition”.
In the condition we want to set the “Object Name” to “Status code”. You can find predefined objects by hitting the small plus sign below the text box (“Add dynamic content”).
Under “Relationship” we select “is equal to” and under value we type “2oo”, the “OK” HTTP status code.
Next we have to define what should happen if the condition evaluates in true or false. For our purpose we want only be informed if our site is broken down, so we select “IF NO” and add a new action.
Here I selected “Office 365 Send an email”, gave Azure permissions to use my account, entered my email, a subject and a body and hit “Save” from the top menu in the visual designer. We are set up now!
You could also select Outlook.com, enter your own mail server or any other desired action.
Above you can see the result of a full run after hitting “Run Trigger” from the top bar.
For testig purposes I also filled the “IF YES” node and this is the result from the my app logic test:
Error: REST API is not yet supported for this mailbox
If you are using Outlook.com to send an email, you could get the following error in result:
REST API is not yet supported for this mailbox.
Following this post on StackOverflow it seems like that “old” Outlook.com mailboxes are not enabled for the use of the API yet. Because of this I used my Office 365 developer account for this example.
What you could do: