Ejemplo n.º 1
0
foreach ($plugins as &$plugin) {
    if (!$vars['plugin']) {
        $vars['plugin'] = $plugin;
    }
    if ($vars['plugin'] == $plugin) {
        $navbar['options'][$plugin]['class'] = "active";
    }
    $navbar['options'][$plugin]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'collectd', 'plugin' => $plugin));
    $navbar['options'][$plugin]['text'] = htmlspecialchars(ucwords($plugin));
}
print_navbar($navbar);
echo '<table class="table table-bordered table-condensed table-striped table-hover">';
$i = 0;
$pinsts = collectd_list_pinsts($device['hostname'], $vars['plugin']);
foreach ($pinsts as &$instance) {
    $types = collectd_list_types($device['hostname'], $vars['plugin'], $instance);
    foreach ($types as &$type) {
        $typeinstances = collectd_list_tinsts($device['hostname'], $vars['plugin'], $instance, $type);
        if ($MetaGraphDefs[$type]) {
            $typeinstances = array($MetaGraphDefs[$type]);
        }
        foreach ($typeinstances as &$tinst) {
            $i++;
            if (!is_integer($i / 2)) {
                $row_colour = $list_colour_a;
            } else {
                $row_colour = $list_colour_b;
            }
            echo '<tr><td>';
            echo '<h4>' . $graph_title;
            if ($tinst) {
Ejemplo n.º 2
0
     $arg_pinst = read_var('plugin_instance', $_POST, '');
     $types = collectd_list_types($arg_hosts, $arg_plugin, $arg_pinst);
     if (count($types) > 1) {
         array_unshift($types, '@all');
     }
     return dhtml_response_list($types, 'ListOfType');
 case 'list_tinsts':
     // Generate list of types for selected hosts, plugin and plugin-instance
     $arg_hosts = read_var('host', $_POST, '');
     if (is_array($arg_hosts)) {
         $arg_hosts = reset($arg_hosts);
     }
     $arg_plugin = read_var('plugin', $_POST, '');
     $arg_pinst = read_var('plugin_instance', $_POST, '');
     $arg_type = read_var('type', $_POST, '');
     $tinsts = collectd_list_types($arg_hosts, $arg_plugin, $arg_pinst, $arg_type);
     if (count($tinsts)) {
         if ($arg_type != '@all') {
             require 'definitions.php';
             load_graph_definitions();
             if (isset($MetaGraphDefs[$arg_type])) {
                 array_unshift($tinsts, '@merge');
             }
             if (count($tinsts) > 1) {
                 array_unshift($tinsts, '@all');
             }
         } else {
             array_unshift($tinsts, '@merge');
             if (count($tinsts) > 1) {
                 array_unshift($tinsts, '@all');
             }
Ejemplo n.º 3
0
		// Generate list of plugin_instances for selected hosts and plugin
		$arg_hosts = read_var('host', $_POST, array());
		if (!is_array($arg_hosts))
			$arg_hosts = array($arg_hosts);
		$arg_plugin = read_var('plugin', $_POST, '');
		$pinsts = collectd_list_pinsts(reset($arg_hosts), $arg_plugin);
		return dhtml_response_list($pinsts, 'ListOfPluginInstance');

	case 'list_types':
		// Generate list of types for selected hosts, plugin and plugin-instance
		$arg_hosts  = read_var('host', $_POST, array());
		if (!is_array($arg_hosts))
			$arg_hosts = array($arg_hosts);
		$arg_plugin = read_var('plugin', $_POST, '');
		$arg_pinst  = read_var('plugin_instance', $_POST, '');
		$types = collectd_list_types(reset($arg_hosts), $arg_plugin, $arg_pinst);
		return dhtml_response_list($types, 'ListOfType');

	case 'list_tinsts':
		// Generate list of types for selected hosts, plugin and plugin-instance
		$arg_hosts  = read_var('host', $_POST, array());
		if (!is_array($arg_hosts))
			$arg_hosts = array($arg_hosts);
		$arg_plugin = read_var('plugin', $_POST, '');
		$arg_pinst  = read_var('plugin_instance', $_POST, '');
		$arg_type   = read_var('type', $_POST, '');
		$tinsts = collectd_list_tinsts(reset($arg_hosts), $arg_plugin, $arg_pinst, $arg_type);
		if (count($tinsts)) {
			require('definitions.php');
			load_graph_definitions();
			if (isset($MetaGraphDefs[$arg_type])) {
Ejemplo n.º 4
0
$tinst = read_var('type_instance', $_GET, '');
$graph_identifier = $host . '/' . $plugin . (strlen($pinst) ? '-' . $pinst : '') . '/' . $type . (strlen($tinst) ? '-' . $tinst : '-*');
$timespan = read_var('timespan', $_GET, $config['timespan'][0]['name']);
$timespan_ok = false;
foreach ($config['timespan'] as &$ts) {
    if ($ts['name'] == $timespan) {
        $timespan_ok = true;
    }
}
if (!$timespan_ok) {
    return error400($graph_identifier, "Unknown timespan requested");
}
$logscale = (bool) read_var('logarithmic', $_GET, false);
$tinylegend = (bool) read_var('tinylegend', $_GET, false);
// Check that at least 1 RRD exists for the specified request
$all_tinst = collectd_list_types($host, $plugin, $pinst, $type);
if (count($all_tinst) == 0) {
    return error404($graph_identifier, "No rrd file found for graphing");
}
// Now that we are read, do the bulk work
load_graph_definitions($logscale, $tinylegend);
$pinst = strlen($pinst) == 0 ? null : $pinst;
$tinst = strlen($tinst) == 0 ? null : $tinst;
$opts = array();
$opts['timespan'] = $timespan;
if ($logscale) {
    $opts['logarithmic'] = 1;
}
if ($tinylegend) {
    $opts['tinylegend'] = 1;
}
Ejemplo n.º 5
0
    echo $sep;
    if ($_GET['opta'] == $plugin) {
        echo "<strong>";
    }
    echo "<a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/collectd/" . $plugin . "/'>" . htmlspecialchars($plugin) . "</a>\n";
    if ($_GET['opta'] == $plugin) {
        echo "</strong>";
    }
    $sep = ' | ';
}
unset($sep);
print_optionbar_end();
$i = 0;
$pinsts = collectd_list_pinsts($device['hostname'], $_GET['opta']);
foreach ($pinsts as &$instance) {
    $types = collectd_list_types($device['hostname'], $_GET['opta'], $instance);
    foreach ($types as &$type) {
        $typeinstances = collectd_list_tinsts($device['hostname'], $_GET['opta'], $instance, $type);
        if ($MetaGraphDefs[$type]) {
            $typeinstances = array($MetaGraphDefs[$type]);
        }
        foreach ($typeinstances as &$tinst) {
            $i++;
            if (!is_integer($i / 2)) {
                $row_colour = $list_colour_a;
            } else {
                $row_colour = $list_colour_b;
            }
            echo '<div style="background-color: ' . $row_colour . ';">';
            echo '<div class="graphhead" style="padding:4px 0px 0px 8px;">';
            if ($tinst) {