Friday, December 4, 2009

How to Add Plugins In Cacti

Standard
First of all you have to install yang namanya Plugin Architecture so you can install all the plugins easily. All the manual how to install the Plugin Architecture you can find in here. it’s preaty easy when you get use to with cacti installations.
After you install the plugin architecture, now you can choose what plugin you want to install as a plugin in cacti.  I install monitor plugins, so I can monitor if the hosts are down.
Here I have copy of the plugins installation that I get from the official site .

Installing Plugins

Plugins are made to be easy to install, upgrade and remove.
Before you can begin to install a plugin, you will need to install the Cacti Plugin Architecture. But once that is done, its all fairly simple.
The first step to is to download? the plugin of your choice. You can choose either the zip or gzip compressed archive. You will then need to extract this archive to a temporary location. When you extract the archive it should, depending on your archive software, create a directory with several files inside of it. We will use the Monitor Plugin? as an example.

Download

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

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

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/global.php
or here
C:\inetpub\wwwroot\cacti\include\global.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.

Configuration

A few plugins will require their own little tweaks or configuration changes to complete the installation of the Plugin. These are outside the scope of this document, as you will need to consult the individual documentation of the Plugin. But if you are stuck and can not locate the specific configuration options for a Plugin, you might try looking at the Settings link in the Console to see if any new options were added.

Removal

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.
That’ all folk, now you can try it by yourself. Have fun….

0 comments:

Post a Comment