I spend a good part of any day in my favorite web browser, and even if I don’t see its whole window, the lower right part of the status bar (now called Add-on Bar – which has to be explicitly enabled in View->Toolbars->Add-on Bar) is always visible under a pile of other application windows (mostly SSH sessions). That status bar is the ideal place to put up a small monitor with which I can keep an eye on a number of important servers, without having to wait for alerts sent to me by Nagios. whatmon

To this effect I have created a tiny Firefox and Thunderbird extension called whatmon, which can monitor almost anything you wish to monitor. (Whatmon for Safari is here.) Number of logged on users? Current load average? Health of your LDAP servers? Mail server queues? No problem for whatmon, as long as you can create a CGI (Common Gateway Interface) program in Perl, C, or any other language you are comfortable with, or even a PHP or Active-Whatever script which runs on your web server and can produce a wee bit o’ XML (eXtensible Markup Language). There is one thing that whatmon can’t watch: the web server from which it retrieves that XML … :-)

whatmon periodically reads a short bit of XML text from a web server. The XML must contain an integer status and a single line of text. In practice, that line of text can contain whatever the administrator desires. I want an indication of the health of the mail queues on a number of mail servers we have inhouse. The line of text therefore contains two-letter codes with which I can identify the hostname of the mail server in question as well as a count of mails on the queue for each of the servers in question.

The program that produces that line of text also returns a numeric integer indicating okay, warning or critical so that the extension can colour-code the status bar accordingly. A sample XML read by the extension.

  <text>nprocs: 111</text>

I’ve tried to keep this as simple as possible so as to not overcomplicate the extension proper (and because creating Mozilla extensions is about the worst I’ve ever had to do :-)). Each of the labels and values on the status bar could have been individually described in the extension, but then it would require modification whenever something changes. I didn’t want that to happen.

The extension requires two preferences to be set. I’ve named these whatmon.url and whatmon.refresh. They are the URL from which the XML is to be read and the frequency in seconds in which the extension should do a GET request from the URL.

Both preferences are installed as defaults when whatmon is first installed, but you’ll want to change these to reasonable values, either using the configuration editor (about:config) or via the preference pane:

Preferences pane

Whatmon picks up the change on the fly and periodically perform a GET request on the URL set in the whatmon.url preference.


The actual monitoring program is part of your web server, and it can be written in any language supported by it. It must return a tiny bit of XML text specifying at least a status code and a string that whatmon will print to the status or add-on bar. This simple example is a shell script which displays the number of currently running processes on the server.


nprocs=`ps ax|wc -l | awk '{print $1}'`
text="nprocs: $nprocs"
code=0          # normal

if [ $nprocs -gt 115 ]; then
        code=1  # warning
if [ $nprocs -gt 120 ]; then
        code=2  # critical

cat <<ENDXML
Content-type: text/xml


XML details

The XML you send to whatmon may contain the following elements:

   <text>nprocs: 231</text>
   <xhover>processes on gin</xhover>
  • code is either of 0 (OK), 1 (Warning), 2 (Error), and each produces a different-coloured icon on the status bar.
  • text is displayed in the status bar.
  • xhover is optional. If set, it populates the tool-tip which is displayed when the mouse hovers over the text.
  • msgurl is optional. If set, it forces Firefox to open a new window at the specified URL when whatmon sees the tag. If you produce the XML dynamically (CGI, PHP, whatever), you’d add a tag to alert the user with a separate window, e.g. explaining more details as to why something happened. I do this exclusively with, say, code == 2. In other words, something goes awry, I set code = 2 and populate the _msgurl_; when things return to "normal", I set code = 0 and remove the _msgurl_ element. Note that this URL can of course differ from code to code: simply ensure your CGI produces a different URL. (Thanks to Heiko Weber for the patch making this possible.)


Another more involved example is shown below. It uses whatmon as a front-end to Yahoo!’s stock symbol lookup.

        # whatmon-stock.php by Jan-Piet Mens <jpmens at gmail dot com>
        # Simple stock watcher for whatmon 
        # The URL to this will be specified as
        # http://www.example.com/stock.php?s=SYMB where SYMB is the stock symbol
        # as listed by Yahoo!'s site. 

        header("Content-type: text/xml");
        $symbol = $_GET['s'];

        if (!isset($symbol)) {
                $symbol = 'GOOG';

        $url = "http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=";

        print "<whatmon>";
        if ($fp = @fopen($url . "$symbol", "r")) {
                # "GOOG",401.32,"10/3/2006","1:16pm",-0.12,401.29,402.97,398.19,2729528
                $list = fgetcsv($fp, 256);

                # Note that you could add an alerting (code=1 or code=2) in case 
                # a stock is lower or higher than you desire...

                print "<code>0</code><text>${list[0]}: ${list[1]}</text>";
        } else {
                print "<code>2</code><text>Can't get stock</text>";
        print "</whatmon>";

Note the comments.


  • 09-Aug-2006
    • 1.6.0 incorporates heiko weber’s patch for alert windows
  • 27-Sep-2006 2.0.0
    • incorporates ian stirling’s patch to support file:// URLs
    • support for Firefox 2.0 RC1
    • defaults are set upon installation
    • changed logo
  • 27-Sep-2006 2.0.1
    • reverted to original GUID, minor code cleanups
  • 30-Sep-2006 2.0.2
    • added preference observer
    • If no XML data returned by CGI, the issue diagnostic on status bar
  • 15-Oct-2006 2.0.3
    • As per suggestion by Petr, a click on whatmon’s status bar forces an immediate refresh
  • 07-Mar-2007 2.0.4
    • Differing icons depending on level (suggested by “Frangi”)
  • 21-Nov-2007 2.0.5
    • install.rdf: support for Thunderbird 2.0 (LewS)
    • install.rdf: support for Firefox 3.0 (JPM)
    • click on whatmon does not add a new timer (Scott Carpenter)
    • whatmon.css: max-width: auto (Scott Carpenter)
  • 04-Dec-2007 2.0.6
    • Hover over whatmon status bar shows content of XML’s `xhover’ element (suggested by Jeremy Vanderb)
  • 19-Apr-2008 3.0.0
    • Show whatmon status as “Loading…” (w/ tooltip containing time) when XMLHTTP request is launched; allows user to detect unresponsive servers. [idea and code by “bitbyte”]
    • Many thanks to Sebastian A. who had excellent ideas, most of which had unfortunately already been implemented. :-)
  • 21-Apr-2008 3.0.1
    • Forgot to try/catch xhover element from XML; this results in whatmon printing “Loading…” and nothing else. Update to 3.0.1 or add non-empty xhover element to XML. Bug spotted by Scott Crevier.
  • 18-Jun-2008 3.0.4
    • Options dialog provided by Gábor Lipták (thanks!)
    • Bumped to official Firefox 3.0
  • 26-Jul-2009 3.1.0
    • Bumped to official Firefox 3.5.*
  • 15-Mar-2012 4.1.1
    • Reworked chrome paths to conform to new Mozilla standards.
    • Bumped to official Firefox 11.*
    • Revised some of the documentation above.


Download whatmon from the Mozilla Add-ons site, or get its source code.


Can this be improved on? You bet! Firefox and/or Thunderbird need restarting whenever the URL preference changes. A nice options dialog with which the extension’s preferences can be set would be welcome. Instead of plain text on the labels, I’d have liked to display images generated by the web server which change as the status changes. Any takers?