Help on Script

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
alvaro
Posts: 39
Joined: Wed Mar 23, 2005 8:18 am

Help on Script

Post by alvaro »

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.
Attachments
alvaro3.txt
(365 Bytes) Downloaded 443 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

When you run the script from cli, what does it return? Please post.
Reinhard
alvaro
Posts: 39
Joined: Wed Mar 23, 2005 8:18 am

Post by alvaro »

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
Attachments
error.PNG
error.PNG (13.34 KiB) Viewed 7768 times
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

It does not like those lines starting with ":", where are they names for those values?
[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]
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

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/htm ... thods.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
alvaro
Posts: 39
Joined: Wed Mar 23, 2005 8:18 am

Post by alvaro »

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
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

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: Select all

...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
alvaro
Posts: 39
Joined: Wed Mar 23, 2005 8:18 am

Post by alvaro »

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
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Re: Help on Script

Post by argon0 »

Did Alvaro ever post his working script/template?
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest