Problems during upgrading cacti

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

Moderators: Moderators, Developers

Post Reply
Author
Message
tomowariacina
Posts: 5
Joined: Sat Dec 07, 2019 8:55 am

Problems during upgrading cacti

#1 Post by tomowariacina » Sat Dec 07, 2019 9:14 am

Sup guys. My problem is kinda diffucult (at least for me), so I'm gonna ask you for an advice.

Introducing you to my problem I have to say that I'm nooby at mysql and php - just isn't my thing. I have a task to migrate cacti and other monitoring systems which are running on Slackware 10. Also the mysql version installed there isn't the newest:

Code: Select all

mysql  Ver 12.22 Distrib 4.0.27, for slackware-linux-gnu (i486)
So the things I've done are:
1. Installation the new OS (Debian 10) and the newest version of MariaDB.
2. Copied the rra, script and resource folders to new machine.
3. Copied the old database to newly created (with amounts of problems but finally I've made that).
4. Installed cacti and turned it on.

I've seen the updating process so I said "ok". But this process ended by errors like that (pointing at failure during that):

Code: Select all

UPDATE `settings` SET name = 'user_template' WHERE name = 'ldap_template';
UPDATE settings SET name='path_spine' WHERE name='path_cactid';
When i pasted that into console error was:

Code: Select all

ERROR 1062 (23000): Duplicate entry 'user_template' for key 'PRIMARY'
So I deleted this entry (path_spine f.e.), run command one more time and it works. But then when i restarted apache and mariadb services cacti said that it was installed/updated with errors:

Code: Select all

2019/12/07 13:25:57 - INSTALL: always: Installation was started at 2019-12-07 12:24:01, completed at 2019-12-07 12:25:57
2019/12/07 13:25:57 - INSTALL: always: WARNING: One or more upgrades failed to install correctly
2019/12/07 13:25:57 - INSTALL: always: Finished UPGRADE Process for v1.2.7
2019/12/07 13:24:03 - INSTALL: always: Upgrading from v0.8.6j (DB 1.2.7 (DB: 0.8.6j)) to v0.8.7
2019/12/07 13:24:03 - INSTALL: always: NOTE: Using temporary file for db cache: /tmp/cdu22wuDq
2019/12/07 13:24:02 - INSTALL: always: Switched from to /tmp/cdu22wuDq
2019/12/07 13:24:02 - INSTALL: always: No tables where found or selected for conversion
2019/12/07 13:24:02 - INSTALL: always: Starting UPGRADE Process for v1.2.7
2019/12/07 13:24:01 - INSTALL: always: Setting PHP Option memory_limit = -1
2019/12/07 13:24:01 - INSTALL: always: Setting PHP Option max_execution_time = 0
2019/12/07 13:24:01 - INSTALL: Checking arguments
2019/12/07 13:24:00 - INSTALL: always: Spawning background process: /usr/bin/php '/opt/cacti/install/background.php' 1575721440.8931
So I'm stack in here. I've also got Zabbix system installed so it's not necessary to cacti running but sometimes it's useful tool. Any ideas what am I doing wrong? Maybe I've made mistakes during the installation and migrating old cacti? Waiting for your responses ;)!

User avatar
Osiris
Cacti Pro User
Posts: 889
Joined: Mon Jan 05, 2015 10:10 am

Re: Problems during upgrading cacti

#2 Post by Osiris » Sat Dec 07, 2019 4:16 pm

MariaDB 5.5 or MySQL 5.6 or better required for Cacti 1.x.
Before history, there was a paradise, now dust.

User avatar
Osiris
Cacti Pro User
Posts: 889
Joined: Mon Jan 05, 2015 10:10 am

Re: Problems during upgrading cacti

#3 Post by Osiris » Sat Dec 07, 2019 4:18 pm

Grab the latest branch 1.2.x or 1.2.8 and try upgrading again. 1.2.8 should be released in next 48 hours.
Before history, there was a paradise, now dust.

tomowariacina
Posts: 5
Joined: Sat Dec 07, 2019 8:55 am

Re: Problems during upgrading cacti

#4 Post by tomowariacina » Sun Dec 08, 2019 7:23 am

That's the version of MariaDB installed on new OS, so it's up to date.

Code: Select all

mysql  Ver 15.1 Distrib 10.3.18-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Going to wait for new release then and hope it will work. I will notify you after that.

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: Problems during upgrading cacti

#5 Post by netniV » Sun Dec 08, 2019 12:07 pm

You likely had a populated 1.x database and then imported your old database. All you need to do is clear out your new database, import the old and then run through the upgrade. If you installed via a package, that is most likely why you had new tables already. Either that or you manually imported the cacti.sql script before reloading your dump.

tomowariacina
Posts: 5
Joined: Sat Dec 07, 2019 8:55 am

Re: Problems during upgrading cacti

#6 Post by tomowariacina » Mon Dec 09, 2019 10:28 am

OK, so I was waiting for 1.2.8 and hoping that it will work. But it doesn't :<! I created new VM to do that but still have got the same errors which I had before. I'm going to show you step by step what am i doing in my migration process - maybe something is really wrong and badly made by me.

Code: Select all

# apt update
# apt install wget patch unzip zip bash-completion
# apt install -y mariadb-server mariadb-client
# mysql_secure_installation

# mysql -u root -p
> create database cacti;
> grant all on cacti.* to 'xxx'@'localhost' identified by 'xxx';
> flush privileges;
> exit

# nano /etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld]
collation-server = utf8mb4_unicode_ci
character-set-server = utf8mb4
max_heap_table_size = 128M
tmp_table_size = 64M
join_buffer_size = 64M
innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_buffer_pool_size = 1GB
innodb_buffer_pool_instances = 10
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000
innodb_doublewrite = off

# apt install -y apache2 libapache2-mod-php php-xml php-ldap php-mbstring php-gd php-gmp php-mysql
# nano /etc/php/7.3/apache2/php.ini
date.timezone = Europe/Warsaw
memory_limit = 512M
max_execution_time = 60
file_uploads = On
# nano /etc/php/7.3/cli/php.ini
date.timezone = Europe/Warsaw
memory_limit = 512M
max_execution_time = 60
file_uploads = On

# mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql
# mysql -u root -p -e 'grant select on mysql.time_zone_name to [email protected]'
# systemctl restart apache2
# systemctl restart mariadb

# apt install -y snmp php-snmp rrdtool librrds-perl
# apt install build-essential dos2unix dh-autoreconf help2man libssl-dev libmariadb-dev libmariadbclient-dev librrds-perl libsnmp-dev
# wget https://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz
# tar xfz cacti-spine-latest.tar.gz
# cd cacti-spine-1.2.8/
# ./bootstrap
# ./configure
# make
# make install
# chown root:root /usr/local/spine/bin/spine
# chmod +s /usr/local/spine/bin/spine
# nano /usr/local/spine/etc/spine.conf
DB_Host localhost
DB_Database cacti
DB_User xxx
DB_Pass xxx
DB_Port 3306
DB_PreG 0

# wget https://www.cacti.net/downloads/cacti-latest.tar.gz
# tar -zxvf cacti-latest.tar.gz
# mv cacti-1* /opt/cacti
# mysql -u root -p cacti < cacti.sql (here's the migration of working database on other VM)


# nano /opt/cacti/include/config.php
$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'xxx';
$database_password = 'xxx';
$database_port = '3306';
$database_retries = 5;
$database_ssl = false;
$database_ssl_key = '';
$database_ssl_cert = '';
$database_ssl_ca = '';

#nano /etc/cron.d/cacti
*/5 * * * * www-data php /opt/cacti/poller.php > /dev/null 2>&1

#nano /etc/apache2/sites-available/cacti.conf
Alias /cacti /opt/cacti

<Directory /opt/cacti>
Options +FollowSymLinks
AllowOverride None
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfVersion < 2.3>
Order Allow,Deny
Allow from all
</IfVersion>

AddType application/x-httpd-php .php

<IfModule mod_php.c>
php_flag magic_quotes_gpc Off
php_flag short_open_tag On
php_flag register_globals Off
php_flag register_argc_argv On
php_flag track_vars On
# this setting is necessary for some locales
php_value mbstring.func_overload 0
php_value include_path .
</IfModule>

DirectoryIndex index.php
</Directory>

# a2ensite cacti
# systemctl restart apache2
# touch /opt/cacti/log/cacti.log
# chown -R www-data:www-data /opt/cacti/

# mysql -u root -p
> use cacti
> alter table user_auth
-> add enabled varchar(255);
> update user_auth set enabled=('on');
> flush privileges;
> quit
Without migration of the old database everything works fine (checked that before). And as I said before - I've got the same errors again. Any propositions/advices?

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: Problems during upgrading cacti

#7 Post by netniV » Mon Dec 09, 2019 10:52 am

Is there any chance of having a copy of your dumped data? That would allows us to test the migration ourselves to see if there is something strange. Also, when you look at the dump data, does those tables already exist in the dump? That would suggest that the old database already had an upgrade attempted at some point.

tomowariacina
Posts: 5
Joined: Sat Dec 07, 2019 8:55 am

Re: Problems during upgrading cacti

#8 Post by tomowariacina » Mon Dec 09, 2019 3:39 pm

OK, after nap I realised that it happens because of really old version of cacti. It's not possible to update to 1.2.8 from 0.8.6j. So in my free-time I'm gonna update it step by step and gonna se what will happen.

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: Problems during upgrading cacti

#9 Post by netniV » Mon Dec 09, 2019 5:17 pm

We have tested from 0.8.8 through to 1.2.8 (I think that was 0.8.8h but I think 0.8.8 itself should work).

tomowariacina
Posts: 5
Joined: Sat Dec 07, 2019 8:55 am

Re: Problems during upgrading cacti

#10 Post by tomowariacina » Mon Dec 09, 2019 6:05 pm

For me it's kinda hard to say that 12yo cacti database which have never been updated will work with the newest one beacuse the standards were changing and technology is moving forward :DD! And still 0.8.8 is 2011 (as i remember well), not 2007! Anyway, I'll update this topic in the future while updating cacti to the newer versions - seems interesting :P!

Post Reply