poller's exec_background doesn't run with host params(WinXP)

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
jupitecacti
Posts: 3
Joined: Wed Oct 12, 2005 10:56 am

poller's exec_background doesn't run with host params(WinXP)

Post by jupitecacti »

Hi,

installed Cacti 0.8.6g and its dependancies according to INSTALL. Even found out about "php.ini into WINDOWS\".

SNMP graphs appear fine and dandy.

Script value graphs of any type do not, however; even if their results can be made to appear in the debug log - but that's a problem for another day.

Now every time poller.php executes, in the 1st "Cactiplus" window appearing, php.exe complains about "The system cannot find the path specified." (actually, in german here, but that's the meaning).

I traced this into the source of poller.php to the 2 alternative places where
exec_background($command_string, "$extra_args $first_host $last_host");
is used. This expands (from exec_background() and the debug log) to
start c:/programm/php/php.exe -q "c:/programme/apache2/htdocs/cacti/cmd.php" 0 8

I then noted that php.exe is especially unhappy about those 2 numbers at the end - remove them from the call and php.exe quits complaining and runs cmd.php . Tested this on command line, with and without "start".

Anyway, PHP 5.05 here doesn't have a -q parameter, but this doesn't change anything.

Furthermore, from a quick glance at its code, i guess that cmd.php, given no extra parameters, does all of the configured hosts anyway.

Did i misconfigure something? Is this a bug? If so, Windows specific?
Any opinions?

TIA,
--
regards,
W. Lichtenberger
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

cactiplus is used for exporting graphs. If you don't use that feature in cacti, then you can ignore the messages (as I do).
jupitecacti
Posts: 3
Joined: Wed Oct 12, 2005 10:56 am

host params for cmd.php

Post by jupitecacti »

Hi,

with the exec_background() calls in poller.php are called
1) cmd.php
2) poller_commands.php
3) poller_export.php
if i understood the code correctly.
So, graph export seems to be 3rd, not 1st to me.

As a Test, i called from the command line:
---------------
c:\Programme\Apache2\htdocs\cacti>cmd.php 0 8
{starts apparently normally}
c:\Programme\Apache2\htdocs\cacti>php ./cmd.php 0 8
Das System kann den angegebenen Pfad nicht finden.
{the system cannot find the path specified}
c:\Programme\Apache2\htdocs\cacti>php .\cmd.php 0 8
Das System kann den angegebenen Pfad nicht finden.
{the system cannot find the path specified}
c:\Programme\Apache2\htdocs\cacti>
---------------
(my notes in curly brackets)

Now i'm stumped. Could this be a PHP bug with Windows?

--
regards,
-- W. Lichtenberger
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

What/Who's version of cacti are you running? Let me explain. I wrote most of the current polling architecture and based upon your example, there are a few key points: 1) I am not placing double quotes on anything in Cactiplus (poller start command for cacti). 2) I am running the "start" command with additional options that I did not see in your command line.

So, 1 of 3 things are happening:
1) You are not clearly stating the facts in your examples
2) You are running somebody elses Cacti
3) You have attempted to figure things out yourself and modified files without completely understanding what you were doing (which isn't all that bad, that's how raX roped me in).

My suggestions are:
1) Settings->Paths - All binaries with forward slashes and not back slashes
2) Revert back to the original PHP files. You database is fine as is
3) get PHP.INI out of your Windows directory. Instead, leave it in C:\PHP and set the PHPRC environment variable to point to C:\PHP
4) Restart apache
5) Run "php -m" and make sure you don't get warnings and that you have all the modules.
6) Post your results.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jupitecacti
Posts: 3
Joined: Wed Oct 12, 2005 10:56 am

Post by jupitecacti »

[quote="TheWitness"]What/Who's version of cacti are you running?[/quote]

http://www.cacti.net/downloads/cacti-0.8.6g.zip with patches from http://www.cacti.net/downloads/patches/0.8.6g/

[quote="TheWitness"]Let me explain. I wrote most of the current polling architecture and based upon your example, there are a few key points: 1) I am not placing double quotes on anything in Cactiplus (poller start command for cacti).[/quote]

The relevant line in lib/poller.php reads
if ($config["cacti_server_os"] == "win32") {
pclose(popen("start "Cactiplus" /I "" . $filename . "" " . $args, "r"));

including " double quotes around $filename, if in windows. Guess this is sensible if apache installs below "c:\program files", including blanks in path.

[quote="TheWitness"]2) I am running the "start" command with additional options that I did not see in your command line.

So, 1 of 3 things are happening:
1) You are not clearly stating the facts in your examples[/quote]

Could very well be - i'm glad i understood enough yet to have got it up and running. I'll try and state all facts i know of, though.
What additional options do you mean?

[quote="TheWitness"]2) You are running somebody elses Cacti[/quote]

I guess not. Any modifications here (not many) are by me, just for extra logging purposes to find show stoppers.

[quote="TheWitness"]3) You have attempted to figure things out yourself and modified files without completely understanding what you were doing (which isn't all that bad, that's how raX roped me in).[/quote]

Guilty as charged, your honor. I plead desperateness to get it working, though.

[quote="TheWitness"]My suggestions are:
1) Settings->Paths - All binaries with forward slashes and not back slashes
2) Revert back to the original PHP files. You database is fine as is
3) get PHP.INI out of your Windows directory. Instead, leave it in C:\PHP and set the PHPRC environment variable to point to C:\PHP
4) Restart apache
5) Run "php -m" and make sure you don't get warnings and that you have all the modules.
6) Post your results.

TheWitness[/quote]

1)Paths slashes forward: check - no change needed.
2)PHP revert: done, to 0.8.6g patched.
3)php.ini moved to c:\programm\php; PHPRC already points there.
4)apache restarted.
5)php -m yields:
[PHP Modules]
bcmath
calendar
com_dotnet
ctype
dom
ftp
iconv
libxml
mbstring
mysql
odbc
pcre
session
SimpleXML
snmp
sockets
SPL
SQLite
standard
tokenizer
wddx
xml
zlib

[Zend Modules]

6) php.ini move worked apparently, according to phpinfo() .
I'll change the cacti poller log to debug again... hmmm, looks good now. Doesn't complain anymore to "0 8" tacked on.
Trying on command line, like in my 2nd posting... no complaints either.
(although i'm still in the dark as to what's behind it...)

That did it! Thanks a bunch!
--
regards,
-- W. Lichtenberger
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest