Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
I'm wondering if there is there any way to override the CDEF function of certain Graph Items when creating graphs with Aggregate plugin.
I have a bunch of traffic graphs using the default traffic template, but for aggregate graph I would like to invert traffic_out graph lines so they are below the 0 value (and then stack them). I cannot modify the look of existing traffic graphs. Creating a separate template for graphs to aggregate is unfortunately also not an option.
If such a thing is currently not possible, I imagine it should not be too hard to implement (applies to version 1.01 of aggregate):
To plugin_aggregate_graph_templates_item and plugin_aggregate_graphs_graph_item tables column cedf_id is added.
On Aggregate Template edit screen under Graph Items another dropdown is added next to Color Template selector. This dropdown contains defined CDEFs. CDEF used in original graph template is pre-selected.
The same modification is done on Aggregate Graphs Edit screen.
If I cannot figure another solution I'll probably try to patch Aggregate to implement this.
Please feel free to add new features to that plugin.
Providing a new CDEF everywhere should not be that hard, indeed.
But I'm quite sure that this will not be enough. You may still have to change LINEx to AREA. And you only may want to supply a CDEF for _specific_ graph items (you can add a new column like "Skip" or "Total" to do so).
And then, you may still have to change the original graph template settings to allow drawing on the negative y-axis.
I fear that there's more ahead. I once tried to achieve exactly this modification for traffic graphs but failed to do it automatically.
So, in case you succeed, I'd indeed like to accept your patch
R.
You were right, changing LINEx to AREA was also be necessary. Now I have something that seems to work, but I have to manually adjust values I want to override in plugin_aggregate_graphs_graph_item table. After that aggregate graph generation works fine - graph item definitions are taken from original graph template with CDEF and graph type overridden with values from plugin_aggregate_graphs_graph_item. Expanding this to override other properties should not be too difficult.
Now how to allow users to specify these overrides in GUI. Adding columns next to "Skip" and "Total" streches the page too much and it looks horrible:
cacti_aggreagte_editor.png (153.29 KiB) Viewed 4182 times
Rather I propose to add a link for each graph item to a graph item editor - similar to one when editing graph template items. In it you could specify if you want to override certain item properties and the new value. When you save an item, the changes are saved to plugin_aggregate_graphs_graph_item or plugin_aggregate_graph_templates_item for the selected item (item is a combination of aggregate_graph_id/aggregate_template_id and graph_templates_item_id).
I see there is already an item editor in aggregate_item.php, but I can't tell if it's ever presented to the user in the current trunk code. Will I break something if I modify that editor?
You might override the default width of columns to fit them into your page.
And, of course you may change the editor and see what you get. In any case I would try to do a regression test of the outcome before integrating that into main code
R.
This took me a lot longer than I anticipated, there was a lot more to be done than I first imagined. But I feel I finally have something useful. There is a patch attached in the bug tracker under #2155. Change summary:
You can change graph configuration values (size, auto scale...) in aggregate template.
You can override item type and CDEF for each graph item from original graph template.
When using "Print all Legend Items" an extra empty line is inserted before Total lines.
A bunch of bugfixes (mostly related to handling of graph items in aggregate DB tables).
A lot of code cleanup (moving duplicate code to functions, removing unused code). Still a ways to go.
This is an example of what can be done now by just creating an appropriate aggregate graph or aggregate template. Say you want to aggregate a bunch of ordinary traffic graphs:
traffic.png (49.33 KiB) Viewed 4064 times
By converting the Out items to AREA and applying a CDEF to multiply by -1 the aggregate can look like this (please excuse the horrible color choice):
aggregate.png (84.62 KiB) Viewed 4064 times
I imagine this might be useful to somebody else and not just me. gandalf when you get the chance, please take a look at the patch.
Patch is in SVN since yesterday. Not yet released as I didn't found time for testing, yet.
You may verify that I applied all patches succesfully ...
R.
Ran "svn up", did uninstall, install. Created / changed a few aggregate graph and templates. Everything seems to work fine.
However, please take a look at function aggregate_upgrade_1_0 in setup.php. At the end is a loop that adds columns to existing aggregate tables. I've done it this way since I'm not sure if v1.0 is considered officially released and thus did not want to change definitions for table_create above.