Example #1
0
        returnData(Debug::errorMarkdownDashboard('#Host / Service not found in Influxdb'), 1);
    }
}
// load templates
$templates = Folder::loadFolders(array(CUSTOM_TEMPLATE_FOLDER, DEFAULT_TEMPLATE_FOLDER));
Rule::setCheck($perfData['host'], $perfData['service'], $perfData['command'], array_keys($perfData['perfLabel']));
usort($templates, 'Template::compare');
$valid = $templates[0]->isValid();
foreach ($templates as $template) {
    Debug::add($template);
}
Debug::add("Is the first template valid: " . Debug::printBoolean($valid));
if ($valid) {
    $template = $templates[0];
} else {
    $template = Template::findDefaultTemplate($templates, 'default.php');
}
if (isset($template) && !empty($template)) {
    returnData($template->getTemplate($perfData), 0, 'OK');
} else {
    returnData(Debug::errorMarkdownDashboard('#No template found!'), 1);
}
/**
This function will print its input and exit with the given returncode.
@param object $data       This object will be converted to json.
@param int    $returnCode The returncode the programm will exit.
@return null.
**/
function returnData($data, $returnCode = 0)
{
    if ($data instanceof Dashboard) {