case 'list_plugins': // Generate list of plugins for selected hosts $arg_hosts = read_var('host', $_POST, array()); if (!is_array($arg_hosts)) $arg_hosts = array($arg_hosts); $plugins = collectd_list_plugins(reset($arg_hosts)); return dhtml_response_list($plugins, 'ListOfPlugin'); case 'list_pinsts': // 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());
#$navbar['brand'] = "CollectD"; $navbar['class'] = "navbar-narrow"; 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>';
$_GET['opta'] = $plugin; } 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 . ';">';