Matt Pson Just another dead sysadmin blog

6Nov/11Off

Getting Cacti working with Zend’s PHP packages

In short: you don't.

Backstory: having a server running some webbapplications using the Zend PHP packages for Debian using their repository (from the file /etc/apt/sources.list):

# zend server community edition via zend's repository
deb http://repos.zend.com/zend-server/deb server non-free

...and now we wanted to move our existing Cacti installation to this server in order to put a old server to sleep. It's should be an easy task we thought after doing some Google searches and made up a small checklist (borrowed from [HOWTO] Migrating Cacti From One Server to Another):

  1. Install the official Debian Cacti packages on the new server and make sure it works
  2. Turn off Cacti at the old server in order to have a known state of the database
  3. Migrate the database to the new server
  4. Copy the RRD files as XML
  5. Reconvert the XML back to RRD files
  6. Activate the new Cacti

As it would turn out the first item on the checklist was the one that gave us some major troubles.

It soon became apparent that Zend's version of PHP did not include any support for SNMP and any attempt to install PHP related packages via Debians own repositories threatened with the uninstallation of the Zend specific packages - thus breaking the existing applications.

Some further investigation also showed that Cacti used the PHP Data Objects (PDO) interface to connect to MySQL which also wasn't available in the Zend version.

Both these things were used only by the datacollector poller.php and not by the webinterface bit of Cacti which worked straight out of the box.

Our solution: download a recent PHP source (5.3.8) and compile it with the needed options like:

configure  --with-snmp --disable-cgi --with-zlib --with-bz2 --with-curl --with-mysql --with-pdo-mysql --enable-sockets

install it in /usr/local and point Cacti to it in order to use it for all scripts (the option is at Console -> Settings -> Paths, a bit down the page you'll find "PHP Binary Path"). Then it works, data started to flow in from the 1000's of datasources we have.

Not that when we got to point 3 on our list, "Migrate the database to the new server", we had reconfigure this again as the settings from the old server overwrote the one on the new server. That one took us more than 10 minutes to figure out 😉