A first step to merge Cacti Installations (Part 1)

It is not the first time, that this questions arises. Nowadays, there are lots of command line scripts, but nothing readily available for merging. But what the hell is the big issue, why this is not possible yet?

To answer this question, we have to leave the web administration view and turn to the database layout. This can be done the hard way by using mysql from command line. Or instead, use phpMyAdmin. When examining any table, you’ll find a column named „id“, which uniquely identifies any entry. This is a known good practice for relational databases. In most cases, the „id“ is created automatically, each time a new record is inserted. This is known as auto-increment.

To join several tables, Cacti uses these „id“ fields. They are unique for a single Cacti installation. If you add e.g. some graph template on one Cacti installation, distinct „id“s will be provided. Joining the same template on a different installation will usually create a different set of „id“s. E.g. a specific graph template may have id=42 on one installation and id=21 on another one.

By simply inserting all records of a Cacti installation into a different one, this will break the whole database.

Stay tuned to find a way to overcome this problem.

Trouble with php-snmp

Yesterday, a forum post hit me right and square. First, I though we were seeing another „this device does not support snmpbulkwalk“ issue. But as the OP provided some more hints about results obtained by a wireshark trace, things became complicated.

The issue was observed while running a „Verbose Query“. I was stuck. „Verbose Query“ uses function run_data_query, and this in turn runs a plain cacti_snmp_walk. When using php-snmp, this has no option to run snmpbulkwalks. There is no such thing as a snmp2_real_bulkwalk or the like.

But a wireshark trace revealed my error. There was indeed a bulkwalk, using max-repetitions of 20. So it seems, that php-snmp switches to bulkwalk on its own. No option to suppress this not to govern the max-repetitions.

As I knew, a colleague recently was working on php-snmp implementation and I asked him to help. He pointed me to the new php-snmp class implementation, which allows to change max-repetitions. So this will be the direction to solve that issue. The implementation has been made available with PHP 5.4.

In case of trouble, Cacti users of PHP < 5.4 will have to switch to SNMP V1 to deactivate bulkwalks when their target devices don’t like those.