You can monitor your PHP applications using our PHP client library, the Linux Agent, and the Metricly StatsD server.



  1. Navigate to the metricly-agent.conf file.

  2. Update the statsd setting to enabled = True.

    # local statsd server
    enabled = True
  3. StatsD requires a client library to push metrics. You can use our PHP client library or an open source alternative.

    include 'StatsD_Client.php';
  4. Include the client library file on any page you want to collect metrics, or you can reference the file globally.

  5. Instrument your application code by calling the appropriate functions. Check out the example below or the timer example included in the library repo.

    //add a gauge in any section of your code
    .gauge('', 20);
    //to add this time you must first add code to
    calculate the start and end time.
    //typically we use epoch time.  And add code at
    the start and end of the code you want to
    //the timing function expects time in
    .timing('', 1000, 1);
    //you can add or subtract from any metric with
    these functions
    .increment('', 1);
    .decrement('', 1);
  6. Save and restart both your application and the Linux Agent.