* 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 02150-1301, USA. */ error_reporting(E_ALL | E_NOTICE | E_WARNING); require 'includes/collectd/config.php'; require 'includes/collectd/functions.php'; require 'includes/collectd/definitions.php'; #require('config.php'); #require('functions.php'); #require('definitions.php'); load_graph_definitions(); /** * 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 '<?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)); }
if ($ts['name'] == $timespan) { $timespan_ok = true; } } if (!$timespan_ok) { return error400($graph_identifier, "Unknown timespan requested"); } $logscale = (bool) read_var('logarithmic', $vars, false); $tinylegend = (bool) read_var('tinylegend', $vars, false); // Check that at least 1 RRD exists for the specified request $all_tinst = collectd_list_tinsts($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; } $rrd_cmd = false; if (isset($MetaGraphDefs[$type])) { $identifiers = array(); foreach ($all_tinst as &$atinst) { $identifiers[] = collectd_identifier($host, $plugin, is_null($pinst) ? '' : $pinst, $type, $atinst);