[Edit, Aug 27, 2015: Anyone considering this plug-in should wait a couple of days -- I have the next version ready to go, and it contains several new features and fixes. It is also being renamed 'TreeDnD', so keep an eye out for it! - CF]
I thought I would make my drag-and-drop graph tree plugin available. While it still needs a little finessing, my feeling is that it's a workable product. Even though similar functionality is going to appear in a future release, I thought it would be a good learning opportunity.
As forewarning, it installs like a standard plug-in, but the back-end is a Perl CGI. This will likely require some additional server tweaking (installing Perl if it isn't there, as well as configuring Apache to handle CGIs, etc.) -- That said, it's not a seamless
integration with Cacti (like most other plugins), but this will be an objective.
It also purposely omits some functionality that exists with the original 'Graph Tree' handler -- Namely, the 'host' and 'sort' options. On the former, it was a convenience function that saved having to add multiple graphs to a branch. With DnD, the same is done by simply dragging the host to the target branch on a tree (and the graphs go along with it.) With regard to sorting, the source tree is mostly sorted (some finessing required), but obviously being able to quickly move stuff around eliminates this need.
In any case, here we go: Drop the tarball into the plugins directory, and extract. Make sure Perl, and the requisite libraries are installed (and again, make sure Apache has ExecCGI and an 'addHanlder' for CGI scripts.) Try running 'cdnd.cgi' from the command line, and if it complains about something obvious, it need be fixed (again, most likely library installs.)
Enable the plugin as per usual:
File comment: plugin_enable
plugin_enabled.png [ 50.07 KiB | Viewed 5295 times ]
On the Management Menu, you'll now see 'Graph Trees (DnD)
' -- As option, there is a setting on the 'Misc
' settings tab to re-write the Management menu (I mostly did this for myself
settings.png [ 28.72 KiB | Viewed 5295 times ]
The main dialog appears as follows, with the source tree (available graphs) on the right, and the graph tree(s) on the left.
main.png [ 104.35 KiB | Viewed 5295 times ]
I might suggest trying this out on a non-production server first. The plugin uses the 'Fancytree' jquery library -- while this has excellent targeting cues, it takes a little getting used to.There are a couple of very important points to make:
- Changes are not atomic -- All changes require a 'commit', before any data is touched- Existing tree data in the database will be wiped on every commit. In other words, whatever is in the web page gets pushed to the database.
The inherent flexibility of DnD allows for very quick changes to tree structures, while making updates to the database each and every time could
prove taxing (and potentially, delayed response via the interface.) My thought was that a 'commit' practice allows for a little more buffering. On the second point, it would be very challenging to try and merge every single change into existing tree data (in the db) -- Since what's on the screen represents the desired configuration anyway, a commit just deletes existing graph tree data in the database, and replaces it with the new. Warning: As I mentioned before, I purposely chose not to include accommodation for 'host' mode - If you have any of these in your existing trees and do a 'commit', they will get vaporized (and appear as funny, half-formed entities in the tree.)
Since I do not
want to be responsible for mangling anyone's existing trees, I also included an auto-backup feature with every commit. This generates pure (My)SQL that would restore the graph tree data prior to it being summarily replaced. If there is a want/need to restore, simply feed the data into 'mysql' from the command line.
While it's supposed
to include keyboard shortcuts, I'm still working on that one -- In the interim, adding headers and/or branch/node delete is done via context menu (right-mouse click.) Edit: 0.1b has working hot-keys, since the issue turned out to be issue with jQuery-UI 1.11.1
cacti_cdnd_9.png [ 111.11 KiB | Viewed 5295 times ]
Upon any change, the 'Commit' button will begin flashing as reminder that a push is required. Upon committing changes, there should be indication of success and a reference to the backup's name.
cacti_cdnd_10.png [ 193.24 KiB | Viewed 5295 times ]
Edit: The context menu will look a little different from the above, since the screen caps were taken with 0.1a