Creating CDEF with multiple datasources

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

Moderators: Developers, Moderators

Post Reply
yid
Cacti User
Posts: 83
Joined: Sat Apr 20, 2002 8:26 pm

Creating CDEF with multiple datasources

Post by yid »

I'm trying to create a graph in cacti similar to this:
http://people.ee.ethz.ch/~oetiker/webto ... on-01.html

I think I know now how to do it, and would like to create just one CDEF with two datasource inputs. Like the option to use current datasource, except I need two datasources.

Is there a workaround to do this, or will I have to create seperate CDEFs for each graph :cry: ?

Update:
I tried adding a "defname" field the to rrd_graph_item table, and then I added an option to cdef_items.php under the "edit" case to add datasource based on the defname.

It doesn't work because the defname is interpreted, and stored as a dsid in the "save" case. So the cdef still isn't dynamic.

I guess what I would need to edit the rrd_functions.php so that the cdef wasn't interpreted until you actually start graphing.

Sounds like a bit much for me to do. Anyone else have ideas?
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Like you said the only way to currently do this is to create a unique CDEF statement for each graph. If you add the data source into the CDEF, it is automatically interpreted by cacti when the graph is generated.

The problem is, I cannot think of a clean way to impliment this feature. 'Use Current Data Source' works because there can only be one data source at a time, so everything works out. However when you start dealing with two or more data sources, cacti no longer knows which ones you are talking about.

If you have any implimention suggestions, I'd like to hear them.

-Ian
yid
Cacti User
Posts: 83
Joined: Sat Apr 20, 2002 8:26 pm

Post by yid »

Since cacti creates a DEF for each datasource, maybe you could make a field in rrd_graph_items that could change the DEF name to something other than a,b,c...

Then, when the graph is actually created, if there's a multi-ds-CDEF (add a case) present in the graph, graph.php could search the the graph_items for the DEFs in the CDEF item, and pull the datasources then. It would mean a little code duplication: making the graph.php do the SQL that ordinarily the graph_items.php does (I think that's right I'm not looking at it now), but I think thats a way to do it.

Now that I say it like that... I might be able to do it after all... maybe

Of course, you're the expert :D
What do you think.

Aaron
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests