* * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; only version 2 of the License is applicable. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ error_reporting(E_ALL | E_NOTICE | E_WARNING); require('config.php'); require('functions.php'); /** * Send back new list content * @items Array of options values to return to browser * @method Name of Javascript method that will be called to process data */ function dhtml_response_list(&$items, $method) { header("Content-Type: text/xml"); print(''."\n"); print("\n"); printf(" %s\n", htmlspecialchars($method)); print(" \n"); foreach ($items as &$item) printf(' '."\n", htmlspecialchars($item)); print(" \n"); print(""); } function dhtml_response_graphs(&$graphs, $method) { header("Content-Type: text/xml"); print(''."\n"); print("\n"); printf(" %s\n", htmlspecialchars($method)); print(" \n"); foreach ($graphs as &$graph) printf(' '."\n", htmlspecialchars($graph['host']), htmlspecialchars($graph['plugin']), htmlspecialchars($graph['pinst']), htmlspecialchars($graph['type']), htmlspecialchars($graph['tinst']), htmlspecialchars($graph['timespan']), htmlspecialchars($graph['logarithmic']), htmlspecialchars($graph['tinyLegend'])); print(" \n"); print(""); } /** * Product page body with selection fields */ function build_page() { global $config; if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/compatible; MSIE [0-9]+.[0-9];/', $_SERVER['HTTP_USER_AGENT'])) { // Internet Explorer does not support XHTML header("Content-Type: text/html"); print(''); print(''."\n"); } else { header("Content-Type: application/xhtml+xml"); print(''."\n"); print(''."\n"); print(''."\n"); } $url_base = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/'; ?> Collectd graph viewer

Collectd browser for system statistics graphs

Hide graph selection tool
Host: R
Plugin: R
Plugin instance: R
Type: R
Type instance: R
Graph settings:

Graph list favorites: S
LD
Please use above graph selection tool to add graphs to this area.Config error: $config["datadirs"] is not set

'; else if (!is_array($config['datadirs'])) echo '

Config error: $config["datadirs"] is not an array

'; else if (count($config['datadirs']) == 0) echo '

Config error: $config["datadirs"] is empty

'; else foreach ($config['datadirs'] as $datadir) if (!is_dir($datadir)) echo '

Config error: $config["datadirs"], '.htmlspecialchars($datadir).' does not exist

'; if (!isset($config['rrd_width'])) echo '

Config error: $config["rrd_width"] is not set

'; else if (10 > (int)$config['rrd_width']) echo '

Config error: $config["rrd_width"] is invalid. Integer >= 10 expected

'; if (!isset($config['rrd_height'])) echo '

Config error: $config["rrd_height"] is not set

'; else if (10 > (int)$config['rrd_height']) echo '

Config error: $config["rrd_height"] is invalid. Integer >= 10 expected

'; if (!isset($config['rrd_opts'])) echo '

Config error: $config["rrd_opts"] is not set

'; else if (!is_array($config['rrd_opts'])) echo '

Config error: $config["rrd_opts"] is not an array

'; if (!isset($config['timespan'])) echo '

Config error: $config["timespan"] is not set

'; else if (!is_array($config['timespan'])) echo '

Config error: $config["timespan"] is not an array

'; else if (count($config['timespan']) == 0) echo '

Config error: $config["timespan"] is empty

'; else foreach ($config['timespan'] as &$timespan) if (!is_array($timespan) || !isset($timespan['name']) || !isset($timespan['label']) || !isset($timespan['seconds']) || 10 > (int)$timespan['seconds']) echo '

Config error: $config["timespan"], invalid entry found

'; if (!is_null($config['collectd_sock']) && strncmp('unix://', $config['collectd_sock'], 7) != 0) echo '

Config error: $config["collectd_sock"] is not valid

'; if (!defined('RRDTOOL')) echo '

Config error: RRDTOOL is not defined

'; else if (!is_executable(RRDTOOL)) echo '

Config error: RRDTOOL ('.htmlspecialchars(RRDTOOL).') is not executable

'; ?>
1) array_unshift($hosts, '@all'); return dhtml_response_list($hosts, 'ListOfHost'); case 'list_plugins': // Generate list of plugins for selected hosts $arg_hosts = read_var('host', $_POST, ''); 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' /* , '@merge_sum', '@merge_avg', '@merge_stack', '@merge_line' */); 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'); 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_sum', '@merge_avg', '@merge_stack', '@merge_line', */ '@merge'); if (count($tinsts) > 1) array_unshift($tinsts, '@all'); } return dhtml_response_list($tinsts, 'ListOfTypeInstance'); case 'list_graphs': // 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, ''); $arg_tinst = read_var('type_instance', $_POST, ''); $arg_log = (int)read_var('logarithmic', $_POST, '0'); $arg_legend = (int)read_var('tinyLegend', $_POST, '0'); $arg_period = read_var('timespan', $_POST, ''); $graphs = collectd_list_graphs($arg_hosts, $arg_plugin, $arg_pinst, $arg_type, $arg_tinst); foreach ($graphs as &$graph) { $graph['logarithmic'] = $arg_log; $graph['tinyLegend'] = $arg_legend; $graph['timespan'] = $arg_period; } return dhtml_response_graphs($graphs, 'ListOfGraph'); case 'overview': default: return build_page(); break; } ?>