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    


Help on Script

 
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti
Author Message
alvaro



Joined: 23 Mar 2005
Posts: 38

PostPosted: Fri Sep 23, 2005 9:52 am    Post subject: Help on Script Reply with quote

Hello All,

I'm trying to do a cacti script and template, but cacti
returns error, but i dont have this error executing this script on console...

Someone can help me ?

debug log:

09/23/2005 11:43:18 AM - CMDPHP: Poller[0] Host[0] CMD: c:\php\php-win.exe -q D:\cacti\alvaro3.php, output: U

09/23/2005 11:43:18 AM - CMDPHP: Poller[0] Host[0] WARNING: Result from CMD not valid. Partial Result: SERVER XYZ:99.2973

ps: My apologizes for my bad english.



alvaro3.txt
 Description:

Download
 Filename:  alvaro3.txt
 Filesize:  365 Bytes
 Downloaded:  142 Time(s)

Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12604
Location: Muenster, Germany

PostPosted: Fri Sep 23, 2005 3:46 pm    Post subject: Reply with quote

When you run the script from cli, what does it return? Please post.
Reinhard
Back to top
alvaro



Joined: 23 Mar 2005
Posts: 38

PostPosted: Mon Sep 26, 2005 1:18 pm    Post subject: Reply with quote

Reinhard,

When i execute from console, the script gimme the values like this:

SERVER 1:99.99

Attached the screenshot...

In the cacti log, i have this:

09/23/2005 11:43:18 AM - CMDPHP: Poller[0] Host[0] CMD: c:\php\php-win.exe -q D:\cacti\alvaro3.php, output: U

09/23/2005 11:43:18 AM - CMDPHP: Poller[0] Host[0] WARNING: Result from CMD not valid. Partial Result: SERVER XYZ:99.2973

Thank you,

Alvaro



error.PNG
 Description:
 Filesize:  13.34 KB
 Viewed:  2583 Time(s)

error.PNG


Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5469
Location: Wisconsin, USA

PostPosted: Mon Sep 26, 2005 1:27 pm    Post subject: Reply with quote

It does not like those lines starting with ":", where are they names for those values?
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12604
Location: Muenster, Germany

PostPosted: Mon Sep 26, 2005 1:27 pm    Post subject: Reply with quote

Well, as I understand, your script does not only return one value (this would be the simplest form of a custom script). Of course, it is possible to have a scripts return more than one value, but as stated in http://www.cacti.net/downloads/docs/html/data_input_methods.html this must follow a defined syntax: <parm1>:<value1> <parm2>:<value2> ... <parm n>:value n>
What I do not understand at the moment ist: what is the meaning of those strings in your example that are placed in front of the ":"? Are they host names?
Reinhard
Back to top
alvaro



Joined: 23 Mar 2005
Posts: 38

PostPosted: Mon Sep 26, 2005 1:47 pm    Post subject: Reply with quote

Reinhard and Tony,

Yes, they are hostnames (description names) and the numbers are the uptime in percent.

(SELECT description, availability FROM cacti.host)

I cannot understand why (when executed by cacti) return me this error...

09/23/2005 11:43:18 AM - CMDPHP: Poller[0] Host[0] CMD: c:\php\php-win.exe -q D:\cacti\alvaro3.php, output: U

09/23/2005 11:43:18 AM - CMDPHP: Poller[0] Host[0] WARNING: Result from CMD not valid. Partial Result: SERVER XYZ:99.2973

And how to fix this.

Thank you,

Alvaro
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12604
Location: Muenster, Germany

PostPosted: Tue Sep 27, 2005 11:46 am    Post subject: Reply with quote

You should modify your script so that it takes the hostname as an input parameter. And the output should only return the value (uptime in percent); no need to output the hostname. So it may look like
Code:
...alvaro3.php <server>
and it will return
99.992

Please reread the docu in my last post. There you'll find a walkthrough how to configure cacti so that it
- will know your alvaro3.php as a Data Input Method
- will automatically append the hostname as an input parm
- how to define a data template based on the Data Input Method
- how to define a Graph Template to display the values
- how to apply this Graph Template to a host
Reinhard
Back to top
alvaro



Joined: 23 Mar 2005
Posts: 38

PostPosted: Tue Sep 27, 2005 2:20 pm    Post subject: Reply with quote

Reinhard,

Thank you. ! i have solved this problem in the morning reading your email.
Im gonna post the scripts and template.

Thank you for the help.

Alvaro
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group