p|r|b Project

Custom Search
A modular rrd browser for polling and graphing

Documentation

Required software:

  1. Apache
  2. Mysql (when the db abstraction layer stuff is done, you can choose any database you like.)
  3. rrdtool > rrdtool-1.2.10
  4. PHP with:
    • apxs
    • sigchild
    • pcntl
    • rrdtool
    • snmp
    • CLI

How to build the PHP rrdtool extension using phpize

This method is probably the preferred method. It will build a shared module of php_rrdtool and install it.

You must have rrdtool installed and the include and lib files available. Namely rrd.h and librrd.a are needed for php_rrdtool to compile.

Step 1. Get the PHP rrdtool source

Go to the contrib directory on the rrdtool distribution site: http://oss.oetiker.ch/rrdtool/pub/contrib/ There are a number of files in this directory that mention rrd. You want the one named: php_rrdtool.tgz

Step 2. Untar php_rrdtool.tgz

tar zxvf php_rrdtool.tgz

Step 3. Build the php module

Go into the rrdtool directory and do: phpize
Now run: ./configure --with-rrdtool=/path/to/rrdtool-1.x.x Replace x.x by the rrdtool version installed on your system.

If you get errors here about rrdtool not being installed it's because the rrd.h file isn't found. Make sure you have the right path in the command above. It could mean you need to install rrdtool from source.

Now: make && make install
Should do the trick. Don't forget to restart apache!

How to build the PHP rrdtool extension by hand (Alternative method)

This method requires a recompilation of php

I'm going to assume that you know how to compile PHP normally with whatever other items you want to include and that you have the rrdtool development libraries installed or have compiled and installed rrdtool from source.

Step 1. Get the PHP rrdtool source

Go to the contrib directory on the rrdtool distribution site: http://oss.oetiker.ch/rrdtool/pub/contrib/ There are a number of files in this directory that mention rrd. You want the one named: php_rrdtool.tgz

Step 2. Untar into the correct place

Now that you have the source go into your php source directory and then into the ext directory. So you will be somewhere like this:
/usr/local/src/php-5.1.3/ext/
Now untar the source into this directory.

Step 3. Recreate the php configuration file

There is a warning that you will get if you do not have autoconf 2.13 installed on your system when you try to do this. It is easy enough to get this version if you have fedora so that is what I did.

One tricky part to this is that I had to remove the old configuration file first before the new one could be created.

  1. Change directory to your PHP source, if you are still in the ext directory just cd ..
  2. Remove or rename the existing configuration file:
    mv ./configure ./configure.old
  3. If you are using autoconf 2.13 run the following command:
    PHP_AUTOCONF=autoconf-2.13 ./buildconf --force
    If you are using whatever other autoconf you have installed just run: ./buildconf --force
  4. You should now have a new configuration file that can be run with the --with-rrdtool option

Step 4. Test

After compiling with rrdtool you should be able to use the phpinfo() function to list the installed extensions. If everything went right you should see rrdtool listed.

PEAR packages:

  • DB
  • XML_Parser (HTML_TreeMenu dependency, no longer needed)
  • HTML_TreeMenu (no longer needed as of 0.3.0)
  • HTML_AJAX (no longer needed as of 0.3.0)

Installation:

  1. Unpack into dir
  2. Edit etc/prbconfig.php
  3. Check file access mods
  4. Setup mysql database using provided sql file
  5. Setup crontab for prbupdated poller