Ejemplo n.º 1
0
function graphs_from_plugin($host, $plugin, $overview = false)
{
    global $CONFIG;
    if (!($plugindata = collectd_plugindata($host, $plugin))) {
        return false;
    }
    if (!($plugindata = group_plugindata($plugindata))) {
        return false;
    }
    if (!($plugindata = plugin_sort($plugindata))) {
        return false;
    }
    foreach ($plugindata as $items) {
        if ($overview && isset($CONFIG['overview_filter'][$plugin]) && $CONFIG['overview_filter'][$plugin] !== array_intersect_assoc($CONFIG['overview_filter'][$plugin], $items)) {
            continue;
        }
        $items['h'] = $host;
        $time = array_key_exists($plugin, $CONFIG['time_range']) ? $CONFIG['time_range'][$plugin] : $CONFIG['time_range']['default'];
        if ($CONFIG['graph_type'] == 'canvas') {
            chdir($CONFIG['webdir']);
            isset($items['p']) ? $_GET['p'] = $items['p'] : ($_GET['p'] = '');
            isset($items['pi']) ? $_GET['pi'] = $items['pi'] : ($_GET['pi'] = '');
            isset($items['t']) ? $_GET['t'] = $items['t'] : ($_GET['t'] = '');
            isset($items['ti']) ? $_GET['ti'] = $items['ti'] : ($_GET['ti'] = '');
            $_GET['s'] = $time;
            include $CONFIG['webdir'] . '/graph.php';
        } else {
            printf('<a href="%1$s%2$s"><img src="%1$s%3$s"></a>' . "\n", htmlentities($CONFIG['weburl']), htmlentities(build_url('detail.php', $items, $time)), htmlentities(build_url('graph.php', $items, $time)));
        }
    }
}
Ejemplo n.º 2
0
function graphs_from_plugin($host, $plugin)
{
    global $CONFIG;
    $plugindata = collectd_plugindata($host, $plugin);
    $plugindata = group_plugindata($plugindata);
    foreach ($plugindata as $items) {
        $items['h'] = $host;
        $time = array_key_exists($plugin, $CONFIG['time_range']) ? $CONFIG['time_range'][$plugin] : $CONFIG['time_range']['default'];
        printf('<a href="%s%s"><img src="%s%s"></a>' . "\n", $CONFIG['weburl'], build_url('detail', $items, $time), $CONFIG['weburl'], build_url('graph', $items, $time));
    }
}