public static function addDS2RRDFile($rrdFileName, $newDS)
 {
     //Get Existing Datasources
     $datassources = self::getDSFromRRDFile($rrdFileName);
     //Add New DataSources
     $datassources[] = $newDS;
     //Create array with DS Options
     $dsoptions = array();
     foreach ($datassources as $ds) {
         $dsoptions[] = RRD::getDSOption($ds);
     }
     //get RRD Options
     $rrdOptions = RRD::getRRDFileOptions($dsoptions);
     //Move OriginalFile to /tmp
     $tmpFileName = "/tmp/tmp.rrd";
     rename($rrdFileName, $tmpFileName);
     //add source options
     $rrdOptions[] = "-r";
     $rrdOptions[] = $tmpFileName;
     echo "\n\nUPDATE RRD\n\n";
     print_r($rrdOptions);
     echo "\n\n+++++++++++\n\n";
     echo $rrdFileName;
     echo "\n\n###########\n\n";
     //create new RRDFile
     //RRD::createRRDFile($rrdFileName,$rrdOptions);
     $cmd = "rrdcreate " . $rrdFileName . " " . implode(" ", $rrdOptions);
     echo $cmd;
     echo "\n";
     shell_exec($cmd);
 }
 private function createHardwareRRDFile()
 {
     echo "createHardwareRRD";
     $initFirmware = "TP-Link TL-WR841N/ND v9";
     $initCodeFirmware = $this->hardwareMapper->addNameToMapping($initFirmware);
     $dataSources = array("DS:" . $initCodeFirmware . ":GAUGE:600:0:U");
     $options = RRD::getRRDFileOptions($dataSources);
     RRD::createRRDFile($this->rrdHardwareFile, $options);
 }