Koozali.org formerly Contribs.org

Smokeping

Offline Brenno

  • ****
  • 208
Re: Smokeping
« Reply #15 on: July 03, 2020, 04:49:25 PM »
3. Create a corrected copy of the template
Code: [Select]
sed -e 's/DbName/DbDatabase/' \
    -e 's/\([^\]\)@/\1\\@/' \
    -e 's/`mysql`.`time_zone_name`/mysql.time_zone_name/' \
    -e 's|/etc/e-smith/db/configuration/migrate/80cacti_sme.sql|/usr/share/doc/cacti-1.1.19/cacti.sql|' \
    /etc/e-smith/templates/etc/e-smith/sql/init/80cacti \
    > /etc/e-smith/templates-custom/etc/e-smith/sql/init/80cacti

I'm getting an error when I run this command:

Code: [Select]
-bash: /etc/e-smith/templates-custom/etc/e-smith/sql/init/80cacti: No such file or directory

Do you mean to use /etc/e-smith/templates/etc/sql/init?  My templates-custom folder only has a /etc/php.ini folder in it.

Offline mmccarn

  • *
  • 2,540
Re: Smokeping
« Reply #16 on: July 04, 2020, 01:27:09 PM »
Doh. 
Many apologies -- looking back at the notes I have posted I see that I neglected to include a command to create the destination custom template folder first:

Code: [Select]
# create custom template destination
mkdir -p /etc/e-smith/templates-custom/etc/e-smith/sql/init/
#
# copy and customize the default template
sed -e 's/DbName/DbDatabase/' \
    -e 's/\([^\]\)@/\1\\@/' \
    -e 's/`mysql`.`time_zone_name`/mysql.time_zone_name/' \
    -e 's|/etc/e-smith/db/configuration/migrate/80cacti_sme.sql|/usr/share/doc/cacti-1.1.19/cacti.sql|' \
    /etc/e-smith/templates/etc/e-smith/sql/init/80cacti \
    > /etc/e-smith/templates-custom/etc/e-smith/sql/init/80cacti

Offline Brenno

  • ****
  • 208
Re: Smokeping
« Reply #17 on: July 06, 2020, 04:26:43 PM »
I've made some more progress after following your instructions to create the custom template.

When I ran
Code: [Select]
service mysql.init restart it hung on Loading cacti into mysql.  After letting it sit for several minutes, I used Ctrl-C to get back to a prompt.  At that point, I could see that the cacti_sme database wasn't yet created.  I then restarted the server with the post-upgrade/reboot commands.

After the restart, I could see the cacti_sme database and associated tables now existed.  However, when I tried to view Cacti through the web browser it was telling me that the Cacti database was not initialized - providing instructions to create a user and grant privileges - so it seems the commands in the custom template weren't executed?  Or maybe I have to edit the Cacti config files to see what was set up in the custom template?

Offline Brenno

  • ****
  • 208
Re: Smokeping
« Reply #18 on: July 13, 2020, 04:52:36 PM »
So, to get this working do I have to run the commands that Warren suggested for setting setting up the DB:

Code: [Select]
/usr/bin/mysql
use cacti_sme;
GRANT ALL PRIVILEGES ON cacti_sme.* TO cacti@localhost IDENTIFIED BY 'changeme';
use mysql;
GRANT SELECT ON `mysql`.`time_zone_name` TO 'cacti'@'localhost';
flush privileges;

I'm thinking these won't work as-is because we changed the password from the default "changeme" per a later post:

Code: [Select]
config setprop cacti DbPassword $(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;)

So if I need to update the commands that Warren suggested to use the new password, where do I find the password that was generated from mmccarn's command?

Offline mmccarn

  • *
  • 2,540
Re: Smokeping
« Reply #19 on: July 15, 2020, 01:54:56 PM »
Show all of the cacti settings:
Code: [Select]
config show cacti
or just show the database password:
Code: [Select]
config getprop cacti DbPassword

Offline Brenno

  • ****
  • 208
Re: Smokeping
« Reply #20 on: July 15, 2020, 08:11:24 PM »
Thank you for that.

I ran the commands Warren suggested but it kept coming back and saying 0 rows affected, so I suspected nothing was actually happening.  I installed PHPMyAdmin so I could get a look at things a little better and I could see the cacti_sme DB was present, the cacti user was present but the permissions were not set.  I manually set the permissions using PHPMyAdmin, but when I try to pull Cacti up in my browser it's still telling me it's not initialized:

Code: [Select]
The Cacti Database has not been initialized. Please initilize it before continuing.

To initilize the Cacti database, issue the following commands either as root or using a valid account.

mysqladmin -uroot -p create cacti

mysql -uroot -p -e "grant all on cacti.* to 'someuser'@'localhost' identified by 'somepassword'"

mysql -uroot -p -e "grant select on mysql.time_zone_name to 'someuser'@'localhost' identified by 'somepassword'"

mysql -uroot -p cacti < /pathcacti/cacti.sql

Where /pathcacti/ is the path to your Cacti install location.

The only bit that wasn't done manually (in Warren's commands) was the last part about /pathcacti/cacti.sql.  I've noodled around in the /usr/share/cacti folder and don't see a cacti.sql file anywhere, so maybe this doesn't apply within SME.

The info in /usr/share/cacti/include/config.php seems accurate so I'm not sure where the hangup is now.

Offline mmccarn

  • *
  • 2,540
Re: Smokeping
« Reply #21 on: July 16, 2020, 01:21:07 PM »
Code: [Select]
/usr/bin/mysql cacti_sme < /usr/share/doc/cacti-1.1.19/cacti.sql

Online ReetP

  • *
  • 2,624
Re: Smokeping
« Reply #22 on: July 16, 2020, 01:52:45 PM »
If someone get the right sequence please note the issues on the bug and I will try and fix them.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Brenno

  • ****
  • 208
Re: Smokeping
« Reply #23 on: July 16, 2020, 02:21:14 PM »
That file has already been executed - I got an error about "table already exists".  I checked in phpmyadmin and all the tables are there with data loaded per the cacti.sql file.

Something else is out of whack here and I'm not enough of a Linux person to take this very far.  I might see if I can completely remove everything and then start from scratch and document as I go.