google-code-export / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
1 stars 0 forks source link

php script doesn't accept sockets #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
------------------------------------------------------
1. attempt to use the ss_get_mysql_stats.php script with a socket.

What is the expected output?
------------------------------------------------------
i expect the script to preform just like it does with tcp/ip based 
connections.

What do you see instead?
------------------------------------------------------
Cannot connect to mysql server and app crash

What version of the product are you using? On what operating system?
------------------------------------------------------
1.1.1 on RHEL5.2 with MySQL 5.1.26

Please provide any additional information below.
-----------------------------------------------------------
in our environment, for security reasons, we run with --skip-networking. 
Only socket connections are allowed.

per php.net/mysql_connect, you can pass the location of a socket as the 
hostname via this pattern:  ":/path/socket". This worked OK but the 
$cache_file is constructed from the hostname, so I made a patch to strip 
out the ":" and any "/" in the hostname.

function ss_get_mysql_stats( $options ) {
<snip>
   $cache_file_name = str_replace(array(":", "/"), array("", "_"), 
$options[host]);
   $cache_file = "$cache_dir/$cache_file_name-mysql_cacti_stats.txt";
<snip>
}

Original issue reported on code.google.com by phpnotasp on 24 Oct 2008 at 4:13

GoogleCodeExporter commented 9 years ago
Committed to r105.  Thanks for the patch.

Original comment by baron.schwartz on 26 Oct 2008 at 7:46