# Alerting for TCP connections

**URL:** <https://community.dynatrace.com/t/alerting-for-tcp-connections/53461>\
**Category:** Alerting\
**Tags:** problem-detection, anomaly-detection, infrastructure-operations\
**Created:** [September 23, 2025, 1:39pm UTC](https://community.dynatrace.com/t/alerting-for-tcp-connections/53461 "2025-09-23T13:39:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chitradevi](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@chitradevi](https://community.dynatrace.com/u/chitradevi)\
**Post date:** [September 23, 2025, 1:39pm UTC](https://community.dynatrace.com/t/alerting-for-tcp-connections/53461/1 "2025-09-23T13:39:55Z")

</div>

I got the max threshold for TCP connections in definite number for example 18232 and the client wants to get alert if it’s reached 80% of this value. I don’t see any option to do this under anomaly detection of the particular host.&nbsp; Any idea?

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [September 23, 2025, 2:39pm UTC](https://community.dynatrace.com/t/alerting-for-tcp-connections/53461/2 "2025-09-23T14:39:25Z")

</div>

Hi,

Maybe you can check “builtin:tech.generic.network.sessions.new” which tells you number of new incoming TCP sessions per second.

If not, no out-the-box soluation. It was discussed [here](https://community.dynatrace.com/post/205667).

Best regards

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [September 23, 2025, 6:08pm UTC](https://community.dynatrace.com/t/alerting-for-tcp-connections/53461/3 "2025-09-23T18:08:01Z")

</div>

Hi,  
you can try with Custom metric events.

Go to Settings → Anomaly detection → Metric events.

Click Add metric event.

Select the metric you want to track (your TCP connection metric).

(Optional) Split by host if you only want this alert on a specific host.

Set a static threshold:

Max = 18232 → 80% = 14,626

Configure the rule to trigger when the metric is greater than 14626.

Save it and assign the event to the correct alerting profile.

**P.S.** I don’t recall there being a metric to count tcp connection to host.&nbsp;You’ll need to confirm the exact metric key for TCP connections in your environment. but I think&nbsp;this what [@AntonPineiro](https://community.dynatrace.com/user/58682)&nbsp;suggested seems to be the closest to what you’re looking for.  
Alternatively, you can always inject such a metric into Dynatrace yourself using **metric ingestion**.

---

<div class="post-metadata">

**Author:** ![chitradevi](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@chitradevi](https://community.dynatrace.com/u/chitradevi)\
**Post date:** [September 23, 2025, 6:37pm UTC](https://community.dynatrace.com/t/alerting-for-tcp-connections/53461/4 "2025-09-23T18:37:10Z")

</div>

But in static threshold we can give only the percentage or per mille threshold not the definite number as a threshold.

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [September 23, 2025, 6:45pm UTC](https://community.dynatrace.com/t/alerting-for-tcp-connections/53461/5 "2025-09-23T18:45:04Z")

</div>

If the metric reports an absolute value (e.g., number of sessions, TCP connections, bytes, milliseconds), then the threshold is set in the base unit of that metric, so you can enter a fixed number (like 14626).

If the metric is defined as relative (e.g., CPU usage in %), then the threshold options are limited to percentage or per-mille.

For example, in this metric:  
builtin:tech.generic.network.sessions.new you can set threshold in [count/s], in another like this:&nbsp;builtin:apps.custom.reportedErrorCount u can set exacl number

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 23, 2025, 8:06pm UTC](https://community.dynatrace.com/t/alerting-for-tcp-connections/53461/6 "2025-09-23T20:06:02Z")

</div>

I’ve built a simple Dynatrace Extension for a client to measure number of connections to defined TCP ports, including connection status. It works on Linux only and uses the ss command to get the info. See&nbsp;[GitHub - juliusloman/dynatrace-extension-host-sockets: Dynatrace extension to monitor network sockets states · GitHub](https://github.com/juliusloman/dynatrace-extension-host-sockets)&nbsp;  
It provides a metric&nbsp;host.net.sockets representing number of socket connections with the dimensions port, and socket status. You can then easily create a metric event to count the connections in TIME\_WAIT or ESTABLISHED status for example.
