Cactid

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

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

Post by TheWitness »

Tap,

Here is the update sql.c file. I have not tried to compile it yet, I am at a shared computer without tools. It will attempt to connect up to 20 times with at 10th of a second interval between retries. If it can't connect after all the attempts, it will die.

TheWitness
Attachments
sql.c
(3.39 KiB) Downloaded 253 times
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?
tapufd
Cacti User
Posts: 55
Joined: Thu Aug 19, 2004 9:14 am
Location: Belgium

Post by tapufd »

TheWitness,

See in attachment the cacti.log file while using cactid.exe without the changed sql.c file --> polling process with 1 process and variable threads.
Testing now cactid.exe with the changed sql.c file. Will update you as soon as possible.

/Tap
Attachments
cacti.txt
(8.08 KiB) Downloaded 209 times
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Willie & Tap,

You need to NOT use the PConnect as recommended by another user. I will cause your MySQL log file to exhaust your system of it's disk space. Do not use it. I will be committing a revised database.php to remove this setting in the next few days.

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?
Willie

Cactid

Post by Willie »

Larry,

I will change the sql.c to your new version and remove the pconnect. Although, it was the pconnect that made it work. Without both the changed sql.c (my one, not the mod one with the sleep that you just posted) and the pconnect, I got those really nasty error messages from php on the web side. I will let you know tomorrow once I get back into the office.

Regards,

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

Post by TheWitness »

Willie,

I am going to try to resurrect the PConnect. However, the code will have to change to perform an explicit disconnect. When I implemented at the office, my MySQL server logs grew rather rapidly. The disconnect should allow us to re-implement.

I have the day off today. You can reach me at (586)759-3129

Larry
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?
tapufd
Cacti User
Posts: 55
Joined: Thu Aug 19, 2004 9:14 am
Location: Belgium

Post by tapufd »

Hello guys,

I have used cactid.exe, with the changed sql.c file, for a whole night now, and didn't have the connection problems. Yeha! :P

Should I use PConnect or Connect now in lib\database.php ?
Seems that Willie has another solution, that uses the PConnect?!

Anyway, many thanks guys.

/Tap
Willie

cactid

Post by Willie »

Larry,

I have loaded the latest cactid code with the new sql.c that you sent. I am now able to remove the pconnect form database.php and everything still works.

Regards,

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

Post by TheWitness »

You guys both just made my week (for today anyway). Make sure you download the patches that Ian posted yesterday. There is a major issue with Recache that will lock up the polling process. Currently, there are 4 Cacti 0.8.6b patch files that need to be applied.

Just a note, I should be able to have some form of multiple poller architecture ready within the month. PS. Don't apply any "database" changes (i.e. Just let 0.8.7 beta be broke) for now. Don't attempt to implement until I let you know. I am still changing DB structure and it will screw up your "test" (I hope) installs.

I am also going to make additional changes to both sql.c and database.php to make the SQL retries a configurable option. Maybe not this week. I may simply change the retry and usleep counts in database.php and sql.c to be consistent.

Larry
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?
Willie

cactid

Post by Willie »

Larry,

I spoke too soon. Within an hour of turning my database.php back to connect from pconnect, the mySQL errors came back on the web site (poller continues to run correctly). I have had to change it back to pconnect so my users can enter data into the system.

Regards,

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

Post by TheWitness »

Willie,

The code I posted in CVS is not correct. Please try the following code in database.php. Note the retries, delay statments and logic are eqivalent to cactid.

Larry

Code: Select all

/* db_connect_real - makes a connection to the database server
   @arg $host - the hostname of the database server, 'localhost' if the database server is running
      on this machine
   @arg $user - the username to connect to the database server as
   @arg $pass - the password to connect to the database server with
   @arg $db_name - the name of the database to connect to
   @arg $db_type - the type of database server to connect to, only 'mysql' is currently supported
	@arg $retries - the number a time the server should attempt to connect before failing
   @returns - (bool) '1' for success, '0' for error */
function db_connect_real($host,$user,$pass,$db_name,$db_type, $retries = 20) {
	global $cnn_id;

	$i = 1;
	$cnn_id = NewADOConnection($db_type);

	while ($i <= $retries) {
		if ($cnn_id->Connect($host,$user,$pass,$db_name)) {
			return(1);
		}

		$i++;
		usleep(100000);
	}

	cacti_log("ERROR: Cannot connect to MySQL server on '$host'. Please make sure you have specified a valid MySQL	database name in 'include/config.php'.");

	return(0);
}
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?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I have posted to CVS.

Larry
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?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Willie & Tap,

Need to make 1 more correction to the code.

Code: Select all

/* db_connect_real - makes a connection to the database server 
   @arg $host - the hostname of the database server, 'localhost' if the database server is running 
      on this machine 
   @arg $user - the username to connect to the database server as 
   @arg $pass - the password to connect to the database server with 
   @arg $db_name - the name of the database to connect to 
   @arg $db_type - the type of database server to connect to, only 'mysql' is currently supported 
   @arg $retries - the number a time the server should attempt to connect before failing 
   @returns - (bool) '1' for success, '0' for error */ 
function db_connect_real($host,$user,$pass,$db_name,$db_type, $retries = 20) { 
   global $cnn_id; 

   $i = 1; 
   $cnn_id = NewADOConnection($db_type); 

   while ($i <= $retries) { 
      if ($cnn_id->Connect($host,$user,$pass,$db_name)) { 
         return(1); 
      } 

      $i++; 
      usleep(100000); 
   } 

   cacti_log("ERROR: Cannot connect to MySQL server on '$host'. Please make sure you have specified a valid MySQL   database name in 'include/config.php'."); 

   die("<br>Cannot connect to MySQL server on '$host'. Please make sure you have specified a valid MySQL database name in 'include/config.php'."); 

   return(0); 
} 
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?
Willie

cactid

Post by Willie »

Larry,

I have applied the patch and am testing. My initial findings are that when I am using the connect vs the pconnect, I am getting broken graph links when the poller is running. It seems once the poller finishes, things go back to normal. If I am running the pconnect, I never get broken graph links.

I will let you know if I get the message again.

Regards,

Willie
tapufd
Cacti User
Posts: 55
Joined: Thu Aug 19, 2004 9:14 am
Location: Belgium

Post by tapufd »

Larry,

Good and bad news :
- the good news :
seems that for the moment my connection problems are solved.
- the bad news :
After implementing the 4 pre-patched files and modifying the database.php file, I'm getting the following strange thing :
in my log I see for every polling a recurring recache event -> WARNING: Recache Event Detected for Host, and it's always for the same Host ?!?
(see attachement)
It's like the Recache system has done the recache but forgot the clearing of it. OR it needs to do a recache but can't do it. All graphs for the host seem to be OK.

/Tap
Attachments
cacti.txt
(2.6 KiB) Downloaded 218 times
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Tap & Willie,

The bug with Recache is now fixed. There is a new lib/data_query.php file that corrects the problem. It can be found at the following link:

http://www.cacti.net/downloads/patches/ ... e-patched/

It should be there by morning. Otherwise, grap it from CVS under the main section.

Larry
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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest