Graphing in BASE

When looking at the BASE main page, there are links on the right-hand side of the screen that allow you to search alert data stored in the database or to produce graphs of some of the alert characteristics. The search functionality should work without additional action, but the graphing capability requires the PHP Graphics Draw (GD) library of image functions and several extensions to the PHP Extension and Application Repository (PEAR). If these modules are not installed, then clicking on a link such as "Graph Alert Data" will result in an error message such as: "PHP build incomplete: the prerequisite GD support required to generate graphs was not built into PHP. Please recompile PHP with the necessary library (–with-gd)." The PHP GD library (php5-gd) can be installed as a package using the Synaptic Package Manager in Ubuntu (as noted in the instructions for "Getting and Installing Necessary Tools"), but many of the other modules needed to enable graphing in BASE must be installed from the command line using PEAR. The following instructions include all the necessary components for adding graphics generation capabilities to BASE. If you already installed php5-gd during a previous session in the package manager, skip the first two steps below.

  1. Open the package manager by searching for "package manager" from the Dash Home and selecting Synaptic Package Manager.
  2. In the Quick Search box, enter “php5-gd” and check the box next to the php5-gd package to mark it for installation (any dependencies suggested by the package manager should also be accepted for installation). Click Apply to install the new package. Close the package manager application when the installation is complete.
  3. From the Ubuntu desktop Dash Home, search for select and Terminal to open a command shell.
  4. At the prompt, log in as root (superuser) by typing: $ sudo su
  5. Enter your user account password. When you are logged in as root, the end character of the command line should change to #
  6. Switch to the /usr/bin directory where the PEAR program resides: # cd /usr/bin

The PEAR packages that need to be installed include Image_Graph and Image_Canvas (both required), and a variety of optional packages that improve the appearance of the graphs generated with PHP, including Numbers_Words and Numbers_Roman.

The syntax for installing a PHP module using PEAR from the command line is pear install <package>. By default, the installer program restricts installation to packages that are in a stable release state (as opposed to in-development states such as beta or alpha), and both Image_Graph and Image_Canvas are alpha releases, so the installation commands need to be modified to reflect this. As currently available, installing Image_Graph will also install Image_Canvas.

  1. From the /usr/bin directory, enter the following command to install Image_Graph: # pear install image_graph-alpha
  2. You may see a warning message about the channel, which you can ignore. You should see progress indicating the Image_Graph package download and an “install ok” message. You should see install ok messages for Image_Canvas and Image_Color. You will also likely see a message saying that Image_Graph can optionally use two additional packages – Numbers_Roman and Numbers_Words. Install these packages too.
  3. From the /usr/bin directory, enter the following command to install Numbers_Roman: # pear install Numbers_Roman
  4. From the /usr/bin directory, enter the following command to install Numbers_Words: # pear install Numbers_Words-beta
  5. In addition to seeing progress indicating the Numbers_Words package download and an "install ok" message, you should also see that the Math_BigInteger package has also been installed.
  6. All of these PHP packages are referenced at startup by the web server (Apache), so the last step is to re-start the web server, using the following command: # service apache2 restart
  7. Close the terminal session by entering exit twice, once at the # prompt and once at the $ prompt.

From the Ubuntu Desktop, open Firefox and browse to From the BASE main page, click on Graph Alert Data. From the {chart type} drop-down menu next to "What do you want to know" you can select from a list of pre-defined report types and select the type of graph and other options. These choices offer a sample of the ways alert data can be displayed graphically; extending the chart types to display other information is possible using PHP, but such customization is beyond the scope of these instructions.