Help with log analytics query to check SQL database availability

Copper Contributor

I need a log analytics query that will tell me whether a particular SQL database is available or not. In some instances, database was down. We would like to create an alert using a query in case database is not available.  Can anyone help with this?

1 Reply

Hi @sambitmahanta 

 

I used Azure functions to query a SQL database and then send the result to Azure Log Analytics 

 

This is the website I used as a reference

https://docs.microsoft.com/en-nz/azure/azure-monitor/platform/data-collector-api#sample-requests

 
This forum will not permit me to paste the code here so I will attach an image of it. Don't fear the code is all detailed inside the webpage at the above URL.