public function getPreviewHtml(MonitoredObject $object)
 {
     $object->fetchCustomvars();
     if (array_key_exists("graphite_keys", $object->customvars)) {
         $graphiteKeys = $object->customvars["graphite_keys"];
     } else {
         $graphiteKeys = array();
         foreach (PerfdataSet::fromString($object->perfdata)->asArray() as $pd) {
             $graphiteKeys[] = $pd->getLabel();
         }
     }
     if ($object instanceof Host) {
         $host = $object;
         $service = null;
     } elseif ($object instanceof Service) {
         $service = $object;
         $host = null;
     } else {
         return '';
     }
     $html = "<table class=\"avp newsection\">\n" . "<tbody>\n";
     foreach ($graphiteKeys as $metric) {
         $html .= "<tr><th>\n" . "{$metric}\n" . '</th><td>' . $this->getPreviewImage($host, $service, $metric) . "</td>\n" . "<tr>\n";
     }
     $html .= "</tbody></table>\n";
     return $html;
 }
 public function getPreviewHtml(MonitoredObject $object)
 {
     $object->fetchCustomvars();
     if (array_key_exists("graphite", $object->customvars)) {
         $this->parseGrapherConfig($object->customvars["graphite"]);
     }
     $this->getKeysAndLabels($object->customvars);
     if (empty($this->graphiteKeys)) {
         $this->getPerfDataKeys($object);
     }
     if ($object instanceof Host) {
         $host = $object;
         $service = null;
     } elseif ($object instanceof Service) {
         $service = $object;
         $host = null;
     } else {
         return '';
     }
     $html = "<table class=\"avp newsection\">\n" . "<tbody>\n";
     for ($key = 0; $key < count($this->graphiteKeys); $key++) {
         $html .= "<tr><th>\n" . $this->graphiteLabels[$key] . '</th><td>' . $this->getPreviewImage($host, $service, $this->graphiteKeys[$key]) . "</td>\n" . "<tr>\n";
     }
     $html .= "</tbody></table>\n";
     return $html;
 }