EL 7 Cacti Migration / Installation

Stages

Migration off of old server

Disable Poller on Old system

  • Comment out cron job in /etc/cron.d/cacti

Grab a copy of the database

On the old system:

mysqldump -u root -p cacti > cactidump.sql

If you're planning on using this on a galera cluster you will need to replace:

ENGINE=MyISAM

with

ENGINE=InnoDB

Convert the RRD files to XML

(Unverified): You can not just copy the old RRD files.

Run the code from here:  https://github.com/theias/ias_rrdtool_backup_scripts in src/bin/rrdtool_backup_dir.sh

mkdir /var/tmp/xml
rrdtool_backup_dir.sh dump /var/lib/cacti/rra /var/tmp/xml

Transfer the contents of /var/tmp/xml to the new server. If you put it in /var/tmp/xml on the new server, then the command to run is:

rrdtool_backup_dir.sh restore /var/tmp/xml /var/lib/cacti/rra
chown -R cacti /var/lib/cacti/rra

Install apache

You'll need to install apache and configure your system so that prot 443 (or... 80, if that's your thing) is available.

Installation of New Cacti

Cacti Packages

Note: This has currently only been tested with PHP5

yum install cacti php

Cacti Database Creation

If this is a standalone install:

yum install mariadb
# in the database
create database cacti
grant all privileges on cacti.* to 'cactiuser'@'localhost' identified by PUT_PASSWORD_HERE

# On command line:
mysqldump -u cactiuser -p cacti < /root/cactidump.sql

Change the appropriate fields in /etc/cacti/db.php for the database

You might need to initialize the timezone database (if it hasn't been done before):

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

You might need to add this to /etc/php.ini:

date.timezone = America/New_York

Cacti database configuration

  • edit /etc/cacti/db.php to reflect database settings

Cacti Apache Configuration

I don't know how much this differs from what's documented, but it works for us:

#
# Cacti: An rrd based graphing tool
#

# For security reasons, the Cacti web interface is accessible only to
# localhost in the default configuration. If you want to allow other clients
# to access your Cacti installation, change the httpd ACLs below.
# For example:
# On httpd 2.4, change "Require host localhost" to "Require all granted".
# On httpd 2.2, change "Allow from localhost" to "Allow from all".

Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>
DirectoryIndex index.php
	Require all granted
    Options indexes FollowSymLinks
        IndexOptions NameWidth=*

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

</Directory>

<Directory /usr/share/cacti/install>
	# mod_security overrides.
	# Uncomment these if you use mod_security.
	# allow POST of application/x-www-form-urlencoded during install
	#SecRuleRemoveById 960010
	# permit the specification of the rrdtool paths during install
	#SecRuleRemoveById 900011
</Directory>


# These sections marked "Require all denied" (or "Deny from all")
# should not be modified.
# These are in place in order to harden Cacti.
<Directory /usr/share/cacti/log>
	<IfModule mod_authz_core.c>
		Require all denied
	</IfModule>
	<IfModule !mod_authz_core.c>
		Order deny,allow
		Deny from all
	</IfModule>
</Directory>
<Directory /usr/share/cacti/rra>
	<IfModule mod_authz_core.c>
		Require all denied
	</IfModule>
	<IfModule !mod_authz_core.c>
		Order deny,allow
		Deny from all
	</IfModule>
</Directory>

 

Cacti should be available

Brows to http(s)://cacti3.net.ias.edu/cacti/

Installation of Spine

yum groupinstall 'Development Tools'
yum install \
glibc-devel.i686 \
libstdc++-devel.i686 \
mariadb-devel \
net-snmp-devel \
openssl-devel \
help2man 
wget http://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz

tar xzvf ...

./configure
make
make install

cd /usr/local/spine/etc
cp spine.conf.dist spine.conf

Edit /usr/local/spine/etc/spine.conf to reflect your database settings for cacti.

Configure Cacti to use new Spine

In the web interface, click the Console tab. Navigate to Settings - Paths Look for the spine settings.

console -> settings -> paths
/usr/local/spine/bin/spine
/usr/local/spine/etc/spine.conf

Re-enable and test poller

Test the poller with:

screen
sudo -u cacti /usr/bin/php /usr/share/cacti/poller.php --debug

Re-enable the cron job in /etc/cron.d/cacti