The following article outlines the procedures taken to install the Plugin Architecture for Cacti to allow the Threshold and Weathermap plugins.
Server is Ubuntu Server 11.04.
The official documentation can be found at http://docs.cacti.net/plugins
There is also the Cacti Forum where you can get support – http://forums.cacti.net/
The first step is to stop apache, mysql and backup our current cacti environment.
my_account@CactiServer:~$ sudo service apache2 stop
my_account@CactiServer:~$ sudo service mysql stop
my_account@CactiServer:~$sudo cp -r /usr/share/cacti/site/ /home/my_account/cacti_bk
Next we download the plugin architecture using wget and extract the files.
my_account@CactiServer:~/downloadds$ wget ftp://10.10.10.10/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
my_account@CactiServer:~/downloadds$ tar -zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
Now we need to install the cacti files using the patch method.
Jump to the plugin arch directory and copy the cacti-plugin-arch.diff file to /usr/share/cacti/site
my_account@CactiServer:~/downloadds$cd cacti-plugin-arch/
my_account@CactiServer:~/downloadds/cacti-plugin-arch$ sudo cp cacti-plugin-0.8.7g-PA-v2.8.diff /usr/share/cacti/site/
Run the patch files as a dry run to report back any errors.
my_account@CactiServer:~/downloadds/cacti-plugin-arch$ cd /usr/share/cacti/site/
my_account@CactiServer:/usr/share/cacti/site$ patch -p1 -N --dry-run < cacti-plugin-0.8.7g-PA-v2.8.diff
According to the Cacti Documentation
Your config.php file will almost always fail to be patched if you have either already configured your database or you are using an RPM/DEB install.
We shall continue proceeding with the patch even though we received Hunk #6 FAILED at 1323.
my_account@CactiServer:/usr/share/cacti/site$ sudo patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff
Next we import the pa.sql file to the cacti database.
my_account@CactiServer:~$ cd downloadds/cacti-plugin-arch/
my_account@CactiServer:~/downloadds/cacti-plugin-arch$ /usr/bin/mysql --user=root --password= cacti < pa.sql
..
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
We received the above error message re: sqld sock as we need to start mysql before importing the pa.sql file
my_account@CactiServer:~/downloadds/cacti-plugin-arch$ sudo service mysql start
mysql start/running, process 13203
..
my_account@CactiServer:~/downloadds/cacti-plugin-arch$ /usr/bin/mysql --user=root --password= cacti < pa.sql
We now need to make the finishing touches to our configuration
Change /usr/share/cacti/site/include/global.php as follows:
/* Line 37 $database_username = "cactiuser"; */
$database_username = "cacti";
/* Line 38 $database_password = "cactiuser"; */
$database_password = "enter your pass given during installation(not cactiuser)";
/* Line 105 $url_path = "";
$url_path = "/cacti/";
Change /usr/share/cacti/site/include/config.php
Ensure the following for the url path
$url_path = "/cacti/";
Change /etc/cacti/debian.php to include the following line
$plugins = array();
Start apache and restart mysql
my_account@CactiServer:~/downloadds$sudo service apache2 start
my_account@CactiServer:~/downloadds$sudo service mysql restart
We can now proceed with installing the plugins (thold and weathermap)
We must first install the Settings Plugin as this is a prerequisite to the thold plugin.
Download and uncompress settings plugin
my_account@CactiServer:~/downloadds$ wget ftp://10.10.10.10/settings-v0.7-1.tgz
my_account@CactiServer:~/downloadds$ tar -zxvf settings-v0.7-1.tgz
Copy the settings plugin into your Cacti install’s Plugin directory
my_account@CactiServer:~/downloadds$ sudo cp -r settings /usr/share/cacti/site/plugins/
To Activate The Settings Plugin -
Go to Console/Utilities/User Management within your Cacti web interface – http://CactiServerIP/cacti/ and enable the ‘Plugin Management’ realm for your admin user, then go to Console/Configuration/Plugin Management and click the ‘Enable Plugin’ icon
Download and install the thold plugin
my_account@CactiServer:~/downloadds$ wget ftp://10.10.10.10/thold-latest.tgz
my_account@CactiServer:~/downloadds$ tar -zxvf thold-latest.tgz
my_account@CactiServer:~/downloadds$ sudo cp -r thold-0.41/ /usr/share/cacti/site/plugins
For some reason cacti doesn’t like the folder name thold-0.41 so we must rename it before we can enable the plugin
my_account@CactiServer:~/downloadds$ cd /usr/share/cacti/site/plugins
my_account@CactiServer:/usr/share/cacti/site/plugins$ sudo mv thold-0.41/ thold
Go to Console/Configuration/Plugin Management within your Cacti web interface – http://CactiServerIP/cacti/ and enable the thold plugin
Install the weathermap plugin
I had no utility to unzip zip files on my Ubuntu server so I used –r flag on wget to download a directory
my_account@CactiServer:~/downloadds/10.10.10.10$ wget -r ftp://10.10.10.10/weathermap
my_account@CactiServer:~/downloadds/10.10.10.10$ sudo cp -r weathermap/ /usr/share/cacti/site/plugins/
Go to Console/Configuration/Plugin Management within your Cacti web interface – http://CactiServerIP/cacti/ and enable the weathermap plugin
The final thing I noticed was that Cacti was reporting the incorrect time in Syslog.
To fix the issue we need to include date.timezone = “<your_location>” in the following php.ini files
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
Update – Cacti Error Messages
I was receiving a couple of error messages in the Cacti logs after installing the plugins.
The first was regarding access to the directory /usr/share/cacti/site/plugins/weathermap/output. To resolve the problem I needed to change the group owner of the directory from root to www-data, then grant write access to the www-data group.
myAccount@CactiServer:/usr/share/cacti/site/plugins/weathermap$ sudo chgrp www-data output/
myAccount@CactiServer:/usr/share/cacti/site/plugins/weathermap$ sudo chmod 775 output/
myAccount@CactiServer:/usr/share/cacti/site/plugins/weathermap$ls -al
..
drwxrwxr-x 2 root www-data 4096 2011-10-03 10:39 output
The second was that I needed to install the PHP GD function. To install php-gd use the following command.
sudo apt-get install php5-gd