Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


problem with running cmd.php

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Linux/Unix Specific
Author Message
khutton
Cacti User


Joined: 18 Jun 2002
Posts: 77
Location: Alexandria, Virginia

PostPosted: Thu Dec 12, 2002 11:50 am    Post subject: problem with running cmd.php Reply with quote

I have compiled php into apache and created the binary but when I run cmd.php (from command line) I get the following error

ping: bad number of packets to transmit.
sh: mysqladmin: command not found
sh: /usr/bin/smbstatus: No such file or directory
wc: /var/log/httpd/access_log: No such file or directory
X-Powered-By: PHP/4.2.3
Content-type: text/html

This error is also logged in my mail by crontab when it runs cmd.php every five minutes

The no such file or director errors are simple enought to fix but I don't understand the ping and mysqladmin error. I have mysqladmin, but don't know where to go to change where cacti thinks it is. I have it in /usr/local/mysql/bin.

I have my complete process for installing cacti. I am trying to write detailed instructions for others. I will post them after I post this question for any ones review.


Thanks in advance for any help. If you want the directions that I have so far look at next post or email/message me.

Kevin
Back to top
khutton
Cacti User


Joined: 18 Jun 2002
Posts: 77
Location: Alexandria, Virginia

PostPosted: Thu Dec 12, 2002 11:54 am    Post subject: Reply with quote

Here is the directions I have so far. If any one sees any glaring edits I would appreciate some help. If I can get this to work I will have a very well documented set of directions. Which should help this application and message board. Thanks again for your help

Just a note, this is all done on a fresh install of RedHat 7.3, standard server install with the gnome package selected. Everything else is basic.

Start instructions:
Download the Following:

Cacti-0.6.8a.tar.gz
MySQL-3.23.54-pc-linux-gnu-i686.tar.gz
php-4.2.3.tar.gz
rrdtool-1.0.35.tar.gz
apache_1.3.27.tar.gz
ucd-snmp-4.2.3.tar.gz (you may not need this if you have snmpget and snmpwalk already on you machine)

Copy all of these to /usr/local/cactisetup

********************************************************************

Installing Apache
from /usr/local/cactisetup
tar zxvf apache_1.3.27.tar.gz (unpacking apache)
mv apache_1.3.27 apache (renaming the apache directory to apache)
cd apache
./configure --prefix=/www --enable-module=so
make
make install
cd ..

********************************************************************

Installing PHP
cd /usr/local/cactisetup
tar zxvf php-4.2.3.tar.gz (unpacking php)
mv php-4.2.3 php4 (renaming the php directory to php4)
cd php4
./configure --with-mysql --with-apxs=/www/bin/apxs
make
make install

Copy and Edit php.ini
cp php.ini-dist /usr/local/lib/php.ini
cd /usr/local/lib
pico php.ini
change Register_Globals=On and Register_argc_argv=On
save edits

Now to create the php command line application
cd /usr/local/cactisetup/php4
./configure --with-mysql
make
make install
php binary should be in /usr/local/cactisetup/php4/


*********************************************************************

Edit httpd.conf
cd /www/conf
pico httpd.conf
edit your servername to reflect proper name and add this line
AddType application/x-httpd-php .php
LoadModule php4_module libexec/libphp4.so
save edits

*******************************************************************

Start web server
cd /www/bin
./apachectl start

test your webserver

You should get the Apache default page if all is well. If you do not please refer to the Apache

documentation for any errors. If you have installed Gnome on you Linux installation then you should have

a GUI configuration utility for Apache. Please run this and you should be able to configure everything

you need to get your server running. Doing this will overwrite any changes made to httpd.conf by hand.

I suggest you edit it by hand. The documentation is very good.

***********************************************************************

Starting Apache at boot
cd /etc
pico rc.local
add the line
/www/bin/apachectl start &
save changes

********************************************************************

Unpacking Cacti
tar zxvf Cacti-0.6.8a.tar.gz (unpack cacti)
mv cacti-0.6.8a /www/htdocs/cacti (rename and move cacti-0.6.8a to /www/htdocs/cacti)
cd /www/htdocs
chown -R nobody:nobody /www/htdocs/cacti (this allows the webserver to show your cacti dir)

********************************************************************

Unpacking rrdtool
tar zxvf rrdtool-1.0.35.tar.gz
mv rrdtool-1.0.35 rrdtool

Setting up rrdtool
cd /usr/local/cactisetup/rrdtool
./configure
make
make install

rrdtool will be installed to /usr/local/rrdtool-version#

*******************************************************************

Unpacking MySQL
tar zxvf mysql-3.23.54-pc-linux-gny-i686.tar.gz (unpack mysql)
mv mysql-3.23.54-pc-linux-gnu-i686 /usr/local/mysql (rename and move the mysql directory to mysql)

Setting up mysql
groupadd mysql
useradd -g mysql mysql (this is the user that will run MySQL)
cd /usr/local/mysql
scripts/mysql_install_db
chown -R root .
chown -R mysql data
chgrp -R mysql .
./bin/safe_mysqld --user=mysql &
./mysql -u root mysql
mysql> SET PASSWORD FOR root@localhost=PASSWORD('newpassword'); (sets password for root mysql user not

root linux user, like sa account on other DB's)
exit

To start the server at boot time add this line to /etc/rc.local

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'

Reboot machine to test the installation of mysql
once the server has rebooted

cd /usr/local/mysql/bin
./mysqladmin --user=root -pnewpassword version

if you get the version screen from mysql, the server started at boot


*************************************************************************

installing Cacti tables in mysql
from /usr/local/mysql/bin/
./mysqladmin --user=root -pnewpassword create cacti
./mysql -u root -pnewpassword cacti < /www/htdocs/cacti/cacti.sql

Create a MySQL username and password for Cacti
./mysql --user=root -ppassword
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
flush privileges;
exit

Edit /www/htdocs/cacti/include/config.php

database_default = "cacti";
database_hostname = "localhost";
database_username = "cactiuser";
database_password = "somepassword";

cd /etc
pico crontab
add this line
*/5 * * * * * cactiuser /usr/local/cactisetup/php4/php /www/htdocs/cacti/cmd.php > /dev/null 2>&1
Back to top
TFC
Cacti Pro User


Joined: 09 Apr 2003
Posts: 617
Location: Izmir/Turkey

PostPosted: Fri Apr 18, 2003 6:41 am    Post subject: OK BUT!!! Reply with quote

Hi,
I use:
RH7.2
cacti 06.8a
I Install everything about the instruction ,see above. I can login to cacti. I can discover snp interface. But when i select "make graph" i get this messages at the top of page:
Code:
CANNOT FIND DATA SOURCE: /www/htdocs/cacti/rra/traf_10_204_6_1_1_in.rrd

/usr/local/rrdtool-1.0.35/bin/rrdtool create \
/www/htdocs/cacti/rra/traf_10_204_6_1_1_in.rrd \
--step 300 \
DS:traf_10_204_6_1_1_i:COUNTER:600:0:10000000 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \

If I ınstall everything about this instruction why I create .rrd files?
Additionally i can get no graph in my graph page
Back to top
Guest






PostPosted: Sat Apr 19, 2003 2:58 am    Post subject: Reply with quote

Check and make sure that your cacti user has permissions/is the owner of to the /path-to-cacti/cacti/rra and /path-to-cacti/cacti/log directories.
Back to top
TFC
Cacti Pro User


Joined: 09 Apr 2003
Posts: 617
Location: Izmir/Turkey

PostPosted: Mon Apr 21, 2003 6:42 am    Post subject: Graphic problem Reply with quote

Hi,
I use RH7.2/cacti 06.8a
I applied khutton's instruction. After that, i saw graphics' bacground but there's no trend line in my pages.
First og all, ı want to describe what i did:
1. I applied khutton's instruction about linux.
2. I created a user in linux as cactiuser
3. I use chown cactiuser rra/ log/ command in ../htdocs/cacti/ directory.
4. i log on as root everytime
5. I edited /etc/crontab as:
Code:
*/5 * * * * * cactiuser /usr/local/cactisetup/php4/php www/htdocs/cacti/cmd.php > /dev/null 2>&1

6. I run this command anf i got these terminal window:
Code:
[root@localhost root]# php /www/htdocs/cacti/cmd.php
ping: bad number of packets to transmit.
sh: /usr/local/cactisetup/php4/: is a directory
sh: /usr/bin/smbstatus: No such fie  or directory
wc: /var/log/httpd/access_log : No such fie  or directory
X-Powered-By : PHP/4.2.3
Content-type: text/html

Additionally, when i run perl in terminal window i got these:
Code:
[root@localhost root]# perl /www/htdocs/scripts/webhits.pl /www/logs/access_log
25114[root@localhost root]#

So, perl can read access log but i cant see ant graph..
Anything wrong ? If not, why i can get some trend line?
Back to top
khutton
Cacti User


Joined: 18 Jun 2002
Posts: 77
Location: Alexandria, Virginia

PostPosted: Mon Apr 21, 2003 7:25 am    Post subject: Reply with quote

If you are seeing the graph but no lines it could be that the rrd files are not being created in the cacti/rra/. Are there any files in the cacti/rra/ that correspond to your snmp devices?
Back to top
TFC
Cacti Pro User


Joined: 09 Apr 2003
Posts: 617
Location: Izmir/Turkey

PostPosted: Mon Apr 21, 2003 8:49 am    Post subject: Reply with quote

khutton wrote:
If you are seeing the graph but no lines it could be that the rrd files are not being created in the cacti/rra/. Are there any files in the cacti/rra/ that correspond to your snmp devices?

Yes. Actually when i login as root and i run manually
Code:
root@localhost root]# php /www/htdocs/cacti/cmd.php

some graphs are exist... Under these circumstances, I think that my crontab is not work properly...
So, can i use
Code:
*/5 * * * * * root /usr/local/cactisetup/php4/php www/htdocs/cacti/cmd.php > /dev/null 2>&1

instead of
Code:
*/5 * * * * * cactiuser /usr/local/cactisetup/php4/php www/htdocs/cacti/cmd.php > /dev/null 2>&1

I think some tuning is enough to work my cacti work properly..
Thank you Kevin or your assists and interests...
Back to top
khutton
Cacti User


Joined: 18 Jun 2002
Posts: 77
Location: Alexandria, Virginia

PostPosted: Mon Apr 21, 2003 8:59 am    Post subject: Reply with quote

As long as cactiuser has the proper rights to all the necessary directories.
Back to top
TFC
Cacti Pro User


Joined: 09 Apr 2003
Posts: 617
Location: Izmir/Turkey

PostPosted: Tue Apr 22, 2003 12:11 am    Post subject: Reply with quote

khutton wrote:
As long as cactiuser has the proper rights to all the necessary directories.

As a last question:
which rights on which directory?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Linux/Unix Specific All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group