Migrating Cacti Database

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
scheema31
Posts: 12
Joined: Fri Feb 28, 2014 5:07 pm

Migrating Cacti Database

Post by scheema31 »

Hi,

I am working on migrating cacti from Linux RedHat Server to Linux RedHat 7 Server.
I am using this article to do the migration and am having issues with the restore process of the database.
I did a sqldump on old server and populated the new database (on rhel7).
However when i run the command to see my database tables i dont see any enteries as i do on old server when i run the same command.
Any thoughts?

Thanks,
smiles
Cacti User
Posts: 79
Joined: Mon Sep 10, 2012 5:54 pm

Re: Migrating Cacti Database

Post by smiles »

mysql –p
> CREATE DATABASE cacti;

mysql –u cacti –p cacti < cacti_db_backup_filename.sql

mysql –p
> GRANT ALL PRIVILEGES ON cacti.* TO cacti@localhost IDENTIFIED BY “yourdbuserpassword”;
> FLUSH PRIVILEGES;
scheema31
Posts: 12
Joined: Fri Feb 28, 2014 5:07 pm

Re: Migrating Cacti Database

Post by scheema31 »

Perfect that worked smiles, thanks
now i can see my database entries from old server and i can see the devices listed on the webpage for cacti.
they arent creating any graphs though, might be permissions issue or do i have to re import the rrd files?
before i readded the database as smiles instructed i did migrate the rrd files from old server by exporting them as xml and then re-importing to new server.

Code: Select all

Step 4.1: Old Server
 - On the old server, convert RRD files into XML files as follows.
 - Create a directory to store the XML files.
    # mkdir /tmp/xml
    # cd /var/lib/cacti/rra
 - Convert the RRD files to XML files.
    # for i in `find -name "*.rrd"`; do rrdtool dump $i > /tmp/xml/$i.xml; done
 - Create a tar file.
    # cd /tmp/xml
    # tar cvfz cacti.tar.gz *
 - Copy the tar file to the new server.
    # scp cacti.tar.gz root@NewServerIP:/root

Step 4.2: New Server

 - On the new server, we will copy the tar file to the right directory and extract the contents. After extraction, we will restore the RRD files from the XML ones.
 - Copy and extract the files to the right directory.
    # cp /root/cacti.tar.gz /var/lib/cacti/rra
    # cd /var/lib/cacti/rra
    # tar zxvf cacti.tar.gz
 - Restore the RRD files from the XML files.
    # for i in `find -name "*.xml"`; do rrdtool restore $i `echo $i |sed s/.xml//g`; done 
Thanks,
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Migrating Cacti Database

Post by phalek »

Yes it can be a permission, or your cronjob entry doesn't exist yet ... ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
scheema31
Posts: 12
Joined: Fri Feb 28, 2014 5:07 pm

Re: Migrating Cacti Database

Post by scheema31 »

i have the cron file (/etc/cron.d/cacti configured as

Code: Select all

*/5 * * * *	cacti	/usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1 
And it has root permission, also rrd files have root permission.
also where can i confirm what rra location i should be using, there are couple locations which have that folder.

thanks
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Migrating Cacti Database

Post by cigamit »

Show us the permissions on the RRD files.

You say they have root permission (meaning owned by root I assume) but you are setting the poller to run as "cacti". Does the Cacti user actually exist? Does the webserver at least have access to read the rrd files?
scheema31
Posts: 12
Joined: Fri Feb 28, 2014 5:07 pm

Re: Migrating Cacti Database

Post by scheema31 »

Hi,

Here are the permissions on few of the rrd files (which are located in /usr/share/cacti/rra/

Code: Select all

-rwxr-xr-x 1 root  root   47992 Nov 23 15:07 /usr/share/cacti/rra/sv-baydevweb-04_baynet_local_cpu_1315.rrd
-rwxr-xr-x 1 root  root   47992 Nov 23 15:07 /usr/share/cacti/rra/sv-baydevweb-04_baynet_local_cpu_1368.rrd
-rwxr-xr-x 1 root  root   94816 Nov 23 15:07 /usr/share/cacti/rra/sv-baydevweb-04_baynet_local_hdd_used_1311.rrd
and yes the cacti user does exist in the system,

Code: Select all

[root@svprodmon01 ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
nagios:x:1001:1001::/home/nagios:/bin/bash
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin
cacti:x:986:981::/usr/share/cacti:/sbin/nologin
how/where can i check if webserver has access to read the rrd files?

Thanks,
scheema31
Posts: 12
Joined: Fri Feb 28, 2014 5:07 pm

Re: Migrating Cacti Database

Post by scheema31 »

im seeing these errors in cacti.log
11/30/2016 06:41:24 PM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'sv-baydevweb-04.baynet.local', and OID:'.1.3.6.1.2.1.1.3.0'
does this look like a permission thing?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Migrating Cacti Database

Post by phalek »

your permissions are wrong. Execute the following:

Code: Select all

chown cacti.apache /usr/share/cacti/rra
chown cacti.apache /usr/share/cacti/rra/*.rrd
chmod 664 /usr/share/cacti/rra/*.rrd
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
scheema31
Posts: 12
Joined: Fri Feb 28, 2014 5:07 pm

Re: Migrating Cacti Database

Post by scheema31 »

i have made the permission changes but i am still seeing these kinda errors in log for all servers,

Code: Select all

12/01/2016 08:01:02 PM - CMDPHP: Poller[0] Host[89] DS[928] WARNING: Result from CMD not valid.  Partial Result: U
12/01/2016 08:01:02 PM - CMDPHP: Poller[0] Host[89] DS[929] WARNING: Result from CMD not valid.  Partial Result: U
12/01/2016 08:01:04 PM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'sv-baydevsql-04.baynet.local', and OID:'.1.3.6.1.2.1.1.3.0'"
but when i run the snmpwalk command manually from command it passes
[/code]
[root@svprodmon01 ~]# snmpwalk -v 1 -c public sv-baydevweb-04.baynet.local .1.3.6.1.2.1.1.3.0
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (127279117) 14 days, 17:33:11.17
[/code]
i also wanna show the settings page, maybe something looks wrong there? (added as a pics)
Attachments
CACTI2.png
CACTI2.png (70.19 KiB) Viewed 1650 times
CACTI1.png
CACTI1.png (60.74 KiB) Viewed 1650 times
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Migrating Cacti Database

Post by phalek »

These are not permission errors. They only show that Cacti wasn't able to retrieve data from the device, either because it is unreachable (timeout) or it simply didn't retrun any data ( Partial Result: U )
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
scheema31
Posts: 12
Joined: Fri Feb 28, 2014 5:07 pm

Re: Migrating Cacti Database

Post by scheema31 »

Thanks Phalek,

Do you know where i can go from here to troubleshoot why cacti isn't able to retrieve data from device?
thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests