Data stops reporting

Problem

The New Relic PHP agent was previously reporting data but then stopped reporting. If you check your agent daemon log file /var/log/newrelic/newrelic-daemon.log, you can see the message lack of activity within 10m0s. The health status for the application is grey, and the option to delete the application appears in the application's settings menu when you select the gear icon.

Solution

There are two ways to keep your application from entering an idle state:

  • Set the timeout value for newrelic.daemon.app_timeout to at least twice the interval of your transactions. For example, for an hourly background job, set the timeout to two hours.
  • Run a cron job every five minutes with a simple transaction, such as phpinfo(), to make sure that the application does not enter an idle state.

    Do not set newrelic_ignore_transaction to ignore the cron job. The PHP agent will enter an idle state if the job does not run and report.

Cause

If an application's transactions take longer than ten minutes, or occur less frequently than once every ten minutes, the application enters and remains in an idle state.

When the PHP agent is in an idle state, two transactions must occur before it will start reporting again:

  • The first transaction wakes up the agent and re-establishes the connection to New Relic
  • The second transaction reports data to New Relic

Because of this, New Relic advises that you run a cron job every five minutes if you have long or infrequent processes.

For more help

Recommendations for learning more: