Moving Cacti to a Permanent Home

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Moving Cacti to a Permanent Home

Post by bmote »

Has anyone moved their Cacti installation? I am using the documentation as a guide, but I'm looking for any gotchas.

I have been using this to backup my Cacti installation weekly (/etc/cron.weekly/cactibackup):

Code: Select all

currentDatetime=`date +%Y%m%d%H%M`
backupDir=/var/backups

mysqldump -l --add-drop-table cacti -u cacti -pT4CkV985YM5V > $backupDir/$currentDatetime-cacti-mysql-backup.sql
gzip $backupDir/$currentDatetime-cacti-mysql-backup.sql

ls -1 /var/www/html/cacti/rra/*.rrd | awk '{print "rrdtool dump "$1" > "$1".xml"}' | sh -x

tar zcfpv $backupDir/$currentDatetime-cacti-config-backup.tgz /var/www/html/cacti/include/config.php /etc/snmp/snmpd.conf /etc/my.cnf /etc/httpd/conf.d/cacti.conf /etc/spine.conf /etc/php.ini /etc/php.d/mysql.ini /etc/php.d/snmp.ini /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/php.conf /var/www/html/cacti/rra/*.xml /var/www/html/cacti/scripts/* /var/www/html/cacti/plugins/* /var/www/html/cacti/resource/* --index-file=$backupDir/$currentDatetime-backup.log

rm /var/www/html/cacti/rra/*.xml

# to import the RRD data run the following commands:

# sudo rm /var/www/html/cacti/rra/*.rrd
# sudo ls -1 /var/www/html/cacti/rra/*.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sudo sh -x
# sudo rm /var/www/html/cacti/rra/*.xml
# sudo chown cacti:cacti *
I end up with 2 files each week: 201008150422-cacti-mysql-backup.sql.gz and 201008150422-cacti-config-backup.tgz are my most recent backups. As a side note; I also put the files I used for the installation into /var/backups. That gives me one tidy spot to find everything:

Code: Select all

cacti-spine-0.8.7g.tar.gz
cacti-0.8.7g.tar.gz
cacti-plugin-0.8.7g-PA-v2.8.tar.gz
I have just executed the following command and the packages are installed:

Code: Select all

sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
sudo yum install -y httpd php php-mysql php-snmp php-xml mysql mysql-server net-snmp net-snmp-utils rrdtool gcc mysql-devel net-snmp-devel
That will get me everything I need to install Cacti and Spine.

I can extract Cacti, the plugin architecture and make/install Spine, but am I missing anything? I'll continue this post as I go through the process. Hopefully at the end I'll have an easy to read how-to ;)

Set our 3 new services to start automatically and start them:

Code: Select all

sudo /sbin/chkconfig httpd on 
sudo /sbin/chkconfig snmpd on 
sudo /sbin/chkconfig mysqld on 
sudo /etc/init.d/httpd restart 
sudo /etc/init.d/mysqld restart 
sudo /etc/init.d/snmpd restart 
Last edited by bmote on Thu Aug 19, 2010 10:13 am, edited 14 times in total.
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

It doesn't appear to be missing anything. The only thing I would change is:

Code: Select all

currentDatetime=`date +%Y%m%d%I%M`
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

Thanks for the tip!
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

I should have noted that on my fresh RHEL 5.5 installation I had to add the EPEL repository to gain access to the rrdtool package:

Code: Select all

sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
After installing http, mysql and snmp I executed these statements:

Code: Select all

sudo /sbin/chkconfig httpd on
sudo /sbin/chkconfig snmpd on
sudo /sbin/chkconfig mysqld on
sudo /etc/init.d/httpd restart
sudo /etc/init.d/mysqld restart
sudo /etc/init.d/snmpd restart
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

I don't see a backup of:

Code: Select all

/etc/snmp/snmpd.conf
/etc/snmp/snmp.conf
/etc/my.cnf
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

I am adding /etc/snmp/snmpd.conf to the backup routine as that was an oversight. I did not add /etc/my.cnf because I had not changed it, nor was I instructed to do so during the installation process. I will, however, add it to my backup if it's a likely candidate for modification.

Thanks for the tips!
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

Now I'm getting into the meat and potatoes. With the files from my backup in my new home directory I executed the following:

Code: Select all

tar xfv cacti-0.8.7g.tar.gz
sudo mkdir /var/www/html/cacti
cd cacti-0.8.7g
sudo mv * /var/www/html/cacti/
cd ~
tar xfv cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cd cacti-plugin-arch/files-0.8.7g
sudo mv * /var/www/html/cacti/
sudo mv images /var/www/html/cacti/images/
sudo mv lib /var/www/html/cacti/lib/
sudo mv include /var/www/html/cacti/include/
cd ~
tar xfv cacti-spine-0.8.7g.tar.gz
cd cacti-spine-0.8.7g
./configure
sudo make
sudo make install
Slowly but surely ...
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

After extracting my "config" backup I executed the following from my home directory:

Code: Select all

sudo cp -r etc /
sudo cp -r var /
Now we have Cacti, the Plugin Architecture and Spine + all our config and RRD files restored.

This is how I finished the installation:

Code: Select all

mysqladmin -u root password NEWPASSWORD
mysql -u root -pNEWPASSWORD -e 'create database cacti'
mysql -u root -pNEWPASSWORD
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'SOMEOTHERNEWPASSWORD';
mysql> FLUSH privileges;
mysql> \q
sudo /usr/sbin/adduser cacti
sudo passwd cacti
{followed by the entry of SOMEOTHERNEWPASSWORD}
Now I need to decompress my SQL backup and apply it:

Code: Select all

gzip -d 201008171118-cacti-mysql-backup.sql.gz
mysql -u cacti -pSOMEOTHERNEWPASSWORD cacti < 201008171118-cacti-mysql-backup.sql
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

So, I thought I was done. I double checked everything but when I opened my browser with http://server/cacti all I got was a blank screen.

I looked at the directory permissions and some needed changed. I'll highlight that in another post. Corrected all that stuff and still nothing.

I looked at the other post on here regarding the blank white screen. There was a command listed that showed me the output and led me to the conclusion that none of my modules were being loaded.

I checked my config to ensure the extension_dir was pointed to /usr/lib/php/modules. Then I found /usr/lib/php/modules didn't exist. I double checked that I had installed php-mysql php-snmp php-xml, etc. All there. I removed them and re-added them. Nada.

I took a snapshot of the server before starting everything so I decided to revert to it and re-trace my steps.

I completed the same tasks as before with the only exception being adding a '-y' to my yum install command.

Everything completed successfully (again.) The /usr/lib/php/modules directory still did not exist.

Then I decided to make the phpinfo() output work for me. My server had been serving pages before. I could see the welcome page. I figured I'd dig through the phpinfo for some nuggets. Well, there it was. In all it's glory ...

/usr/lib64/php/modules

My sandbox machine that I had built had been 32-bit. The machine our tech services built for me was 64-bit :)

I lost most of a days worth of work today, but I did learn how to use phpinfo() and that there are some actual differences to the directory structure with a 64-bit installation.

All-in-all not a hateful day. I just wish I had Cacti up and running on its official home.
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests