Cacti Plugin
Architecture Installation and Configuration
The Plugin Architecture for Cacti was designed to be both simple
in nature and robust enough to allow freedom to do almost
anything in Cacti.
Download Plugin Architecture
http://cactiusers.org/downloads/patches/
Extract
You will need to extract this archive. On Windows there are
several ways to extract zips/gzips, just use the program of your
choice (ex: Winzip). Using Unix you can extract it using a
command similar to this one, but your milage may vary depending
on the Distribution you are running.
#tar -zvcf cacti-plugin-arch.tar.gz
If all goes well, you should have a folder called cacti-plugin-arch
with a few patch files and a folders in it. It does not matter
in particular to where you download and extract these files to,
as we will be moving just the files we need.
Installing Cacti Plugin Architecture
There are two ways of install the Plugin Architecture. The first
way is by using the patch files. A patch file contains the
difference between the original files and the "new" files, which
makes them very small as they only contain exactly what we need
to make the changes. The other way is by using the pre-patched
full files. These files are the full install of the necessary
files with the patch already applied to them. With these you can
directly override the files already in your Cacti directory. I
only include the files that are necessary to change, so you
don't have to override every file in your Cacti install.
Using the Pre-Patched Files
Using the pre-patched files is easiest and most straight forward
way to install the Plugin Architecture. You will of course want
to backup your Cacti install first before attempting any add-on
modifications. Once you have backed up your install. Goto the
directory that you extracted the Plugin Architecture to. In this
directory you will find several other directories. One of them
will look like this "files-0.8.6g". This is to show you that
these are the pre-patched files for Cacti v0.8.6g, there may be
other versions available if that is not your version.
Now you will need to determine where your original Cacti install
is. For instance on Fedora Core 3, my original Cacti files are
located at /var/www/html/. This will vary between Distributions
and ofcourse between Linux and Windows, and it is outside the
scope of this document to discover where your installation is
placed. Once you have the location, remember where it is as you
will need it shortly.
You will now copy the files from the "files-0.8.6g" directory to
your Cacti install directory, overriding any files if you are
prompted. There are several ways to copy the files over
(Explorer in Windows, FTP, command line, ect.)
From here you are done installing the Plugin Architecture, but
it is necessary to configure it first before you continue using
Cacti (or Cacti will probably not function properly!)
Using the Patch
Using the patch files is slightly harder that using the
pre-patched files, but it is recommended for anyone that has
already modified their Cacti install using other mods, or their
own custom tweaks. This is mostly used on Linux/Unix etc... but
can also be done on Windows if you have the appropriate tools
installed. You will ofcourse want to backup your Cacti install
first before attempting any add-on modifications.
Now you will need to determine where your original Cacti install
is. For instance on Fedora Core 3, my original Cacti files are
located at <i>/var/www/html/</i>. This will vary between
Distributions and ofcourse between Linux and Windows, and it is
outside the scope of this document to discover where your
installation is placed. Once you have the location, remember
where it is as you will need it shortly.
Now goto the directory that you extracted the Plugin
Architecture to. In this directory you will find several files
with names simular to this "cacti-plugin-0.8.6g.diff". This is a
patch file that contains everything you need to install the
Plugin Architecture. You will copy the file that corresponds
with your Cacti version to the location of your Cacti install
using a command prompt (if you weren't already using one!)
We will first run this command from the Cacti Install directory
#patch -p1 -N --dry-run < cacti-plugin-arch.diff
This will not make any changes, it will only attempt to do the
install and report back any errors. If you receive and FAILED
errors, then you know that you will run into a few problems.
These problems can usually be addressed by posting in the
forums. If you have not modified your Cacti install by using any
other mods, then it is usually fairly safe to override the file
that "FAILED" with a pre-patched file that is also provided in
the archive (See the directions above). Your config.php file
will almost always fail to be patched if you have either already
configured your database settings for Cacti, or you are using an
RPM/DEB install (and possibly even the Windows MSI install). If
so, then just override the file, and reconfigure it for your
database.
To continue with the patching process, just run this command
#patch -p1 -N < cacti-plugin-arch.diff
This will modify the files and report back and errors. Assuming
that all went well, then you can now proceed to configuring your
Cacti install.
Configuration Cacti Plugin Architecture
It is necessary to configure your Cacti install after installing
the Plugin Architecture for several reasons. First you will need
to re-enter your database username and password (you can just
pull the info out of your backup of your old includes/config.php).
This is fairly straight forward and not necessary to cover here.
The other reason is that we now have a new config option which
must be set inorder for your Cacti install to function properly.
When you edit your includes/config.php you will see this option
$config['url_path'] = "/";
You will need to set this option to the URL location of your
Cacti install. For instance, if you Cacti Install was reachable
through a web browser at this location.
http://servername/
Then it would not be necessary to modify the above default
location. But if your Cacti Install was at
http://servername/projects/cacti/testing/
then you would need to set the option to this
$config['url_path'] = "/projects/cacti/testing/";
or it may be located here
http://servername/cacti/
then you would need to set the option to this
$config['url_path'] = "/cacti/";
It is important to note that you must include the '/' at the
front and end of the location. This is to prevent other issues
later down the road.
Once this is done, you will have successfully completed
installing the Plugin Architecture. You will now want to proceed
with downloading and install Plugins
Installing and Configuring Cacti
Plugins
Installing Plugins
Plugins are made to be easy to install, upgrade and
remove.Before you can begin to install a plugin as described
above, you will need to install the Cacti Plugin Architecture.
But once that is done, its all fairly simple.
Download CactiPlugins
http://cactiusers.org/downloads/
Now
We will use the Monitor Plugin installation and configuration as
an example.
Begin by downloading the Monitor plugin. After the download is
complete, the filename should look something like this.
monitor-0.3.zip
or
monitor-0.3.tar.gz
Extract
You will need to extract this archive. On Windows there are
several ways to extract zips/gzips, just use the program of your
choice (ex: Winzip). Using Unix you can extract it using a
command similar to this one, but your milage may vary depending
on the Distribution you are running.
tar -zvcf monitor-0.3.tar.gz
If all goes well, you should have a folder called monitor with a
few files and possibly a few folders in it. To be sure that you
are looking at the correct directory, check and make sure that
you have a file called "setup.php" directly inside of your
monitor folder. On Windows if you happen to end up with a parent
folder called monitor-0.3 with a subfolder called monitor then
you will need to ignore the parent folder and just use the
subfolder.
It is extremely important that you do not alter the case or the
name of this folder or the plugin will not function at all.
Upload Cacti Plugin Files
Once you are satisfied that you are working with the correct
directory, then you will need to upload this file into your
Cacti install's Plugin directory. This will vary greatly
depending on where you actually installed Cacti. For example, on
Linux, if your Cacti files are in a directory like this.
#/var/www/html/cacti/
then your Plugin Directory would be here
#/var/www/html/cacti/plugins/
On Windows using IIS, it could be located here
C:\inetpub\wwwroot\cacti\plugins\
You will need to upload/copy the complete "monitor" folder into
this "plugins" folder on your web server. So that you have a
structure kinda like this
#/var/www/html/cacti/plugins/monitor/
or
C:\inetpub\wwwroot\cacti\plugins\monitor\
That takes care of the difficult part of the installation
(download, uncompress, upload). Now we will just turn the newly
installed plugin on.
Activate Cacti Plugins
You will now need to modify Cacti's configuration file to
activate the plugin. This the same file that you had to use to
configure Cacti to connect to the correct database. Using the
above example, Cacti's config file would be located here
#/var/www/html/cacti/include/config.php
or here
C:\inetpub\wwwroot\cacti\include\config.php
Inside this configuration file, as you proceed down a few lines,
you will find a line that looks like this
$plugins = array();
Directly after this, you may see an example line like this
//$plugins[] = 'thold';
This is in place to basically show you how to activate a plugin.
The "//" is a comment line in PHP Code which effectively
disables the text directly proceeding it from being executed.
What we will need to do, is to change that line to look like
this
$plugins[] = 'monitor';
If the example line does not exist, then just put this directly
below the "$plugins = array();" line.
You may also have a few other plugins already installed, and if
so your configuration file may look like this.
$plugins = array();
$plugins[] = 'thold';
$plugins[] = 'monitor';
$plugins[] = 'discovery';
It is extremely important that the name in the qoutation marks
is the folder name of the plugin you installed. This folder name
also can not be changed from the original or the plugin will not
work correctly!
For example, if you had a plugin with a folder name of "logpurge"
then you would have to a configuration like this
$plugins[] = 'logpurge';
You are now completely done installing the plugin, and at this
point it should have been a fairly painless process.
Now you access your cacti webpage example http://www.test.com/cacti/
and login as admin user and go to utilities-->Usermanagement -->
select the users admin--> under Realm Permissions you should see
View Monitoring check box you need to tick this box to see the
monitor tab in cacti this will apply for all the plugins if you
don't see the cacti plugin tab you need to follow this procedure
One more thing is if you add a new device and if you want to
monitor that device you need to select the Monitor Host check
box option otherwise you can't see the newly added device under
monitor tab
Remove Cacti Plugins
Removing a plugin is very simple. If you want to just disable
the plugin, just remove the line from Cacti's config.php or
comment it out like so
//$plugins[] = 'thold';
The "//" is a comment line in PHP Code which effectively
disables the text directly proceeding it from being executed.To
completely remove the plugin, just delete the directory for the
plugin from your /plugins/ directory.