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?
Article Comments
thanks, there is on one server here, its a win 2016 server, the software with ports and the probe are on this same box
Jul, 2022 - Permalink
Hello
Then your best option would be the first KB I provide you with
https://helpdesk.paessler.com/en/support/solutions/articles/61061-monitoring-tcp-connections
Cheers
Jul, 2022 - Permalink
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" }
May, 2023 - Permalink
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.
May, 2023 - Permalink
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://helpdesk.paessler.com/en/support/solutions/articles/61061-monitoring-tcp-connections https://helpdesk.paessler.com/en/support/solutions/articles/78067-how-to-monitor-concurrent-connections-and-tcp-connections-to-a-firewall
Jun, 2022 - Permalink