question

mkleinpaste avatar image
0 Votes"
mkleinpaste asked mkleinpaste commented

Monitor the output of a sql query in Azure Monitor

In Nagios, we have the ability to query a table in MSSQL server and then generate a warning and an alert based off the "Expected result". We currently use this to track if we're backing up a process that's logged in a table. We're looking to move to Azure Monitor but I'm not finding any documentation on creating an alert from this kind of source. Am I just not looking in the right spot or is this not a function in Azure Monitor?



--query "select top(1) value from TrackingTable where logtype = 2 order by logdate desc"
--result "Expected result"
--warning 50
--critical 200
--querycritical 1
--result Expected result

azure-monitor
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@mkleinpaste Welcome to Microsoft Q&A and thanks for your query.

Apologies for the delay in getting to this thread , we will review your scenario and get back to you at the earliest.

0 Votes 0 ·

Nobody does this with Azure Monitor? Query a database or call a stored procedure, get a result and send an alarm if that threshold is over a certain number?

0 Votes 0 ·

1 Answer

bharathn-msft avatar image
0 Votes"
bharathn-msft answered mkleinpaste commented

<<Converting the comments to answer for the broader community usage.>>

@mkleinpaste - Apologies for the delay in getting back to this thread, post reviewing this with our internal team it has been called out that there's nothing out of the box. That said, we see customers going towards "custom code" route. Also with Logic Apps, it should be quite simple: there are both "query SQL" and "Send to Log Analytics" activities.

Once you send the data to Log Analytics, you can alert as required.

Hope this information helps , please feel free to circle back if you have any further queries. Thank you.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

So, if I understand you correctly, I can create an SQL query using Logic Apps and send the returned data to Log Analytics to be picked up by Azure Monitor?

0 Votes 0 ·

Thank you @mkleinpaste for circling back on this. Yes your understanding is right we can query SQL with in Logic App using the SQL connector and send the returned data to Log Analytics . However if that data needs to be joined with any other table within Log Analytics you can do that and also create alerts as needed.

Log Analytics is a feature with in Azure Monitor only, please refer to this documentation for additional context.

Hope this information helps, if you have any further queries please let us know. Thanks

1 Vote 1 ·

Thank you!

0 Votes 0 ·
Show more comments