What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Number of TCP Connections for certain port?

Votes:

1

This windows powershell script is useful for outputting the TCP ports and number of connections

Get-NetTCPConnection | group localport -NoElement | sort count -descending

I would like to have this on a graph so i can monitor spikes/drops in traffic Just one port would suffice, or a range

I'm specifically interested in seeing port usage (number of TCP CONNECTIONS) is there a sensor that has this already?

port prtg snmp

Created on Jun 23, 2022 11:29:14 AM

Last change on Jun 24, 2022 9:53:20 AM by  Felix Wiesneth [Paessler Support]



5 Replies

Votes:

0

Hello there

Thank you for reaching us. It all depends on the device you are using to monitor these TCP connections, would it be on a computer or firewall?'' here are some KB articles related to this topic.
https://kb.paessler.com/en/topic/61061-monitoring-tcp-connections https://kb.paessler.com/en/topic/78067-how-to-monitor-concurrent-connections-and-tcp-connections-to-a-firewall

Created on Jun 30, 2022 8:02:12 PM by  Luis Quesada (Paessler Technical Support)



Votes:

0

thanks, there is on one server here, its a win 2016 server, the software with ports and the probe are on this same box

Created on Jul 1, 2022 4:53:45 AM



Votes:

0

Hello
Then your best option would be the first KB I provide you with
https://kb.paessler.com/en/topic/61061-monitoring-tcp-connections

Cheers

Created on Jul 12, 2022 7:03:49 PM by  Luis Quesada (Paessler Technical Support)



Votes:

0

I'm struggling with this as well.

My problem is that occasionally, the external load balancer will get "confused" and send all traffic to just one backend app server which is exactly what I want to monitor in PRTG.

I have a PS script that does the trick and sends it off as an email, but unfortunately my PS & PRTG scripting skills aren't up to the level where I would be able to get it to provide the port established values in a sensor with channels.

Any advice would be much appreciated!

--------------------------------------------------------------

$servers = "server1", "server2"
$ports = 80, 443, 8080, 8081

foreach ($server in $servers)
{
    $status += "Server: $server`n"
    foreach ($port in $ports)
    {
        $count = Invoke-Command -ComputerName $server -ScriptBlock {
            param(
                [int]$port
            )
    (Get-NetTCPConnection -State Established -LocalPort $port).Count
        } -ArgumentList $port
	
        if (!$count) 
        {
            $count = "None"
        }
      
        $status += "Port $port connections count: $count`n"
    }
    $status += "`n"
}

Created on May 17, 2023 2:37:46 PM

Last change on May 18, 2023 10:59:20 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Thanks for your output,
It would be better to have more information about this, can you create a ticket with us?
That way we can try to dig deeper and ask for more logs and info.

Created on May 29, 2023 7:21:45 PM by  Luis Quesada (Paessler Technical Support)




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.