Forcing New Relic into Kiosk Mode

New Relic is a great bit of kit - nobody can deny that. I recently needed to configure it on a standalone box so it could be open on a large screen so my colleagues and I could see the current status of our sites. New Relic has a Kiosk Mode which strips out some of the navigation from the page an optimises it for "viewing only". Very handy.

I wanted a setting to force (or at least default) the page into Kiosk mode so that when I opened the bookmark on the browser, I didn't have to scroll to the bottom, click it, scroll back up and then refresh any other relevant tabs. It didn't look like there was a feature for this and the Kiosk Mode link was just a java function call; there was no URL.

So I turned to GreaseMonkey.

Enter GreaseMonkey

GreaseMonkey is a Firefox Addon which allows you to bind custom JS scripts to all (or specific) pages. There is a repository of over 74,000 scripts which let you customize all kinds of sites (Twitter, Gmail, Facebook, etc) including Drupal.

However there was nothing for New Relic.

Until now.

Using GreaseMonkey with New Relic

As it turns out, the script is very simple.

// ==UserScript==
// @name            New Relic Kiosk Mode
// @namespace       http://www.thingy-ma-jig.co.uk/
// @icon            http://www.thingy-ma-jig.co.uk/sites/thingy-ma-jig.co.uk/files/greasemonkey/NewRelic_inline_small.png
// @description     Force New Relic into Kiosk mode by setting the cookie on page load if ?kiosk is in the URL
// @include         https://rpm.newrelic.com/*?kiosk
// @updateURL       http://www.thingy-ma-jig.co.uk/sites/thingy-ma-jig.co.uk/files/greasemonkey/newrelic-kioskmode.user.js
// @version         1.0
// ==/UserScript==

unsafeWindow.RPM.kioskMode._setCookie();

Once the cookie is set, New Relic handles the rest. All you need to do is append "?kiosk" onto the URL (maybe in your bookmarks?) and the page loads in Kiosk mode.

You can install the script by clicking on this button.

Install Kiosk Mode Script

Find It On UserScripts.org

I have also added the script to UserScripts.org, for those that are interested.