diff --git a/plugins/sphinx/sphinx_connections b/plugins/sphinx/sphinx_connections index e0eb644a..da389a0a 100755 --- a/plugins/sphinx/sphinx_connections +++ b/plugins/sphinx/sphinx_connections @@ -4,8 +4,16 @@ * @author: Konstantin Kuklin * Date: 24.05.12 */ +$host = getenv('host'); +$port = getenv('port'); -$sCommandSystem = "echo 'show status;' | mysql -h127.0.0.1 -P9306 | grep connections | awk '{ print $2}';"; +if (!$host) + $host = '127.0.0.1'; + +if (!$port) + $port = 9306; + +$sCommandSystem = "echo 'show status;' | mysql -h{$host} -P{$port} | grep connections | awk '{ print $2}';"; $sTmpFilePath = "/tmp/sphinx_connections"; if (isset($argc) && $argc > 1) { diff --git a/plugins/sphinx/sphinx_queries b/plugins/sphinx/sphinx_queries index f11c5e83..0862b7c3 100755 --- a/plugins/sphinx/sphinx_queries +++ b/plugins/sphinx/sphinx_queries @@ -4,8 +4,16 @@ * @author: Konstantin Kuklin * Date: 24.05.12 */ +$host = getenv('host'); +$port = getenv('port'); -$sCommandSystem = "echo 'show status;' | mysql -h127.0.0.1 -P9306 | grep '^queries' | awk '{ print $2}';"; +if (!$host) + $host = '127.0.0.1'; + +if (!$port) + $port = 9306; + +$sCommandSystem = "echo 'show status;' | mysql -h{$host} -P{$port} | grep '^queries' | awk '{ print $2}';"; $sTmpFilePath = "/tmp/sphinx_queries"; if (isset($argc) && $argc > 1) {