Question on How to Install Cacti 1.2 beta

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

Moderators: Developers, Moderators

Post Reply
lynx649
Posts: 5
Joined: Tue Oct 16, 2018 11:04 pm

Question on How to Install Cacti 1.2 beta

Post by lynx649 »

Hi,

I've been having issues installing 1.1.38 on Ubuntu 18.04 but understand there may be some incompatibilities so thought I'd try 1.2

I've extracted the tar file but am unsure of what to do next, do I need to overwrite the 1.1.38 install ?

If someone could give me a quick rundown on how install 1.2 from the tar.gz that would be much appreciated.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Question on How to Install Cacti 1.2 beta

Post by netniV »

I would extract that tar into the same directory as your 1.1.38 installation. Depending on what you have done with 1.1.38, you have two choices:

Start afresh (my preferred route if non-production)
If you have not really used the 1.1.38 installation, I would
  1. Using MySQL or phpMyAdmin, prime the database as an empty 1.2 DB by:
    • Removing all tables in the database that it points to.
    • Running: source <cacti>/cacti.sql
  2. Navigate to http://<cacti>/install/
  3. Login and authenticate
  4. Step through the installation wizard
    • For automation
      • Set the automation network range
      • Enable scanning by default
      • Set any custom SNMP details required
    • For templates, select all
  5. Launch cacti once installed
Upgrade
If you really used and don't want to drop the 1.1.38 installation, you would follow the above steps skipping the database stuff. You won't get an option to automatically enable the automation stuff or import templates, but you can do that manually after the fact once the upgrade is complete.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
lynx649
Posts: 5
Joined: Tue Oct 16, 2018 11:04 pm

Re: Question on How to Install Cacti 1.2 beta

Post by lynx649 »

Thanks for your answer! I was able to get 1.2 installed (i think!) but am receiving the same error as i was using in 1.1.38

"FATAL: Connection to Cacti database failed. Please ensure:

the PHP MySQL module is installed and enabled.
the database is running.
the credentials in config.php are valid."

I can access the db I created using the cli and can see all the tables using mariadb but cacti won't connect to it. I have also granted permissions to the cacti_user I created. I have verified credentials in include/config.php.

Any suggestions? I do notice the cacti.log is 0 bytes and is not growing, I noticed in the installation steps it says to grant cactiuser permissions to /log but does this just mean any user ? I have created a db cacti_user, do I need to create a specific cacti Ubuntu user account as well? Apologies if these questions sound a bit silly.

Thanks.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Question on How to Install Cacti 1.2 beta

Post by netniV »

Check that you have configured the settings properly in the include/config.php file (not the config.php.dist file).
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
lynx649
Posts: 5
Joined: Tue Oct 16, 2018 11:04 pm

Re: Question on How to Install Cacti 1.2 beta

Post by lynx649 »

netniV wrote:Check that you have configured the settings properly in the include/config.php file (not the config.php.dist file).
I have double checked the settings and everything looks ok, I can access the DB using the MariaDB CLI using the same credentials. I am not seeing any failed logins in syslog and am seeing nothing in cacti.log, it is still only showing zero bytes... and other suggestions of what I can check?

/*
* Make sure these values reflect your actual database/host/user/password
*/

$database_type = 'mysqli';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti_user';
$database_password = '**hidden**';
$database_port = '3306';
$database_ssl = false;
$database_ssl_key = '';
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Question on How to Install Cacti 1.2 beta

Post by netniV »

Hmm, check what ports the SQL server is listening on. It may not be listening on localhost or via a socket.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
lynx649
Posts: 5
Joined: Tue Oct 16, 2018 11:04 pm

Re: Question on How to Install Cacti 1.2 beta

Post by lynx649 »

netniV wrote:Hmm, check what ports the SQL server is listening on. It may not be listening on localhost or via a socket.
A couple of notes, it appears to be listening on 3306 however the hostname in mariadb is not showing as localhost, it shows as lynx-panther, the computers name. I'm not sure how to change that, i ensured the /etc/hosts file was showing 127.0.0.1 as localhost.

I'm starting to suspect the problem goes deeper and I may have a FUBAR mysql install as if I try to reinstall mysql i get lots of errors (on my phone at the moment so I don't have the specific errors,) but if I reinstall mariadb-server (which is installing mysql dependencies presumably?) the install appears fine but I get the aforementioned behavior... I will try this weekend on a virtual machine from scratch and see how I go.

Thanks for your help.
lynx649
Posts: 5
Joined: Tue Oct 16, 2018 11:04 pm

Re: Question on How to Install Cacti 1.2 beta

Post by lynx649 »

I managed to sort out the issue, I started monitoring the apache2 error.log and was seeing PHP fatal errors, 'undefined class constant'. After a bit of research, it looked like pdo_mysql was the culprit. I ran sudo phpenmod pdo_mysql but was receiving an error that it was not in the 7.2 mods folder. I decided to completely remove php-common and other dependencies and reinstall php7.0 from scratch, after that and reinstalling cacti, i enabled the pdo mod and was off the races. A few permission issues I had to sort out and enabling other php plugins but now I think I'm finally there and am graphing my Mikrotik Interfaces :lol:

Thanks for your help netniV and if anyone else is getting the cacti cannot connect to database error in apache when everything else seems set up correctly, double check that pdo_mysql is installed and running!
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Question on How to Install Cacti 1.2 beta

Post by xdracco »

I upgraded from 1.1.18 to 1.20 today and recieved this error during installation.
lynx649 wrote:"FATAL: Connection to Cacti database failed. Please ensure:

the PHP MySQL module is installed and enabled.
the database is running.
the credentials in config.php are valid."
I fixed the issue by commenting out the line pointing to mysqld.sock and uncommenting the line pointing to localhost (in config.php):

Code: Select all

//$database_hostname = "/run/mysqld/mysqld.sock";
$database_hostname = "127.0.0.1";
Curious. I have this configured in spine.conf:

Code: Select all

DB_Host         /run/mysqld/mysqld.sock
... and spine continues to function:

Code: Select all

# spine -C ./spine.conf --snmponly
SPINE: Using spine config file [./spine.conf]
SPINE: Version 1.2.0 starting
SPINE: Time: 1.0402 s, Threads: 15, Devices: 3
The socket file exists, otherwise spine wouldn't work but here it is anyways:

Code: Select all

# ls -l /run/mysqld/mysqld.sock
srwxrwxrwx 1 mysql mysql 0 Jan  2 22:20 /run/mysqld/mysqld.sock
Any ideas why I need to change the hostname in config.php?

Thanks
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Question on How to Install Cacti 1.2 beta

Post by netniV »

There was a fix for something to do with using a socket (https://github.com/Cacti/cacti/issues/622) which was then updated in PR #1587 (https://github.com/Cacti/cacti/issues/1587) before being finally tweaked.

Code: Select all

 if (is_file($device) && filetype($device) == 'socket') {
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Question on How to Install Cacti 1.2 beta

Post by xdracco »

new variable works (obv). makes sense that a new variable was added for using sockets.

thank you.
The answer to life, the universe and everything is int main() { return 42; }
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests