Cacti / plugin_flowview

FlowView Plugin for Cacti
GNU General Public License v2.0
18 stars 10 forks source link

Add the possibilites for Flowview to use a different DB than the Cacti one #91

Closed arno-st closed 3 months ago

arno-st commented 8 months ago

Due to the charge on my DB, I need to use an other DB than Cacti. So far only the flow_collector.php can access another DB, than Cacti, but it's the only part.

I think it can be a good idea to have flowview to be able to use a separate DB than Cacti. Like it's offered on the plugin syslog.

TheWitness commented 4 months ago

Totally agree. Can you do a pull request?

arno-st commented 4 months ago

I'm on it. I will take the same approach that was done on syslog

I already fork the dev branch.

TheWitness commented 4 months ago

Awesome. I was going to recommend it's DB library, though the base library works these days too.

arno-st commented 3 months ago

Well the change are going well. But I'm facing an issue and I don't know how to handle it.

On flowview_schedules.php, on the $schedule_edit array, the field 'query_id' has a method of 'drop_sql' with an sql query.

All of this is used by the function draw_edit_form (from lib/html_form.php) to make a call to the DB, but it's the Cacti DB, and I have no way to change that in a simple manner!

Any clue on which way I should go to solve that issue ?

TheWitness commented 3 months ago

Just use drop_array. Pass to the form object of rows with each element having two columns 'id', 'name' and we don't need drop_sql.

arno-st commented 3 months ago

Simple thanks, and it works (of curse)!

So far it's looking well, for all my test the data are stored in another DB, and I have no error related to that. But it's only on a brand new install. Now I will have to work on the upgrade process. I have an idea on how to do it.

arno-st commented 3 months ago

Can you check my Pull resquest, this one dosen't include the upgrade part, and still hase some cacti_log, So a quick check and disregard it after that.

TheWitness commented 3 months ago

You may want to save your changes, and merge the upgrade Cacti develop into your local repo. Then, you can replace your modified files.

image

TheWitness commented 3 months ago

This is merged now. Thanks for your contribution @arno-st !

arno-st commented 3 months ago

Hi, Well you do it a little to early! The use of an external database was almost finish (just a few detail), but I't missing the upgrade process. When you change your config from Cacti DB to External DB. It's almost finish.

TheWitness commented 3 months ago

Okay, next pull request against the develop branch ;)