diff --git a/www/class/centreonGraph.class.php b/www/class/centreonGraph.class.php
index 4c4d59f13f4..888b87f546f 100644
--- a/www/class/centreonGraph.class.php
+++ b/www/class/centreonGraph.class.php
@@ -113,6 +113,7 @@ class CentreonGraph
     protected $vname;
     protected $metrics;
     protected $longer;
+    protected $rrdCachedOptions;
     public $onecurve;
     public $checkcurve;
 
@@ -206,6 +207,19 @@ public function __construct($user_id, $index = null, $debug = 0, $compress = nul
         $DBRESULT->closeCursor();
         unset($opt);
 
+        /* Get RRDCacheD options */
+        $result = $this->DB->query(
+            "SELECT config_key, config_value
+            FROM cfg_centreonbroker_info AS cbi
+            INNER JOIN cfg_centreonbroker AS cb ON (cb.config_id = cbi.config_id)
+            INNER JOIN nagios_server AS ns ON (ns.id = cb.ns_nagios_server)
+            WHERE ns.localhost = '1'
+            AND cbi.config_key IN ('rrd_cached_option', 'rrd_cached')"
+        );
+        while ($row = $result->fetch()) {
+            $this->rrdCachedOptions[$row['config_key']] = $row['config_value'];
+        }
+
         if (isset($index)) {
             $DBRESULT = $this->DB->query("SELECT `metric_id`
                                           FROM `ods_view_details`
@@ -1504,9 +1518,11 @@ public function getOVDColor($metricId)
         if (is_null($this->colorCache)) {
             $this->colorCache = array();
 
-            $DBRESULT = $this->DB->query("SELECT metric_id, rnd_color FROM `ods_view_details` WHERE `index_id` = '" . $this->index . "'");
+            $DBRESULT = $this->DB->query(
+                "SELECT metric_id, rnd_color FROM `ods_view_details` WHERE `index_id` = '" . $this->index . "'"
+            );
             while (($row = $DBRESULT->fetchRow())) {
-                $this->colorCache[$row['metric_id']] = $row['rnd_color']; 
+                $this->colorCache[$row['metric_id']] = $row['rnd_color'];
             }
         }
         
@@ -1519,7 +1535,7 @@ public function getOVDColor($metricId)
                 'INSERT INTO `ods_view_details` (rnd_color, index_id, metric_id) '
                 . 'VALUES ("' . $lRndcolor . '", ' . $this->index . ', ' . $metricId  . ')'
             );
-		}
+        }
         return $lRndcolor;
     }
 
@@ -1565,7 +1581,7 @@ public function getRandomWebColor()
             '#ff66ff', '#ff9900', '#ff9933', '#ff9966', '#ff9999', '#ff99cc',
             '#ff99ff', '#ffcc00', '#ffcc33', '#ffcc66', '#ffcc99', '#ffcccc',
             '#ffccff');
-            return $webSafeColors[rand(0,sizeof($webSafeColors)-1)];
+            return $webSafeColors[rand(0, sizeof($webSafeColors)-1)];
     }
 
     /**
@@ -1780,8 +1796,8 @@ private function checkDBAvailability($metric_id)
      */
     protected function flushRrdcached($metricsId)
     {
-        if (!isset($this->generalOpt['rrdcached_enable'])
-            || $this->generalOpt['rrdcached_enable'] == 0
+        if (!isset($this->rrdCachedOptions['rrd_cached_option'])
+            || !in_array($this->rrdCachedOptions['rrd_cached_option'], ['unix', 'tcp'])
         ) {
             return true;
         }
@@ -1791,20 +1807,14 @@ protected function flushRrdcached($metricsId)
          */
         $errno = 0;
         $errstr = '';
-        if (isset($this->generalOpt['rrdcached_port'])
-            && trim($this->generalOpt['rrdcached_port']) != ''
-        ) {
-            $sock = @fsockopen('127.0.0.1', trim($this->generalOpt['rrdcached_port']), $errno, $errstr);
-            if ($sock === false) {
-                return false;
-            }
-        } elseif (isset($this->generalOpt['rrdcached_unix_path'])
-            && trim($this->generalOpt['rrdcached_unix_path']) != ''
-        ) {
-            $sock = @fsockopen('unix://' . trim($this->generalOpt['rrdcached_unix_path']), $errno, $errstr);
+        if ($this->rrdCachedOptions['rrd_cached_option'] === 'tcp') {
+            $sock = fsockopen('127.0.0.1', trim($this->rrdCachedOptions['rrd_cached']), $errno, $errstr);
+        } elseif ($this->rrdCachedOptions['rrd_cached_option'] === 'unix') {
+            $sock = fsockopen('unix://' . trim($this->rrdCachedOptions['rrd_cached']), $errno, $errstr);
         } else {
             return false;
         }
+
         if (false === $sock) {
             // @todo log the error
             return false;
diff --git a/www/class/centreonGraphNg.class.php b/www/class/centreonGraphNg.class.php
index a788d9a5bb1..44d4d8aaccd 100644
--- a/www/class/centreonGraphNg.class.php
+++ b/www/class/centreonGraphNg.class.php
@@ -156,6 +156,7 @@ class CentreonGraphNg
     protected $vnodesDependencies;
     protected $vmetricsOrder;
     protected $graphData;
+    protected $rrdCachedOptions;
     
     /**
      * Connect to databases
@@ -228,6 +229,20 @@ public function __construct($userId)
         $stmt = $this->db->prepare("SELECT `key`, `value` FROM options");
         $stmt->execute();
         $this->generalOpt = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC);
+
+        /* Get RRDCacheD options */
+        $stmt = $this->db->query(
+            "SELECT config_key, config_value
+            FROM cfg_centreonbroker_info AS cbi
+            INNER JOIN cfg_centreonbroker AS cb ON (cb.config_id = cbi.config_id)
+            INNER JOIN nagios_server AS ns ON (ns.id = cb.ns_nagios_server)
+            WHERE ns.localhost = '1'
+            AND cbi.config_key IN ('rrd_cached_option', 'rrd_cached')"
+        );
+
+        while ($row = $stmt->fetch()) {
+            $this->rrdCachedOptions[$row['config_key']] = $row['config_value'];
+        }
     }
     
     /**
@@ -332,8 +347,8 @@ protected function getCurveDsConfig($metric)
                 break;
             }
 
-            if (is_null($dsDataRegular) && 
-                preg_match('/^' . preg_quote($dsVal['ds_name'], '/') . '$/i', $metric['metric_name'])
+            if (is_null($dsDataRegular)
+                && preg_match('/^' . preg_quote($dsVal['ds_name'], '/') . '$/i', $metric['metric_name'])
             ) {
                 $dsDataRegular = $dsVal;
             }
@@ -594,11 +609,12 @@ public function addMetric($metricId, $isVirtual = 0)
     {
         if ($isVirtual == 0) {
             $stmt = $this->dbCs->prepare(
-                "SELECT m.index_id, host_id, service_id, metric_id, metric_name, unit_name, min, max, warn, warn_low, crit, crit_low
-                 FROM metrics AS m, index_data AS i
-                 WHERE m.metric_id = :metric_id
-                    AND m.hidden = '0'
-                    AND m.index_id = i.id"
+                "SELECT m.index_id, host_id, service_id, metric_id, metric_name,
+                unit_name, min, max, warn, warn_low, crit, crit_low
+                FROM metrics AS m, index_data AS i
+                WHERE m.metric_id = :metric_id
+                AND m.hidden = '0'
+                AND m.index_id = i.id"
             );
             $stmt->bindParam(':metric_id', $metricId, PDO::PARAM_INT);
             $stmt->execute();
@@ -655,7 +671,8 @@ private function initCurveList()
         
         foreach ($this->metrics as $metricId => &$tm) {
             if (isset($tm['ds_data']['ds_invert']) && $tm['ds_data']['ds_invert']) {
-                $this->addArgument("DEF:vi" . $metricId . "=" . $this->dbPath . $metricId . ".rrd:value:AVERAGE CDEF:v" . $metricId . "=vi" . $metricId . ",-1,*");
+                $this->addArgument("DEF:vi" . $metricId . "=" . $this->dbPath . $metricId . ".rrd:value:AVERAGE CDEF:v"
+                    . $metricId . "=vi" . $metricId . ",-1,*");
             } else {
                 $this->addArgument("DEF:v" . $metricId . "=" . $this->dbPath . $metricId . ".rrd:value:AVERAGE");
             }
@@ -664,7 +681,8 @@ private function initCurveList()
         $this->manageMetrics();
         
         foreach ($this->vmetricsOrder as $vmetricId) {
-            $this->addArgument($this->vmetrics[$vmetricId]['def_type'] . ":vv" . $vmetricId . "=" . $this->vmetrics[$vmetricId]['rpn_function']);
+            $this->addArgument($this->vmetrics[$vmetricId]['def_type'] . ":vv" . $vmetricId . "="
+                . $this->vmetrics[$vmetricId]['rpn_function']);
         }
     }
     
@@ -876,7 +894,8 @@ private function getIndexData()
         }
         
         if ($this->indexData["host_name"] != "_Module_Meta") {
-            $this->extraDatas['title'] = $this->indexData['service_description'] . " " . _("graph on") . " " . $this->indexData['host_name'];
+            $this->extraDatas['title'] = $this->indexData['service_description'] . " " . _("graph on") . " "
+                . $this->indexData['host_name'];
         } else {
             $this->extraDatas['title'] = _("Graph") . " " . $this->indexData["service_description"];
         }
@@ -1034,7 +1053,13 @@ public function getJsonStream()
             2 => $stderr
         );
 
-        $process = proc_open($this->generalOpt['rrdtool_path_bin']['value'] . " - ", $descriptorspec, $pipes, null, null);
+        $process = proc_open(
+            $this->generalOpt['rrdtool_path_bin']['value'] . " - ",
+            $descriptorspec,
+            $pipes,
+            null,
+            null
+        );
         $this->graphData = array(
             'global' => $this->extraDatas,
             'metrics' => array(),
@@ -1101,17 +1126,23 @@ public function getOVDColor($indexId, $metricId)
         if (is_null($this->colorCache)) {
             $this->colorCache = array();
             
-            $stmt = $this->db->prepare("SELECT metric_id, rnd_color FROM `ods_view_details` WHERE `index_id` = :index_id");
+            $stmt = $this->db->prepare(
+                "SELECT metric_id, rnd_color FROM `ods_view_details` WHERE `index_id` = :index_id"
+            );
             $stmt->bindParam(':index_id', $indexId, PDO::PARAM_INT);
             $stmt->execute();
             $this->colorCache = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC);
         }
         
-        if (isset($this->colorCache[$metricId]) && preg_match("/^\#[a-f0-9]{6,6}/i", $this->colorCache[$metricId]['rnd_color'])) {
+        if (isset($this->colorCache[$metricId])
+            && preg_match("/^\#[a-f0-9]{6,6}/i", $this->colorCache[$metricId]['rnd_color'])
+        ) {
             return $this->colorCache[$metricId]['rnd_color'];
         }
         $lRndcolor = $this->getRandomWebColor();
-        $stmt = $this->db->prepare("INSERT INTO `ods_view_details` (rnd_color, index_id, metric_id) VALUES (:rnd_color, :index_id, :metric_id)");
+        $stmt = $this->db->prepare(
+            "INSERT INTO `ods_view_details` (rnd_color, index_id, metric_id) VALUES (:rnd_color, :index_id, :metric_id)"
+        );
         $stmt->bindParam(':rnd_color', $lRndcolor, PDO::PARAM_STR);
         $stmt->bindParam(':index_id', $indexId, PDO::PARAM_INT);
         $stmt->bindParam(':metric_id', $metricId, PDO::PARAM_INT);
@@ -1231,23 +1262,22 @@ private function checkDBAvailability($metricId)
      */
     protected function flushRrdcached($metricsId)
     {
-        if (!isset($this->generalOpt['rrdcached_enable']['value'])
-            || $this->generalOpt['rrdcached_enable']['value'] == 0) {
+        if (!isset($this->rrdCachedOptions['rrd_cached_option'])
+            || !in_array($this->rrdCachedOptions['rrd_cached_option'], ['unix', 'tcp'])
+        ) {
             return true;
         }
 
         $errno = 0;
         $errstr = '';
-        if (isset($this->generalOpt['rrdcached_port']['value'])
-            && trim($this->generalOpt['rrdcached_port']['value']) != '') {
-            $sock = fsockopen('127.0.0.1', trim($this->generalOpt['rrdcached_port']['value']), $errno, $errstr);
-        } elseif (isset($this->generalOpt['rrdcached_unix_path']['value'])
-            && trim($this->generalOpt['rrdcached_unix_path']['value']) != '') {
-            $sock = fsockopen('unix://' . trim($this->generalOpt['rrdcached_unix_path']['value']), $errno, $errstr);
+        if ($this->rrdCachedOptions['rrd_cached_option'] === 'tcp') {
+            $sock = fsockopen('127.0.0.1', trim($this->rrdCachedOptions['rrd_cached']), $errno, $errstr);
+        } elseif ($this->rrdCachedOptions['rrd_cached_option'] === 'unix') {
+            $sock = fsockopen('unix://' . trim($this->rrdCachedOptions['rrd_cached']), $errno, $errstr);
         } else {
             return false;
         }
-        
+
         if (false === $sock) {
             $this->log("socket connection: " . $errstr);
             return false;
diff --git a/www/class/centreonGraphStatus.class.php b/www/class/centreonGraphStatus.class.php
index d270a0bec4a..18611ea3bd5 100644
--- a/www/class/centreonGraphStatus.class.php
+++ b/www/class/centreonGraphStatus.class.php
@@ -54,6 +54,7 @@ public function __construct($index, $start, $end)
         $this->endTime = $end;
         $this->statusPath = $this->getStatusPath();
         $this->generalOpt = $this->getOptions();
+        $this->rrdCachedOptions = $this->getRrdCachedOptions();
     }
 
     /**
@@ -133,28 +134,22 @@ public function getData()
      */
     public function flushRrdCached($indexData)
     {
-        if (false === isset($this->generalOpt['rrdcached_enabled']) ||
-            $this->generalOpt['rrdcached_enabled'] == 0
+        if (!isset($this->rrdCachedOptions['rrd_cached_option'])
+            || !in_array($this->rrdCachedOptions['rrd_cached_option'], ['unix', 'tcp'])
         ) {
             return true;
         }
 
         $errno = 0;
         $errstr = '';
-        if (isset($this->general_opt['rrdcached_port'])
-            && trim($this->general_opt['rrdcached_port']) != ''
-        ) {
-            $sock = @fsockopen('127.0.0.1', trim($this->general_opt['rrdcached_port']), $errno, $errstr);
-            if ($sock === false) {
-                return false;
-            }
-        } elseif (isset($this->general_opt['rrdcached_unix_path'])
-            && trim($this->general_opt['rrdcached_unix_path']) != ''
-        ) {
-            $sock = @fsockopen('unix://' . trim($this->general_opt['rrdcached_unix_path']), $errno, $errstr);
+        if ($this->rrdCachedOptions['rrd_cached_option'] === 'tcp') {
+            $sock = fsockopen('127.0.0.1', trim($this->rrdCachedOptions['rrd_cached']), $errno, $errstr);
+        } elseif ($this->rrdCachedOptions['rrd_cached_option'] === 'unix') {
+            $sock = fsockopen('unix://' . trim($this->rrdCachedOptions['rrd_cached']), $errno, $errstr);
         } else {
             return false;
         }
+
         if (false === $sock) {
             return false;
         }
@@ -209,6 +204,30 @@ protected function getOptions()
         }
         return $result;
     }
+
+    /**
+     * Get the RRDCacheD options of local RRD Broker
+     *
+     * @return array of RRDCacheD options
+     */
+    protected function getRrdCachedOptions()
+    {
+        $result = $this->pearDB->query(
+            "SELECT config_key, config_value
+            FROM cfg_centreonbroker_info AS cbi
+            INNER JOIN cfg_centreonbroker AS cb ON (cb.config_id = cbi.config_id)
+            INNER JOIN nagios_server AS ns ON (ns.id = cb.ns_nagios_server)
+            WHERE ns.localhost = '1'
+            AND cbi.config_key IN ('rrd_cached_option', 'rrd_cached')"
+        );
+
+        $rrdCachedOptions = [];
+        while ($row = $result->fetch()) {
+            $this->rrdCachedOptions[$row['config_key']] = $row['config_value'];
+        }
+
+        return $rrdCachedOptions;
+    }
     
     /**
      * Get the status RRD path
diff --git a/www/include/Administration/parameters/rrdtool/form.ihtml b/www/include/Administration/parameters/rrdtool/form.ihtml
index 76c0807c700..be9eb74abcd 100644
--- a/www/include/Administration/parameters/rrdtool/form.ihtml
+++ b/www/include/Administration/parameters/rrdtool/form.ihtml
@@ -34,26 +34,4 @@
     {/if}
     {$form.hidden}
 </form>
-<script type="text/javascript">
-{literal}
-function toggleRrdcached(radio) {
-    var elPort = document.getElementsByName('rrdcached_port')[0];
-    var elUnixPath = document.getElementsByName('rrdcached_unix_path')[0];
-    if (radio.value == 0) {
-        elPort.value = '';
-        elUnixPath.value = '';
-        elPort.disabled = true;
-        elUnixPath.disabled = true;
-    } else {
-        elPort.disabled = false;
-        elUnixPath.disabled = false;
-    }
-}
-
-jQuery(document).ready(function () {
-	var checkedEl = jQuery('input:checked[type="radio"][name="rrdcached_enable[rrdcached_enable]"]')[0];
-	toggleRrdcached(checkedEl);
-});
-{/literal}
-</script>
 {$helptext}