<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; require_once 'Reconnoiter_amLine_Driver.php'; require_once 'Reconnoiter_DB.php'; global $graph_settings; require_once 'graph_settings.inc'; $start = $_GET['start'] ? $_GET['start'] : 7 * 86400; if (preg_match('/^\\d+$/', $start)) { $start = strftime("%Y-%m-%d %H:%M:%S", time() - $start); } $end = $_GET['end'] ? $_GET['end'] : strftime("%Y-%m-%d %H:%M:%S", time()); $cnt = $_GET['cnt'] ? $_GET['cnt'] : 100; $driver = new Reconnoiter_amLine_Driver($start, $end, $cnt); $db = Reconnoiter_DB::GetDB(); $row = $db->getGraphByID($_GET['id']); $graph = json_decode($row['json'], true); $i = 0; $autounits = 0; foreach ($graph['datapoints'] as $d) { $settings = $graph_settings[$i++]; if ($d['hidden'] == "true") { $settings['hidden'] = "true"; } if ($d['math1']) { $settings['expression'] = $d['math1']; } $settings['axis'] = $d['axis'] == 'l' ? 'left' : 'right'; $settings['title'] = $d['name']; if ($d['metric_type'] == 'numeric') { $driver->addDataSet($d['sid'], $d['metric_name'], $d['derive'] == "true" ? "true" : "false", $d['math2'], $settings);
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; require_once 'Reconnoiter_amLine_Driver.php'; $uuid = $_GET['id']; //'cfe2aad7-71e5-400b-8418-a6d5834a0386'; $math = '$this->bw($value)'; $start = $_GET['start']; if (!$start) { $start = strftime("%Y-%m-%d %H:%M:%S", time() - 7 * 86400); } $end = $_GET['end']; if (!$end) { $end = strftime("%Y-%m-%d %H:%M:%S", time()); } $driver = new Reconnoiter_amLine_Driver($start, $end, isset($_GET['cnt']) ? $_GET['cnt'] : 400); $driver->addDataSet($uuid, 'inoctets', true, '$value * 8', array('expression' => "0 - {$math}")); $driver->addDataSet($uuid, 'outoctets', true, '$value * 8', array('expression' => "{$math}")); $driver->addChangeSet($uuid, 'alias'); #$driver->calcPercentile(95); #$driver->addPercentileGuide('min', 0, array('expression' => "$math")); #$driver->addPercentileGuide('95th', 95, array('expression' => "$math")); #$driver->addPercentileGuide('max', 100, array('expression' => "$math")); $i = 0; ?> <settings> <data> <chart> <?php $driver->seriesXML(); ?>