From 5c5c7fdd76daf1b96a6493ac3a38bef45e82f7b1 Mon Sep 17 00:00:00 2001 From: laf Date: Fri, 24 Jul 2015 07:52:28 +0100 Subject: [PATCH] Finished distributed poller check --- validate.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/validate.php b/validate.php index 99606c6e9d..09bf0a2580 100755 --- a/validate.php +++ b/validate.php @@ -168,11 +168,14 @@ foreach ($modules as $module) { print_fail('You have not configured $config[\'distributed_poller_memcached_port\']'); } else { - $memcache = new Memcached(); - $memcache->addServer($config['distributed_poller_memcached_host'], $config['distributed_poller_memcached_port']); - if (!$memcache->getStats()) { + $connection = @fsockopen($config['distributed_poller_memcached_host'], $config['distributed_poller_memcached_port']); + if (!is_resource($connection)) { print_fail('We could not get memcached stats, it is possible that we cannot connect to your memcached server, please check'); } + else { + fclose($connection); + print_ok('Connection to memcached is ok'); + } } if (empty($config['rrdcached'])) { print_fail('You have not configured $config[\'rrdcached\']'); @@ -181,7 +184,15 @@ foreach ($modules as $module) { print_fail('You have not configured $config[\'rrd_dir\']'); } else { - + list($host,$port) = explode(':',$config['rrdcached']); + $connection = @fsockopen($host, $port); + if (is_resource($connection)) { + fclose($connection); + print_ok('Connection to rrdcached is ok'); + } + else { + print_fail('Cannot connect to rrdcached instance'); + } } } break;