php scripts don't work with data input

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Fireball
Posts: 5
Joined: Fri Jan 26, 2007 3:43 pm

php scripts don't work with data input

Post by Fireball »

Hello, i have a little problem when i try to import data to cacti from a php script
cacti version 0.8.6j on a FC5


the script

Code: Select all

<?php
$no_http_headers = true;

/* display No errors */
error_reporting(E_ERROR);

include_once(dirname(__FILE__) . "/../include/config.php");

if (!isset($called_by_script_server)) {
                print call_user_func("ss_rand");
                }

function ss_rand() {
$nr=rand(1, 10);
return  $nr;
}


i tested the script in script_server.php with the comand line: <path_cacti>/scripts/ss_rand.php ss_rand

all good, it outputs random numbers.

my problem is that when i try to import the data in cacti nothing works.

error:

CMDPHP: Poller[0] Host[0] DS[73] WARNING: Result from SERVER not valid. Partial Result: WARNING: Function do
PHPSVR: Poller[0] WARNING: Function does not exist
PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist

the data input method:

Input Type: Script server php
Input String: php <path_cacti>/scripts/ss_rand.php ss_rand

also tried with input type script command, still same error, am i doing something wrong ? and pls don't send me to how to's there's no php input example there :( and i don't know perl to make scripts but i can work my way around php.

Can anyone help me with my little problem?

Fireball
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Your debugging procedure was wrong. Please visit http://forums.cacti.net/viewtopic.php?t=7738 or see my signature links for some examples
Reinhard
Fireball
Posts: 5
Joined: Fri Jan 26, 2007 3:43 pm

Post by Fireball »

ok, i've already look there, in the how to section only perl examples on data input, found one query example with smtp wich dosn;t help me much.

about my debuggind? can u give me a hint on what am i doing wrong?

i couldn't find any action: 2 to test the script server but if my file works in the scripts server without errors why do i need to test it?

Code: Select all

[root@xyz cacti]# php script_server.php
PHP Script Server has Started - Parent is cmd
/var/www/html/cacti/scripts/ss_rand.php ss_rand
5
/var/www/html/cacti/scripts/ss_rand.php ss_rand
2
/var/www/html/cacti/scripts/ss_rand.php ss_rand
8
/var/www/html/cacti/scripts/ss_rand.php ss_rand
1
Fireball
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Hmm, that is quite odd. It works fine for me. Do other script server scripts work?

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?
Fireball
Posts: 5
Joined: Fri Jan 26, 2007 3:43 pm

Post by Fireball »

yes i tried with ss_poller.php and worked ok in the server_script but when i try to import data from it i get same error

edit:
i can't run php scripts, i get error from all:
PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist !
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Can you do a gotomeeting?

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?
Fireball
Posts: 5
Joined: Fri Jan 26, 2007 3:43 pm

Post by Fireball »

problem solved i reinstaled cacti :roll:

tnx for the support

Fireball
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Wow, you kept your database right?

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?
Fireball
Posts: 5
Joined: Fri Jan 26, 2007 3:43 pm

Post by Fireball »

yea and all the rrd files ;)
User avatar
za
Posts: 44
Joined: Thu Nov 09, 2006 10:39 am

I've the same trouble

Post by za »

I've almost the same problem with php scripting.

This is the result of ss_poller.php runnig on the script_server:
c:\inetpub\wwwroot\cacti\scripts\ss_poller.php ss_poller
Time:2.4641 Method:cmd.php Processes:1 Threads:N/A Hosts:10 HostsPerProcess:10 DataSources:15 RRDsProcess
ed:8
^C
This are my script and the fping running on the script_server:
C:\Inetpub\wwwroot\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
c:\inetpub\wwwroot\cacti\scripts\ss_fping.php ss_fping 10.10.10.253

C:\Inetpub\wwwroot\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
c:\inetpub\wwwroot\cacti\scripts\ss_mem_conn.php ss_mem_conn 10.10.10.253

C:\Inetpub\wwwroot\cacti>
They just went out of the script_server....

But if I try to run the script without the script_server i've got back the right reply:
C:\Inetpub\wwwroot\cacti\scripts>php ss_fping.php 10.10.10.253
min:1.2800 avg:2.3850 max:6.9600 dev:2.0534 loss:0.0000
C:\Inetpub\wwwroot\cacti\scripts>php ss_mem_conn.php 10.10.10.253
Connected : 0 - chassisMemTotal:12672832 chassisMemAvaible:10028224 chassisMemThreshold:200000
C:\Inetpub\wwwroot\cacti\scripts>
I was wondering.. WHY?!?!

Za
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests