Graph php $variable

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Fr3d
Posts: 3
Joined: Wed Apr 11, 2007 11:48 am

Graph php $variable

Post by Fr3d »

Hello There,

I have been using Cacti for a couple of weeks for my switch graphing and I am very pleased!

I am today playing around with the options and I am wondering if someone could advise me on how to go about doing something:

I run a standalone PHP script on my server which I have setup to create a variable which is a percentage of the users that are online. Basically I simply want to graph this as a percentage value out of 100.

I have limited knowledge of PHP and I am wondering what my best option is, do I need to send this number to an mysql database on the server and get cacti to read from there? or can I set it up to get it directly?

Thanks for your help,
Fred.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

See first link of my signature for "a few" walkthroughs that will answer your question.
Happy cactiing
Reinhard
Fr3d
Posts: 3
Joined: Wed Apr 11, 2007 11:48 am

Post by Fr3d »

Thanks for the message,

I have looked at your tutorials and think I am heading in the right direction but I am not sure how to configure cacti.

I have made the following php script which echoes the percentage value that I want to graph:
http://www.fastfrags.co.uk/lgsl/percentage.php

From this how can I get cacti to graph this value on a scale of 0-100?

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

Post by gandalf »

Please note the "numerical range" of the expected output. And you surely will use a Data Template defining the data source as GAUGE. Rest of it should plainly be taken from my howto's
Reinhard
Fr3d
Posts: 3
Joined: Wed Apr 11, 2007 11:48 am

Post by Fr3d »

Thanks for your response,

I am not quite sure how I am suppose to set this up really (sorry!) could you possibly give me a bit more guidence?

Here is what I have setup as my "Data Input Method":

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

Post by gandalf »

Please use simply "Script", even if it's written in php. Script Server is somewhat different.
Reinhard
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Moved to General
[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]
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests