Snippets · Sources
Check TCP ports (databases, caches)
Some dependencies have no HTTP endpoint to probe - databases, caches, message brokers. The tcp_check receiver opens a connection to each endpoint on an interval and reports tcpcheck.status and, on failure, tcpcheck.error.
- Signals
- Metrics
- Category
- Collection
- Source
- TCP ports (probe)
- Components
- batchmemory_limiterotlphttp
- Destination
- OTLP/HTTP endpoint
OpenTelemetry Collector
receivers:
tcp_check:
collection_interval: 60s
targets:
- endpoint: db.example.internal:5432
- endpoint: cache.example.internal:6379
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 25
batch:
timeout: 5s
exporters:
otlphttp:
endpoint: https://your-backend:4318
service:
pipelines:
metrics:
receivers: [tcp_check]
processors: [memory_limiter, batch]
exporters: [otlphttp]
LinkMesh
Library › Sources › TCP Port Check
- Targets
- ["db.example.internal:5432","cache.example.internal:6379"]
- Check Interval
- 60s
- Timeout
- 10s
What LinkMesh then pushes to the collector, under receivers:
tcpcheck/input_src_00000501:
collection_interval: 60s
targets:
- dialer:
timeout: 10s
endpoint: db.example.internal:5432
- dialer:
timeout: 10s
endpoint: cache.example.internal:6379
The same, as an API call (see automation recipes):
curl -X POST "$LINKMESH/sources" \
-H "Authorization: Bearer $LMSAT" \
-H "Content-Type: application/json" \
-d '{
"defaultConfig": {
"collection_interval": "60s",
"endpoints": [
"db.example.internal:5432",
"cache.example.internal:6379"
],
"timeout": "10s"
},
"name": "TCP Port Check",
"receiverType": "tcp_check"
}'The rest of the collector config above (tcp_check, memory_limiter, batch, otlphttp) is not part of this template: in LinkMesh those are separate sources, processors and destinations on the route.
Generated from LinkMesh's template catalogue by linkmesh-server snippet-render 1.464.3, not written by hand.
Download config.yamlValidated with otelcol-contrib v0.161.0 on 2026-10-26
Complete config files, each checked with the collector's own validate command (otelcol-contrib v0.161.0). Replace https://your-backend:4318 with your own OTLP endpoint before you run it.
The gotcha
Failures are reported by error code, as a counter. In our test unreachable endpoints reported tcpcheck.status 0 and a tcpcheck.error sum with error.code network_unreachable, one per endpoint. The receiver was called tcpcheck; otelcol-contrib 0.161.0 logs that alias as deprecated in favour of tcp_check, which this config uses.
Manage this across a fleet
LinkMesh manages collector configuration across a fleet from one self-hosted control plane, so a change like this is made once rather than host by host. The first 25 Collectors are free after a no-card registration in the OpenSight Customer Portal (5 without one).
Doing this in LinkMesh: Sources
Related snippets
- Prometheus counters to a delta-only backend (cumulativetodelta)Scrape Prometheus counters and convert them to the delta temporality Dynatrace requires - gauges untouched.
- Receive logs from Fluent Bit and Fluentd (forward)Take logs from existing Fluent Bit or Fluentd agents over the forward protocol, without replacing them first.
- Collect host metrics (CPU, memory, disk, network, processes)CPU, memory, disk, filesystem, network, load and per-process metrics from every host, without a separate node agent.
- Check HTTP endpoints (synthetic availability)Probe your HTTP endpoints from the collector and get status class, duration and error metrics per URL.