cancel
Showing results for 
Search instead for 
Did you mean: 

CACTI config issue

SOLVED
Go to solution
NDO
Super Advisor

CACTI config issue

Hi All

I´ve seen on the net, instructions how to setup cacti on hp-ux (www.mayoxide.com/presentations/1320_Masse.pdf ), and try to follow this til the end, but when I point my browser to http://server/cacti-0.8.7g, I have the following errors:
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /opt/hpws/apache/htdocs/cacti-0.8.7g/include/global_arrays.php on line 640
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'

Please can somebody help on this?

F.R.
14 REPLIES
Matti_Kurkela
Honored Contributor
Solution

Re: CACTI config issue

The timezone warning apparently happens because the TZ environment variable is not set in the environment of the web server.

You might fix this with:

echo ". /etc/TIMEZONE" >>/opt/hpws/apache/bin/envvars

The /opt/hpws/apache/bin/envvars script determines the environment variables for Apache (and therefore for all CGI scripts and Perl/PHP applications run through Apache plugins). The above-mentioned command adds a line which should make it pick up the TZ setting from the HP-UX standard /etc/TIMEZONE.

The fatal error message about MySQL is because Cacti requires a valid, functional and properly configured MySQL database to work.

Did you create and configure the Cacti database for MySQL as instructed in the Cacti documentation:

http://www.cacti.net/downloads/docs/html/unix_configure_cacti.html

MK
MK
NDO
Super Advisor

Re: CACTI config issue

Hi Matti!

Sorry, perhaps that was my mistake, I did not follow what is in the documentation provided on your link, but I did follow the pdf on the link stated on my first post.
I will follow the procedure stated on your link.
I will come back.


F.R.
NDO
Super Advisor

Re: CACTI config issue

Hi

I cannot start mysql, so mysql deamon is not running, this is the error when I try to run from:~
usr/local/mysql/share/mysql #./mysql.server start
Starting MySQL
. ERROR! Manager of pid-file quit without updating file.

If I try from :
[430]/usr/local/mysql/bin #./mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


Please can you help?


F.R.
Viktor Balogh
Honored Contributor

Re: CACTI config issue

didn't you just forget the postinstallation procedure? I mean a binary named mysql_install_db

http://dev.mysql.com/doc/refman/5.0/en/unix-postinstallation.html

****
Unix operates with beer.
NDO
Super Advisor

Re: CACTI config issue

Hi

I have got mysql up and running:

prep03[156]/usr/local/mysql #bin/mysqld_safe --user=mysql &
[1] 8980
prep03[157]/usr/local/mysql #110505 09:28:50 mysqld_safe Logging to '/usr/local/mysql/var/prep03.err'.
110505 09:28:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

prep03[158]/usr/local/mysql #/usr/local/mysql/bin/mysqladmin -u root password 'prep03'
prep03[159]/usr/local/mysql #/usr/local/mysql/bin/mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.39 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+

But when I try to create a cacti db, I have the following error:

prep03[301]/usr/local/mysql/bin #./mysqladmin --user=root create cacti
./mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
prep03[302]/usr/local/mysql/bin #ps -ef | grep mysql
root 12322 12241 0 12:10:28 pts/4 0:00 grep mysql
root 8980 8629 0 09:28:50 pts/1 0:00 /bin/sh bin/mysqld_safe --user=mysql
mysql 9015 8980 0 09:28:50 pts/1 0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --log-error=/usr/local/m
root 9149 8629 0 09:33:45 pts/1 0:00 /usr/local/mysql/bin/mysql -u root -p
prep03[303]/usr/local/mysql/bin #



F.R.
Viktor Balogh
Honored Contributor

Re: CACTI config issue

the hint is the error message:

"error: 'Access denied for user 'root'@'localhost' (using password: NO)'"

which indices that you must supply a "-p" parameter at the command line. anyway, you can issue that create statement also in interactive mode, after you are logged in to mysql. note that you don't need to feed the password at the command line, only the "-p" switch - this way your shell history cannot catch the db password.
****
Unix operates with beer.
NDO
Super Advisor

Re: CACTI config issue

Hi

I have managed to create the cacti DB:
mysql> create database cacti;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cacti |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql>

But on cacti online manual do I have to follow these steps?

1.Import the default cacti database:

shell> mysql cacti < cacti.sql

2.Optional: Create a MySQL username and password for Cacti.

shell> mysql --user=root mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;

F.R.
NDO
Super Advisor

Re: CACTI config issue

Hi

I have followed all the steps, but now when I run "http://10.100.48.13/cacti-0.8.7g/" I have a page with lots of warnings. pls see attachement.


Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /opt/hpws/apache/htdocs/cacti-0.8.7g/include/global_constants.php on line 154

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /opt/hpws/apache/htdocs/cacti-0.8.7g/include/global_constants.php on line 154

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /opt/hpws/apache/htdocs/cacti-0.8.7g/include/global_constants.php on line 155




F.R.
Viktor Balogh
Honored Contributor

Re: CACTI config issue

see the first post from Matti, you should set the timezone e.g with the TZ variable.

> echo ". /etc/TIMEZONE" >>/opt/hpws/apache/bin/envvars

or maybe there is a config file somewhere named like cacti.conf.inc or something like this where you can set the timezone. just look around in the subfolders
****
Unix operates with beer.
NDO
Super Advisor

Re: CACTI config issue

Hi

I did run that comamnd, but did not help.

The warninigs are strtotime() and date () functions related.

F.R.
Viktor Balogh
Honored Contributor

Re: CACTI config issue

then maybe you should specify the timezone not for apache, but for php. look for the file

/opt/hpws/apache/conf/php.ini

and add the following line to it (if nothing similar is there already):

date.timezone=Europe/Paris

here is a list of valid timezones:

http://php.net/manual/en/timezones.php

****
Unix operates with beer.
NDO
Super Advisor

Re: CACTI config issue

Hi

Yes I did that as well, but no luck, and I have noticed that the error message mention a file global_constants in "/opt/hpws/apache/htdocs/cacti-0.8.7g/include/ ", but I cannot find a setting in it


F.R.
NDO
Super Advisor

Re: CACTI config issue

Hi

For example, the error msg I got is Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /opt/hpws/apache/htdocs/cacti-0.8.7g/include/global_arrays.php on line 640
So they are refering to line 640 and other error lines 154 to 160.

Lines 154 to 160 contains the following:

153 # weekdays according to date("w") builtin function
154 define("WD_SUNDAY", date("w",strtotime("sunday")));
155 define("WD_MONDAY", date("w",strtotime("monday")));
156 define("WD_TUESDAY", date("w",strtotime("tuesday")));
157 define("WD_WEDNESDAY", date("w",strtotime("wednesday")));
158 define("WD_THURSDAY", date("w",strtotime("thursday")));
159 define("WD_FRIDAY", date("w",strtotime("friday")));
160 define("WD_SATURDAY", date("w",strtotime("saturday")));


But the same file does not have line 640 as mentioned on the error


FR
NDO
Super Advisor

Re: CACTI config issue

bye