generic database supportb (against 0.8.7b)

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
steki
Posts: 3
Joined: Fri Aug 01, 2008 2:37 am

generic database supportb (against 0.8.7b)

Post by steki »

Honestly I didn't checked on this forum if someone has done any job done in regards of porting cacti to other databases. As this is still work in progress i'm posting here just as request for comment about code design...
I was trying not using ANY mysql-isms or pgsql-isms (nice words hehe)
so concat was emulated with adodb $GLOBALS['cnn_id']->Concat() call.
replace into calls i didn't replaced with db_replace - maybe that would be best solution but on first look too ugly and not very clean from SQL side (you don't know what is going on behind - probably I'm wrong but please comment about it)
ALL "select xx from yy limit x" and "select xx from yy limit a,b" are replaced with new additions to db functions $numrows and $offset...
ALL select x from (xx, yy) where a=b are replaced with select x from xx,yy
or if there are cross reference of tables added CROSS JOIN so it would work correctly...

will try to finish it as soon as possible.

COMMENTS PLEASE!!!!!

P.S. yes i found many references about job already done for older versions, but what a hack i like to code sometimes.... :)
P.P.S. nope it is not funny that .diff is not allowed to be uploaded...
Attachments
pg_cacti-2008-08-01-01-08.patch
patch file against 0.8.7b
(205.95 KiB) Downloaded 532 times
steki
Posts: 3
Joined: Fri Aug 01, 2008 2:37 am

Re: generic database supportb (against 0.8.7b)

Post by steki »

Added hopefully usable oracle schema (work in progress).

"Problems" with cacti and oracle
adodb is usable for this task but as can be seen from bellow
Array
(
[ID] => 1
[USERNAME] => admin
[PASSWORD] => 21232f297a57a5a743894a0e4a801fc3
[REALM] => 0
[FULL_NAME] => Administrator
[MUST_CHANGE_PASSWORD] =>
[SHOW_TREE] => on
[SHOW_LIST] => on
[SHOW_PREVIEW] => on
[GRAPH_SETTINGS] => on
[LOGIN_OPTS] => 1
[POLICY_GRAPHS] => 1
[POLICY_TREES] => 1
[POLICY_HOSTS] => 1
[POLICY_GRAPH_TEMPLATES] => 1
[ENABLED] => on
)
all associated keys returned from adodb oci8 are in capital, or from pgsql - mysql
all are lowercase

Array
(
[id] => 1
[username] => admin
[password] => 21232f297a57a5a743894a0e4a801fc3
[realm] => 0
[full_name] => Administrator
[must_change_password] =>
[show_tree] => on
[show_list] => on
[show_preview] => on
[graph_settings] => on
[login_opts] => 1
[policy_graphs] => 1
[policy_trees] => 1
[policy_hosts] => 1
[policy_graph_templates] => 1
[enabled] => on
)

discussion please :)
Attachments
cacti_oci.sql.gz
this script can be used to create schema, users, and db object necessary for oracle to work with cacti
(33.46 KiB) Downloaded 334 times
steki
Posts: 3
Joined: Fri Aug 01, 2008 2:37 am

Re: generic database supportb (against 0.8.7b)

Post by steki »

Hello,

please find attached schema generator that will generate schema for three databases
postgresql
mysql
sqlite
of course cacti does not support them but that would be a good start for any further development if you ask me (no one do but i don't care...)

anyway gen.pl is borrowed from zabbix project, and as it is GPL licensed this will not be a problem for this usage
please be aware that oracle version is not usable because few things
1. it is not create sequences and triggers (it is my plan for few next days to add it)
2. one of tables has "rows" column which is special word for oracle so it is NOT possible to use it as it is ...
3. capital letters for table names and return values for keynames in arrays returned from
db_fetch_asoc()

that is it for now ...
Attachments
cacti-db.tgz
cacti-db/Makefile (obvious...)
cacti-db/gen.pl (db generator script)
cacti-db/dumpdb.sh (db dump all data from cacti database into file with many inserts :) )
cacti-db/data.sql (extracted data with dumpdb.sh)
cacti-db/schema.sql this is main thing that ca
(35.51 KiB) Downloaded 310 times
dandv
Posts: 1
Joined: Mon Nov 17, 2008 11:43 pm

Re: generic database supportb (against 0.8.7b)

Post by dandv »

steki wrote:Honestly I didn't checked on this forum if someone has done any job done in regards of porting cacti to other databases
Well, someone has, since 2007. See this thread, PostgreSQL / Generic Database - PATCH.

Image
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

As a developer, we have not implemented that patch due to the fact that not one of the key developers uses postresql, oracle, or mssql. Until that changes, it's hard for us to support these other databases.

Maybe we shouldn't worry about it working and just "hope" that the submissions by others work. Comments?

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
rtector
Posts: 1
Joined: Tue Apr 07, 2009 1:56 pm

Post by rtector »

I think merging support would allow testing by a far greater number of people, and I'm sure that any bugs would soon be reported/fixed.

I, for example, would be quite happy with testing but it's difficult when there are different patches floating around to keep on top of.
skolima
Posts: 1
Joined: Tue Jul 14, 2009 9:32 am

Post by skolima »

I agree - being included in the official package (even as an unsupported option) would give alternative database backends much more exposure and testing.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests