Cacti on BusyBox / sh: -q: not found

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

Moderators: Developers, Moderators

hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Cacti on BusyBox / sh: -q: not found

Post by hpsmartyz »

Hi,

I have tried to install Cacti on a Synology and nearly successfully done so.
I get the Cacti interface but no graphs; In only get text saying (Localhost - Memory usage, Localhost - Load average, and so on).
So I tried to run the poller from the command line

Code: Select all

shell> /path/to/php /path/to/cacti/poller.php
I first (somtimes) get a warning message saying that crontab is out of sync (but this should be solved if poller runs correctly)
I then get:
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
but will check my php.ini to locate duplicate declarations.

The problem I am concerned with is that I then get

Code: Select all

sh: -q: not found
sh: -: not found
(and then poller seems to halt (but not stop) which might explain the
out of sync problem).


Would you have any hint on what is happening wrt. the above problem?

many thanks
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

Hi all,

some help (not asking for the solution even if it would be welcome) would be really appreciated :)

thanks
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Re: Cacti on BusyBox / sh: -q: not found

Post by rony »

hpsmartyz wrote:

Code: Select all

shell> /path/to/php /path/to/cacti/poller.php
I first (sometimes) get a warning message saying that crontab is out of sync (but this should be solved if poller runs correctly)
I then get:
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
but will check my php.ini to locate duplicate declarations.
This is usually because mysql is compiled in, try commenting out the mysql line in the php.ini file.
hpsmartyz wrote: The problem I am concerned with is that I then get

Code: Select all

sh: -q: not found
sh: -: not found
(and then poller seems to halt (but not stop) which might explain the
out of sync problem).
This is some of the input methods trying to call "php -q", I don't know why this doesn't work on Busybox, but I can tell you that you can edit these items in 2 places. One, in the Input Methods on the interface and second in the *.xml files in the resource directory (Data Queries).
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

Hi,

many thanks for your time :)
I could find how to do this via the interface so I went in the xml
files and found in cacti/resource/script_queries
two xml files indeed with -q

in host_cpu.xml and host_disk.xml there was a line looking like :
<script_path>|path_php_binary| -q |path_cacti|/scripts/query_host_xxx.php</script_path>

that I modified :
<script_path>|path_php_binary| |path_cacti|/scripts/query_host_xxx.php</script_path>

and now the poller does not return any error! thanks

by the way the duplicate declaration was because I declared extension=mysql.so in php.ini while it is already defined in /php.d/mysql.ini

the sad thing is that I still do not get any graphs (the default ones).

Will search the forum.
In the meantime if you have any advice, I am open ;)
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Are there any files in the rra directory? When the poller runs, it will create the rrdtool files if they do not exist.

Also, is the web server running in a chroot? If so, this can cause problems. Make sure that you have linked the correct paths so that the web interface can access rrdtool and other utilities.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

Hi

thanks for your follow-up ! :D

First I had a problem with the Settings>Paths.
Were missing all the paths to the different binaries.
I added them in php.ini and specified them in the text-boxes and this is now fine.

Concerning Apache running in a chroot, I guess no.

Poller runs (but maybe not perfectly, see below) and has created the files when they did not exist
The Cacti graph page seems to auto-refresh.
I have data in rra/

Code: Select all

-rw-r--r--    1 root     root       141528 Oct 31 20:23 localhost_load_1min_8.rrd
-rw-r--r--    1 root     root        47880 Oct 31 20:24 localhost_users_6.rrd
-rw-r--r--    1 root     root        47880 Oct 31 20:24 localhost_proc_7.rrd
-rw-r--r--    1 root     root        47880 Oct 31 20:24 localhost_mem_swap_4.rrd
-rw-r--r--    1 root     root        47880 Oct 31 20:24 localhost_mem_buffers_3.rrd
I have enabled graph debug and get this (for Localhost - Memory Usage graph) :

Code: Select all

RRDTool Command:

/opt/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Localhost - Memory Usage" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="kilobytes" \
DEF:a="/volume1/web/cacti/rra/localhost_mem_buffers_3.rrd":mem_buffers:AVERAGE \
DEF:b="/volume1/web/cacti/rra/localhost_mem_swap_4.rrd":mem_swap:AVERAGE \
AREA:a#FF4105:"Free"  \
GPRINT:a:LAST:"Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
STACK:b#FFC73B:"Swap"  \
GPRINT:b:LAST:"Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s" 

RRDTool Says:
when I lauch the poller in the command line I sometimes get this type of messages:

Code: Select all

sh: perl: not found
sh: perl: not found
sh: perl: not found
sh: perl: not found
sh: perl: not found
OK u:0.01 s:0.01 r:2.05
OK u:0.01 s:0.01 r:2.05
OK u:0.01 s:0.01 r:2.06
OK u:0.01 s:0.01 r:2.06
ERROR: Not enough arguments
10/31/2007 09:02:08 PM - SYSTEM STATS: Time:2.2904 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5


The graphs I am talking about are not some that I created but some that seem to be there by default at install:
Localhost - Load Average Unix - Load Average
Localhost - Logged in Users Unix - Logged in Users
Localhost - Memory Usage Linux - Memory Usage
Localhost - Processes Unix - Processes
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Make sure you have perl installed and check the path in the script to make sure it's pointing to the correct perl.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

I was indeed doing so and pearl is not installed :(
The problem is that when installing it using ipkg (I am on a Synology NAS) there is a bug with this package. Install does not work properly :( :(

In case I succeed, when you say "check the path in the script".
Which path and which script do you refer to?

thanks
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Edit the script and make sure the first line is correct.

Something like:

Code: Select all

#!/usr/bin/perl
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

sorry got mixed up between perl and pear because of a typo. :oops:
Currently installing perl. :)
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

rony wrote:Edit the script and make sure the first line is correct.

Something like:

Code: Select all

#!/usr/bin/perl
sorry for insisting, which script are you refering to?

please forget my question.
I am currently modifying the scripts.
Last edited by hpsmartyz on Wed Oct 31, 2007 4:04 pm, edited 1 time in total.
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

rony wrote:Make sure you have perl installed
ok, perl is installed.
I just ran the poller and now get :
Two errors reported : grep: invalid option -- w
BusyBox does not seem to have all options/commands available :roll:
and

Code: Select all

OK u:0.01 s:0.00 r:2.03
OK u:0.01 s:0.00 r:2.04
OK u:0.01 s:0.00 r:3.07
OK u:0.01 s:0.01 r:3.08
OK u:0.01 s:0.01 r:3.08
10/31/2007 09:38:16 PM - SYSTEM STATS: Time:3.3070 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Scripts are located in the scripts directory in your Cacti installation.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
hpsmartyz
Posts: 34
Joined: Tue Oct 30, 2007 5:23 am

Post by hpsmartyz »

rony wrote:Scripts are located in the scripts directory in your Cacti installation.
sorry, I thought I had posted a reply.
I indeed found them and modified the first line giving the correct
path to perl (even if without doing so but having installed perl, the perl related errors had disapeared).

Now I am stuck with this grep error.
Looking at the scripts to see what could I do with it.
Any advice?

thanks
Last edited by hpsmartyz on Wed Oct 31, 2007 4:26 pm, edited 1 time in total.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Getting this to work with BusyBox isn't easy... :o

Some where in a script grep is being used and it is using something that BusyBox does not support.. :-?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests