Beispiel #1
0
if ($tinylegend) {
    $opts['tinylegend'] = 1;
}
$rrd_cmd = false;
if (isset($MetaGraphDefs[$type])) {
    $identifiers = array();
    foreach ($all_tinst as &$atinst) {
        $identifiers[] = collectd_identifier($host, $plugin, is_null($pinst) ? '' : $pinst, $type, $atinst);
    }
    collectd_flush($identifiers);
    $rrd_cmd = $MetaGraphDefs[$type]($host, $plugin, $pinst, $type, $all_tinst, $opts);
} else {
    if (!in_array(is_null($tinst) ? '' : $tinst, $all_tinst)) {
        return error404($host . '/' . $plugin . (!is_null($pinst) ? '-' . $pinst : '') . '/' . $type . (!is_null($tinst) ? '-' . $tinst : ''), "No rrd file found for graphing");
    }
    collectd_flush(collectd_identifier($host, $plugin, is_null($pinst) ? '' : $pinst, $type, is_null($tinst) ? '' : $tinst));
    if (isset($GraphDefs[$type])) {
        $rrd_cmd = collectd_draw_generic($timespan, $host, $plugin, $pinst, $type, $tinst);
    } else {
        $rrd_cmd = collectd_draw_rrd($host, $plugin, $pinst, $type, $tinst);
    }
}
if (isset($rrd_cmd)) {
    if ($vars['from']) {
        $from = $vars['from'];
    }
    if ($vars['to']) {
        $to = $vars['to'];
    }
    $rrd_cmd .= " -s " . escapeshellarg($from) . " -e " . escapeshellarg($to);
}
Beispiel #2
0
function _collectd_list_cb_graph(&$options, $host, $plugin, $pinst, $type, $tinst)
{
    if (isset($options['filter_tinst'])) {
        if ($options['filter_tinst'] == '@all') {
        } else {
            if ($options['filter_tinst'] == $tinst) {
            } else {
                if (strncmp($options['filter_tinst'], '@merge', 6) == 0) {
                    // Need to exclude @merge with non-existent meta graph
                } else {
                    return false;
                }
            }
        }
    }
    if (isset($options['filter_pinst']) && strncmp($options['filter_pinst'], '@merge', 6) == 0) {
        $pinst = $options['filter_pinst'];
    }
    if (isset($options['filter_tinst']) && strncmp($options['filter_tinst'], '@merge', 6) == 0) {
        $tinst = $options['filter_tinst'];
    }
    $ident = collectd_identifier($host, $plugin, $pinst, $type, $tinst);
    if (!in_array($ident, $options['ridentifiers'])) {
        $options['ridentifiers'][] = $ident;
        $options['result'][] = array('host' => $host, 'plugin' => $plugin, 'pinst' => $pinst, 'type' => $type, 'tinst' => $tinst);
    }
}