|
|
| Author |
Message |
alvaro
Joined: 23 Mar 2005 Posts: 38
|
Posted: Fri Sep 23, 2005 9:52 am Post subject: Help on Script |
|
|
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.
| 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
|
Posted: Fri Sep 23, 2005 3:46 pm Post subject: |
|
|
When you run the script from cli, what does it return? Please post.
Reinhard
|
|
| Back to top |
|
 |
alvaro
Joined: 23 Mar 2005 Posts: 38
|
Posted: Mon Sep 26, 2005 1:18 pm Post subject: |
|
|
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
| Description: |
|
| Filesize: |
13.34 KB |
| Viewed: |
2583 Time(s) |

|
|
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5469 Location: Wisconsin, USA
|
Posted: Mon Sep 26, 2005 1:27 pm Post subject: |
|
|
| 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
|
Posted: Mon Sep 26, 2005 1:27 pm Post subject: |
|
|
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
|
Posted: Mon Sep 26, 2005 1:47 pm Post subject: |
|
|
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
|
Posted: Tue Sep 27, 2005 11:46 am Post subject: |
|
|
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
|
Posted: Tue Sep 27, 2005 2:20 pm Post subject: |
|
|
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 |
|
 |
|