Reports up or down status for a network (TCP, UDP etc) port.
- Infrastructure agent installed - see agent installation
- Download a pre-generated binary for your OS or build from source (see Building)
- Copy the integration binary (
nri-port-monitor) to/var/db/newrelic-infra/custom-integrations/ - Copy the sample configuration to
/etc/newrelic-infra/integrations.d/ - Set required environment variables (see Configuration)
- Restart the Infrastructure Agent:
sudo systemctl restart newrelic-infra
| Variable | Required | Default | Description |
|---|---|---|---|
NETWORK |
Yes | tcp |
Network type (e.g., tcp, udp, unix) |
ADDRESS |
Yes | localhost:80 |
Target address in host:port format |
TIMEOUT |
No | 5 |
Connection timeout in seconds |
NOTE If using an integration v1.3 or lower, use legacy config files. These should be copied as instructed in step 3 within the Installation section.
By issuing the following NRQL, you can display the results of the port monitor.
SELECT latest(status), latest(status_reason) FROM NetworkPortSample FACET address SINCE 30 MINUTES AGO TIMESERIES0 = Port closed 1 = Port open
status_reason |
status |
Description |
|---|---|---|
connected |
1 | TCP connection succeeded |
dial_failed |
0 | Could not dial or write to the target |
udp_response_received |
1 | UDP — data was received from the target |
udp_open |
1 | UDP — no response within the deadline; port is open or silently filtered (likely via firewall) |
udp_rejected |
0 | UDP — ICMP port unreachable received |
- Go 1.23 or higher
- Make
- Clone this repo and open a terminal in the folder where you cloned it.
- Run
maketo build for all platforms, or:make macos-armfor macOS ARM64make macos-intelfor macOS AMD64make linux-armfor Linux ARM64make linux-intelfor Linux AMD64make windowsfor Windows AMD64
The generated binaries will be located in the bin/ directory.
To test the integration, run nri-port-monitor with passed configuration env variables:
$ NETWORK=tcp ADDRESS=newrelic.com:443 TIMEOUT=5 ./bin/<build>/nri-port-monitorThe output should be json similar to:
{"name":"com.newrelic.tcp-port-monitor","protocol_version":"3","integration_version":"3.0.0","data":[{"metrics":[{"address":"newrelic.com:443","event_type":"NetworkPortSample","network":"tcp","port":"443","status":1}],"inventory":{},"events":[]}]}This project is actively maintained by the New Relic Labs team. Connect with us directly by creating issues or asking questions in the discussions section of this repo.
We also encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.
New Relic has open-sourced this project, which is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT.
As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
If you believe you have found a security vulnerability in one of our products or websites, we welcome and greatly appreciate you reporting it to New Relic through our our bug bounty program.
Contributions are welcome (and if you submit a Enhancement Request, expect to be invited to contribute it yourself 😁). Please review our Contributors Guide.
Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at opensource@newrelic.com.
This project is distributed under the Apache 2 license.

