Remote database connections, and the default db selection

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

Moderators: Developers, Moderators

Post Reply
cjfournier
Posts: 15
Joined: Thu Mar 01, 2012 9:56 am

Remote database connections, and the default db selection

Post by cjfournier »

I have some customisations going into an instance of 0.8.7i, wherein I populate the values of a drop-down via mysql_connect to a remote server. Even though I'm specifying a link identifier, this seems to have impact on some of the plugins. Here's a snippit of the code:

$my_db = mysql_connect(read_config_option("rem_db_host"),read_config_option("rem_db_user"),read_config_option("rem_db_pw"), true) ;
mysql_select_db(read_config_option("rem_db"),$my_db) ;
$res = mysql_query("SELECT * FROM channel ORDER BY id",$my_db);
while($row = mysql_fetch_array($res)) {
$foo_prop_types[$row['id']] = $row['longDescr'] ;
}
mysql_close($my_db) ;

This appears to reset the default database selection as, when I select the 'monitor' tab (plugin), it reports 'no database selected'. Should I be using some internal/alternate method to do this, or is there a way to restore the default db connection?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Remote database connections, and the default db selectio

Post by gandalf »

That's new to me, but depending on the way those plugins use db connection. It would be a matter of asking for this e.g. in the MONITOR plugin tread. As this seems to work for Cacti without that very plugin, the issue seems to be related to that plugin
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests