• EnglishEspañol日本語한국어Português
  • Log inStart now

Testing the Python agent

Problem

If you experience issues when installing or running the Python agent on a new host, test that the package is installed correctly and that it can contact our data collector service. If the data collector service is unreachable, it may be due to a blocked firewall. Perform these network connectivity tests to narrow down the cause of the problem.

Solution

Test connection

The Python agent includes a built-in test app that can verify your connection to our collector. To verify with the test app, run this command with the path to your New Relic config file:

newrelic-admin validate-config LOCATION_OF_NEWRELIC.INI

This runs a test using the Python agent. The agent will report the sample data to the account that corresponds to the agent config file, and a test app named Python Agent Test for the reported sample data will appear in the APM UI.

After the test is completed, the UI will show the app as inactive. Follow standard procedures to delete the test app from the APM index.

Check log for errors

If no data is transferred to the UI after five minutes, check the messages output from the test as well as the log file produced. If you encounter any problem that suggests an issue with being able to reach our data collector service, then try these troubleshooting procedures:

Here are examples of error messages you may find.

Verify network configuration

To verify the network connection, run the following:

newrelic-admin network-config newrelic.ini

Look for results similar to this:

host = 'collector.newrelic.com'
port = 0
proxy_host = None
proxy_port = None
proxy_user = None
proxy_pass = None
ssl = True
  • Port: A value of 0 for the port setting indicates that the appropriate port, such as 80 or 443, will be used depending on whether or not SSL is enabled.
  • Proxy: If you have configured the agent to use a proxy, make sure the proxy settings reflect this. If no proxy settings are specified but any HTTP connections to the wider Internet are necessary, then make sure the appropriate proxy settings appear in the agent configuration file.

Check hostname lookup

If the data collector appears unreachable:

  1. Check that the hostname for the primary data collector host can be resolved with UNIX system tools such as dig or nslookup.
  2. If this does not succeed, check the configuration of any domain name resolver files for your host.

Here is an example:

$ dig collector.newrelic.com
; <<>> DiG 9.8.3-P1 <<>> collector.newrelic.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62183
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;collector.newrelic.com. IN A
;; ANSWER SECTION:
collector.newrelic.com. 2453 IN A 50.31.164.140
;; AUTHORITY SECTION:
newrelic.com. 1163 IN NS ns2.p21.dynect.net.
newrelic.com. 1163 IN NS ns1.p21.dynect.net.
newrelic.com. 1163 IN NS ns4.p21.dynect.net.
newrelic.com. 1163 IN NS ns3.p21.dynect.net.
;; ADDITIONAL SECTION:
ns1.p21.dynect.net. 3198 IN A 208.78.70.21
ns2.p21.dynect.net. 8576 IN A 204.13.250.21
ns3.p21.dynect.net. 7364 IN A 208.78.71.21
ns4.p21.dynect.net. 8576 IN A 204.13.251.21
;; Query time: 22 msec
;; SERVER: 192.168.178.1#53(192.168.178.1)
;; WHEN: Tue Jun 11 18:58:23 2013
;; MSG SIZE rcvd: 206

Check network traffic routing

Important

Our agents require your firewall to allow an outgoing connection to our network:

  • TCP port 443 if using HTTPS over a SSL connection
  • TCP port 80 if using a plain HTTP connection

If the hostname for the data collector host can be resolved, use UNIX system tools such as ping and traceroute to determine if network traffic can be routed to it. The network traffic path will vary. As long as the path reaches the final intended host, the length of the path and its hosts are not important.

If you cannot contact the data collector host, configure the agent to use any firewall HTTP proxy, or open the required outgoing ports in the firewall to allow connections to the data collector.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.