SimranKaurDeol-1049 avatar image
0 Votes"
SimranKaurDeol-1049 asked SimranKaurDeol-1049 commented

Port monitoring in Azure Monitor

Hi everyone,

I'm new to Azure and need some expert suggestions on the challenge that I'm facing.

I'm working towards migrating from an existing monitoring tool to Azure monitor in order to track different KPIs (such as URLs, Ports, DB) of our servers in one place. Currently, I wanted to monitor all ports of VMs, check their status, give out alerts in case a port is not responding but couldn't really find a way to do that.

Please let me know if there's a way to do it.

· 1
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.

@SimranKaurDeol-1049, Following up to check if you had a chance to review the answer below by Alistair. Please let us know if you have any queries or concerns.

Please 'Accept as answer' if it helped so that it can help others in the community looking for help on similar topics.

0 Votes 0 ·

1 Answer

AlistairRoss-msft avatar image
0 Votes"
AlistairRoss-msft answered SimranKaurDeol-1049 commented

Ho @SimranKaurDeol-1049

Azure Monitor for Virtual Machines will monitor local ports on a VM from within the OS, monitoring inbound and outbound traffic.

Depending on your need you can use Application Insights URL ping tests, Standard tests, or Connection monitor for URL monitoring.

SQL insights can be used for monitoring SQL databases on VM's as well.

All of this can be alerted on in using Log Alerts, though some (like connection monitor and the URL tests) build the alerts as part of the deployment wizard.

· 5
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.

Hi @AlistairRoss-msft

Thanks for the response.

From what I've understood we can setup a query, which will fetch data for the inbound/outbound or we can setup a workbook for open/active ports.

But I couldn't find a way to set alerts on these options. In alerts section of VM, options of inbound, outbound and so are available, not of ports.

Please let me know if I'm missing something?

0 Votes 0 ·

Hi @SimranKaurDeol-1049

If you are using Azure Monitor for Virtual machines, you can write a simple (or complex) query like below:

 | where Direction == "outbound"
 | where ProcessName == "MonitoringHost"
 | where DestinationPort in (443, 80)
 | where LinksFailed > 0

This would return any failures within the specified time period for outbound connections from the process "MonitoringHost". I've added the DestinationPort, but you can remove this and it will capture all ports used by this process.

To create an alert, there is a "New alert rule" button from the logs view. Full details on creating and managing these alerts can be found here

On the topic of creating workbooks, this solution comes with some great out of the box workbooks for analyzing and drill down through this data.


1 Vote 1 ·

Hi @AlistairRoss-msft

Thanks for helping with the issue. I tried implementing the code that you mentioned but I get the following error.

Do let me know if there's a workaround to this. Thanks in advance.

0 Votes 0 ·
ports-error.png (93.1 KiB)
Show more comments