Real User Monitoring (RUM) with Pingdom and Drupal

Edit: There's a module for that™ now: Pingdom RUM. The information below is for historical context only. Use the module instead, since it makes this a heck of a lot simpler.


Pingdom just announced that their Real User Monitoring service is now available for all Pingdom accounts—including monitoring on one site for free accounts!

This is a great opportunity for you to start making page-specific measurements of page load performance on your Drupal site.

To get started, log into your Pingdom account (or create one, if you don't have one already), then click on the "RUM" tab. Add a site for Real User Monitoring, and then Pingdom will give you a <script> tag, which you then need to insert into the markup on your Drupal site's pages.

The easiest way to do this is to use drupal_add_html_head() within the page_alter hook (in your theme's template.php, or in a custom module):

<?php
/**
 * Implements hook_page_alter().
 */
function THEMENAME_page_alter($page) {
 
// Add Pingdom RUM code.
 
$pingdom_rum = array(
   
'#type' => 'html_tag',
   
'#tag' => 'script',
   
'#attributes' => array(
     
'type' => 'application/javascript',
    ),
   
'#value' => '[SCRIPT TAG CONTENT HERE]',
  );
 
drupal_add_html_head($pingdom_rum, 'pingdom_rum');
}
?>

Replace THEMENAME with your module or theme name, and [SCRIPT TAG CONTENT HERE] with the content of the pingdom script tag (excluding the two <script> tags at the beginning and end).

Once you've done this, go back to Pingdom, and you can view page load times in real-time:

Pingdom RUM monitoring graph

Pretty nifty!

Note: If you're looking for a great website monitoring service that's a bit simpler and cheaper than something like Pingdom (which we love!), check out Server Check.in :)

Comments

Thanks for using our Real User Monitoring service and great that you're sharing this :)

You're welcome — thanks for the great service! I've been using Pingdom for something like six years now.

Hi Jeff

I wrote a module to integrate this earlier on today, only to discover that I haven't yet got permission to create full projects. So it's in my Sandbox at http://drupal.org/sandbox/JamesOakley/1967596 - and awaiting full project review at http://drupal.org/node/1967638

If you or someone else reading this fancied reviewing my project application, we could get this into contrib.

James - thanks for posting the links! I've added a couple comments in the project application review: http://drupal.org/node/1967638#comment-7288724

Thanks for taking the time to make detailed feedback, Jeff. It's good to have input from the community to improve things. That's now back at "Needs Review" again, and a lot better for your input.