Patch: Graph Template Item Save Bug

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

Moderators: Developers, Moderators

fletch
Cacti User
Posts: 132
Joined: Mon Oct 06, 2003 5:40 pm
Location: Stanford, CA

Bingo

Post by fletch »

Yep,
that was it.
FYI, I just did a straight select all copy and paste into vi from your links - is there whitespace at the end of them?

And why does php care?!

re-saved my templates items and its fixed the issues I was seeing.

While I have you attention, what is the best method for this situation:

I have a custom script that currently monitors 3 items (the script returns the latency of 3 webapp URLS) and graphs them on the same graph as lines.

What if I want to add a 4th URL to my script and have it collected and graphed?
Can I modify the existing data template and graph template and expect it to work?
Will I lose the existing 3 item graph data?

Please point me at the thread if this has been solved before.
(ala Cisco NBAR - should I have created my script and templates with 10 items - the unused ones acting as placeholders until I have more to monitor?)

Thanks for the quick response!
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Re: Bingo

Post by raX »

fletch wrote:FYI, I just did a straight select all copy and paste into vi from your links - is there whitespace at the end of them?
There is no whitespace in the file on the server, but your OS/Browser could have easily added this when pasting the code. Downloading the file with 'wget' or something similar should get around this issue.
fletch wrote:And why does php care?!
PHP cares because this file is included before any HTTP headers are sent to the browser. This whitespace forces it to send its headers early, and when I try to add data to the headers later down in the code, PHP freaks out.
fletch wrote:I have a custom script that currently monitors 3 items (the script returns the latency of 3 webapp URLS) and graphs them on the same graph as lines.

What if I want to add a 4th URL to my script and have it collected and graphed?
Can I modify the existing data template and graph template and expect it to work?
Will I lose the existing 3 item graph data?
I don't think Cacti would have a real problem with this, but RRDTool probably would. Once you create a .rrd file with three items, there is no way to automatically add one more item to that .rrd file. So, making this change would probably cause data to stop appearing on the graphs since each 'rrdtool update' command would fail.

The way I usually handle these situations is break down my script a bit more. Instead of having it return three items, have it return one and create a .rrd file for each one. This allows for more flexability later but may require a bit more work constructing the graph up front.

-Ian
muckl
Posts: 9
Joined: Fri Mar 19, 2004 9:18 pm
Location: Germany

Post by muckl »

raX wrote: PS: Does anyone know how to disable PHP parsing on a per-directory basis for Apache 2? I tried using 'php_admin_flag', 'RemoveHandler', and 'RemoveType' all to no avail.
Maybe you want to cp or ln the real .php to a .phps file?

If there is index.php in a directory and you want the source of it displayed in the source-subdirectory, simply do:

Code: Select all

ln index.php source/index.phps
or you can do it in the same directory, of course:

Code: Select all

ln index.php index.phps
It's with syntax-highliting :)
muckl
Posts: 9
Joined: Fri Mar 19, 2004 9:18 pm
Location: Germany

Re: still having my data sources swapped...

Post by muckl »

fletch wrote:Yep,
that was it.

re-saved my templates items and its fixed the issues I was seeing.
I also applied http://www.raxnet.net/downloads/cacti/p ... save.patch and copied http://www.raxnet.net/downloads/cacti/p ... ources.php over my version of that file but still have the problem that my two data sources are being swapped when changing from the old template to my new one. I change the template for my graphs via Graph management -> <select the checkboxes of graphs i want to change the template> -> Change graph template -> Go

I exported the old template from which i am migrating, its here:
http://bembel.homeip.net/~johannes/old-template.xml
The new template I created is this one:
http://bembel.homeip.net/~johannes/new-template.xml

When i change the template for the graphs i selected back to the old template, the two data sources are swapped again (which means everything is in the right order again).

I have absolutely no explanaition why cacti does this...when i create new hosts and graphs for them, data sources are chosen correctly.

For better understanding here two screenshots of the swapped and not swapped data sources (traffic_in and traffic_out):

http://bembel.homeip.net/~johannes/data ... ad_one.png
http://bembel.homeip.net/~johannes/data ... od_one.png
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

The problem described here is different from the one that this thread was originally about. The original problem deals with saving graph template items causing graph item mappings to mess up. You are talking about switching the template that a graph uses. To be perfectly honest, the code that handles template switching could use a little work. It doesn't do the best job picking the correct data sources as you have noticed. This has been an ongoing priority for me though, in fact it has been on my TODO for quite a while.

-Ian
muckl
Posts: 9
Joined: Fri Mar 19, 2004 9:18 pm
Location: Germany

Post by muckl »

raX wrote:The problem described here is different from the one that this thread was originally about. The original problem deals with saving graph template items causing graph item mappings to mess up. You are talking about switching the template that a graph uses.
OK. I also had the problem with swapping data sources when saving graph items and thought it was related to the one when changing graph templates because the symptomps were exactly the same.
You're the author, you must know what is related to each other so I guess you're right. ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest