Ejemplo n.º 1
0
     if (is_array($arg_hosts)) {
         $arg_hosts = reset($arg_hosts);
     }
     $plugins = collectd_list_plugins($arg_hosts);
     if (count($plugins) > 1) {
         array_unshift($plugins, '@all');
     }
     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, '');
     if (is_array($arg_hosts)) {
         $arg_hosts = reset($arg_hosts);
     }
     $arg_plugin = read_var('plugin', $_POST, '');
     $pinsts = collectd_list_plugins($arg_hosts, $arg_plugin);
     if (count($pinsts) > 1) {
         array_unshift($pinsts, '@all');
     }
     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, '');
     if (is_array($arg_hosts)) {
         $arg_hosts = reset($arg_hosts);
     }
     $arg_plugin = read_var('plugin', $_POST, '');
     $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');
Ejemplo n.º 2
0
 */
function dhtml_response_list(&$items, $method)
{
    header("Content-Type: text/xml");
    print '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
    print "<response>\n";
    printf(" <method>%s</method>\n", htmlspecialchars($method));
    print " <result>\n";
    foreach ($items as &$item) {
        printf('  <option>%s</option>' . "\n", htmlspecialchars($item));
    }
    print " </result>\n";
    print "</response>";
}
$link_array = array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'collectd');
$plugins = collectd_list_plugins($device['hostname']);
#$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;
Ejemplo n.º 3
0
/*
 * Select action based on user input
 */
$action = read_var('action', $_POST, 'overview');
switch ($action) {
	case 'list_hosts':
		// Generate a list of hosts
		$hosts = collectd_list_hosts();
		return dhtml_response_list($hosts, 'ListOfHost');

	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))