Cacti 087b Guide
Cacti 087b Guide
gz)
by corbin
Install Ubuntu with ISO - Use the Basic Ubuntu Dapper Drake 6.06 Server Install - First
Option Should go pretty quick with no issue. I installed mine on a VMWARE virtual
machine with 2 processors, 3GB Memory, and 20GB Hard Drive.
vi /etc/networking/interfaces
Remove the dhcp(iface eth0 inet dhcp) setting and add the following lines
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Run command to restart network services for new IP to take effect
# /etc/init.d/networking restart
Run ifconfig to see if changes took effect
# ifconfig
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Other Dependencies - some of the dependencies will change in the future - run them
separately without the number and it may tell you what the next version available is
# sudo apt-get install make gcc g++
# sudo apt-get install cgilib freetype2 libttf-dev libttf2 libpng12-dev
libfreetype6-dev libart-2.0-dev snmp
Allow MySQL Remote Administator to Access Server - int /etc/mysql/my.cnf change the
bind-address = 127.0.0.1 to the ip address of the server.
Needed Packages
# sudo apt-get install linux-kernel-headers
# sudo apt-get install build-essential
# sudo cd /usr/local/src/
# sudo wget http://tobi.oetiker.ch/~oetiker/webtools/rrdtool/pub/rrdtool1.2.15.tar.gz
#
#
#
#
#
sudo
sudo
sudo
sudo
sudo
INSTALL CACTI
Set Directory to work From
# sudo cd /var/www/
Get Latest Cacti Tarball
# sudo wget http://www.cacti.net/downloads/cacti-0.8.7b.tar.gz
Untar the Tarfile
# sudo tar xzvf cacti-0.8.6i.tar.gz
Perform the mv command to rename the directory
# sudo mv cacti-0.8.7b cacti
Change directory to cacti directory
# cd cacti
Create Cacti Database
# sudo myssqladmin -u root create cacti
Import the default Cacti Database
# sudo mysql cacti < cacti.sql
Create a cactiuser
# sudo useradd cactiuser
# passwd cactiuser
# userpassword
Make cactiuser part of www-data group
# sudo usermod -G www-data cactiuser
Change owner ship of /var/www/cacti/rra and /var/www/cacti/log directories
# sudo chown -R cactiuser:www-data rra/ log/
Verify owernship of the rra/ log/ directories - list directories with permissions
# ls -l
Create a mysql username and password for cacti
loginto the mysql server
# sudo mysql --user=root
mysql> GRANT ALL ON cacti.* TO cactiuser@'%' IDENTIFIED BY 'password';
mysql> flush privileges
mysql> exit
Edit the /var/www/cacti/include/config.php to specifiy the mysql user, password and
database for your cacti configuration
# vi /var/www/cacti/include/config.php
$database type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "userspassword";
$database_port = "3306";
Make sure the RRDTOOL Binary Path Matches for Ubuntu dapper 6.06 it is
/usr/local/rrdtool-1.2.15/bin/rrdtool - 1.2.15 is the version of rrdtool which may
vary.
PLUGIN ARCHITECTURE INSTALL Before you start Backup you Cacti Install
The Following is a summary of
http://cactiusers.org/wiki/PluginArchitectureInstall
Make a Backup Directory
#sudo mkdir /tmp/Cacti_Backup
Backup your cacti Install
#sudo cp r /var/www/cacti /tmp/Cacti_Backup
Download the Plugin Architecture and the Plugins www.cactiusers.org
*I did this in windows and used winscp to copy the files to the Ubuntu install.
created a downloads directory under root to copy the Plugins Architecture and
Plugins into.
Winscp - http://winscp.net/eng/index.php
Make Sure the Patch command will work for the Plugin Architecture Install to Work.
Install the build-essential
#sudo aptitude install build-essential
Extract the Tar File
#sudo tar -zvxf cacti-plugin-arch.tar.gz
Copy the cacti*.diff file in the plugin-arch directory to the cacti install
directory
#sudo cp cacti-plugin-0.8.7b-PA-v2.0.diff /var/www/cacti
Run the Patch Command from the Cacti Directory to see if there are any errors.
# sudo patch -p1 -N --dry-run < cacti-plugin-0.8.7b-PA-v2.0.diff
If all goes well then Run the Patch
# sudo patch -p1 -N < cacti-plugin-0.8.7b-PA-v2.0.diff
PLUGINS
Most of the Plugins can e installed by following the directions on the cacti user
site.
http://cactiusers.org/wiki/Homepage
http://cactiusers.org/wiki/PluginsInstall
The Plugins are fairly easy to install depending on which one you are doing. Here are just
a few things that might help the install.
You will first need to extract the files and add/copy them to the
/var/www/cacti/plugins directory. Each plugin will have its own folder.
Example... SETTINGS will be /var/www/cacti/plugins/settings
THOLD will be /var/www/cacti/plugins/thold
MONITOR will be /var/www/cacti/plugins/monitor
Then the /var/www/cacti/include/config.php file will need edited with the plugins to
be activated.
#sudo vi /var/www/cacti/include/config.php
Add the lines to the bottom of the file. The top line must be first and
settings should be before thold in order for it to fully function according to
the thold documentation. Other desired plugins will follow.
$plugins = array();
$plugins[] = settings;
$plugins[] = 'thold';
$plugins[] = 'monitor';
$plugins[] = 'discovery';
$plugins[] = syslog;
Here is an example of the /var/www/cacti/include/config.php log file with the
plugins activated.
=
=
=
=
=
'mysql';
'syslog';
'localhost';
'cactiuser';
'CactiMadeEZ';
Add this snippet to it. Dont forget to change the cactiuser and cactipassword to
match your environment.
----------------------------------------#!/bin/bash
if [ -e /var/log/mysql.pipe ]; then
while [ -e /var/log/mysql.pipe ]
do
/usr/bin/mysql -u cactiuser --password=cactipassword syslog < /var/log/mysql.pipe
done
else
mkfifo /var/log/mysql.pipe
fi
----------------------------------------Now make the script executable.
# chmod a+x /var/www/cacti/plugins/syslog/syslog-ng-to-mysql.sh
Run the script and the syslog messages should show up in the database and in the
cacti syslog tab. The & allows it to run in the background.
# /var/www/cacti/plugins/syslog/syslog-ng-to-mysql.sh &
Create a Startup Script so logging starts after a reboot.
#vi /etc/init.d/syslog-ng-fifo-mysql.sh
Enter in this snippet
--------------------------------------#!/bin/sh
echo -n " Syslog-NG FIFO MySQL Logging"
case "$1" in
start)
/var/www/cacti/plugins/syslog/syslog-ng-to-mysql.sh &
;;
stop)
;;
*)
echo ""
echo "Usage: `basename $0` {start}" >&2
exit 64
;;
esac
exit 0
--------------------------------------Make the script executable.
# chmod a+x /etc/init.d/syslog-ng-fifo-mysql.sh
Update the rd.d to run script at bootup.
# update-rc.d /etc/syslog/init.d/syslog-ng-fifo-mysql.sh defaults