cmd.php - is there an end to all this madness?

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

Moderators: Developers, Moderators

Post Reply
scarab
Posts: 2
Joined: Thu May 29, 2003 9:03 am

cmd.php - is there an end to all this madness?

Post by scarab »

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
fruers
Posts: 8
Joined: Mon Apr 21, 2003 9:57 pm
Location: Australia

Post by fruers »

What output do you get when you run cmd.php from the command line?

i.e. su - cacti -c 'php <cacti_path>/cmd.php'
Becksaward
Posts: 13
Joined: Wed Jun 11, 2003 12:30 pm
Location: Germany
Contact:

Post by Becksaward »

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..
Hey Bill, did your Windows ever crash ?

---Linux-because wizards are for Pussys---

a Debian Sarge User
andip
Posts: 4
Joined: Wed Jun 11, 2003 5:53 am

Post by andip »

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
Becksaward
Posts: 13
Joined: Wed Jun 11, 2003 12:30 pm
Location: Germany
Contact:

Post by Becksaward »

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
Hey Bill, did your Windows ever crash ?

---Linux-because wizards are for Pussys---

a Debian Sarge User
andip
Posts: 4
Joined: Wed Jun 11, 2003 5:53 am

Post by andip »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest