|
|
| Author |
Message |
scarab
Joined: 29 May 2003 Posts: 2
|
Posted: Thu May 29, 2003 9:10 am Post subject: cmd.php - is there an end to all this madness? |
|
|
greetings all.
it seems that i are one of many that seem to have a problem with executing the cmd.php script. i've scrunged through the board finding tidbits here and there of possible solutions, which i might add that i've tried all of.
i'm running a brand new gentoo installation with php4.3.1 cacti0.6.8a.
i can find and create graphs for snmp interfaces, but i cannot gather data for them using the cmd.php script.
surely there is someone out there that can help me... please?
many thanks!
jacques |
|
| Back to top |
|
 |
fruers
Joined: 21 Apr 2003 Posts: 8 Location: Australia
|
Posted: Mon Jun 02, 2003 3:02 am Post subject: |
|
|
What output do you get when you run cmd.php from the command line?
i.e. su - cacti -c 'php <cacti_path>/cmd.php' |
|
| Back to top |
|
 |
Becksaward
Joined: 11 Jun 2003 Posts: 13 Location: Germany
|
Posted: Wed Jun 11, 2003 1:01 pm Post subject: |
|
|
go to the cacti folder and make an
strace php4 cmd.php (for php4 use your php version)
look in the output...should stop and anounce some kind of an error or the reason why it stops.. |
|
| Back to top |
|
 |
andip
Joined: 11 Jun 2003 Posts: 3
|
Posted: Thu Jun 12, 2003 3:05 am Post subject: |
|
|
i've got ... a from the looks of it, similar problem. also running gentoo-liux,so it might be gentoo that's messing up somewhere. I posted yesterday about it, but i can repeat my output here :
*******************************
php cmd.php
ping: bad number of packets to transmit.
mysqladmin: connect to server at '-u' failed
error: 'Unknown MySQL Server Host '-u' (1)'
Check that mysqld is running on -u and that the port is 3306.
You can check this by doing 'telnet -u 3306'
sh: -c: line 2: syntax error near unexpected token `('
sh: -c: line 2: `Warning: main(../include/config.php): failed to open stream: No such file or directory in /home/httpd/htdocs/cacti/scripts/sql.php on line 4'
wc: /var/log/httpd/access_log: No such file or directory
*****************************************************'
this is the output when i run it from /home/httpd/htdocs/cacti
there's a whole different story if i do it with absolute path's, from outside cacti's dir :
**********************************************
php cacti/cmd.php
Warning: rrdtool_function_create(include/config.php): failed to open stream: No such file or directory in /home/httpd/htdocs/cacti/include/rrd_functions.php on line 86
Warning: rrdtool_function_create(): Failed opening 'include/config.php' for inclusion (include_path='.:/usr/lib/php') in /home/httpd/htdocs/cacti/include/rrd_functions.php on line 86
Warning: rrdtool_function_create(include/functions.php): failed to open stream: No such file or directory in /home/httpd/htdocs/cacti/include/rrd_functions.php on line 87
etcetcetcetc
************************************************
similar to yours scarab?
cheers
Andip |
|
| Back to top |
|
 |
Becksaward
Joined: 11 Jun 2003 Posts: 13 Location: Germany
|
Posted: Thu Jun 12, 2003 8:53 am Post subject: |
|
|
jo,
check if you got mysql enabled and if the account you made inmysql is in the config file for cacti (username and password) so cacti can connect to the database. also check if the cacti database name is correct. then check the rights of the sql user.
a nice tool for going around with mysql is
phpmyadmin, its for debian..but should be available for others.
and
do the command
strace php cmd.php
strace is a programm to trace the programm. not just php cmd.php |
|
| Back to top |
|
 |
andip
Joined: 11 Jun 2003 Posts: 3
|
Posted: Thu Jun 12, 2003 9:10 am Post subject: |
|
|
yep, i did that, but it told me nothing.
anyway, i've figured out what the problem was with my first paste (first error). That was just crappy php-code, so when i fixed scripts/sql.php to look like this :
<?
$do_not_read_config = true;
include dirname(__FILE__)."/../include/config.php";
if (empty($database_hostname)) die ('Ittno hostnavn for svarte bjarte!');
if (empty($database_username)) die ('Ittno database bruker!!');
$dbahost = escapeshellarg($database_hostname);
$dbauser = escapeshellarg($database_username);
if (empty($database_password)) {
$sql = `mysqladmin -h $dbahost -u $dbauser status | awk '{print $6 }'`;
}else{
$dbapass = escapeshellarg($database_password);
$sql = `mysqladmin -h $dbahost -u $dbauser --password=$dbapass status | awk '{print $6 }'`;
}
print trim($sql);
?>
things started working without errors. still getting errors when "php cmd.php" is run from outside /home/httpd/htdocs/cacti
working on that one
i've never coded php before, so this was a friend of mine that helped me out, but i must say it's a bit strange that this sort of code/scripts could be released as something other than dev-code or something... then again i know zip about this, so i guess there's a good reason for it. |
|
| Back to top |
|
 |
|