?> <div class='sidetip_nopos'> <?php echo LangUtil::$pageTerms['TIPS_NODISCRETE']; ?> </div> <?php include "includes/footer.php"; return; } } echo LangUtil::$generalTerms['TEST_TYPE'] . ": " . $testName . "<br>"; echo "<div id='stat_table'>"; $page_elems->getInfectionStatsTableAggregate($stat_list, $lab_config_id, $multipleIndividualLabs); echo "</div>"; createGraph(); createTrends(); } } function createGraph() { global $stat_list; echo "<div id='stat_graph_bar'>"; # To avoid cluttered graph, divide stat_list into chunks $chunk_size = 999; $stat_chunks = array_chunk($stat_list, $chunk_size, true); $i = 1; foreach ($stat_chunks as $stat_chunk) { $div_id = "placeholder_" . $i; $legend_id = "legend_" . $i; $ylabel_id = "ylabel_" . $i;
$model = $graph->getModel(); $parent = $graph->getDefaultParent(); $model->beginUpdate(); $v1 = $graph->insertVertex($parent, null, "Hello", 20, 20, 80, 30); $v2 = $graph->insertVertex($parent, null, "World", 200, 150, 80, 30); $graph->insertEdge($parent, null, "", $v1, $v2); $model->endUpdate(); $enc = new mxCodec(); $xmlNode = $enc->encode($model); return str_replace("\n", "
", $xmlNode->ownerDocument->saveXML($xmlNode)); } /** * Handles save request and prints XML. */ if (isset($_POST["xml"])) { $id = $_GET["id"]; $xml = str_replace("\n", "
", stripslashes($_POST["xml"])); error_log("Received id=" . $id . " xml=" . $xml); } else { if (isset($_GET["id"])) { header("Content-Type: text/xml;charset=UTF-8"); header("Pragma: no-cache"); // HTTP 1.0 header("Cache-Control: private, no-cache, no-store"); header("Expires: 0"); echo createGraph(); } else { // Redirects to frontend.html header('Location: frontend.html'); } }
// From 1.8.1 zabbix does not accept special char in key, :( so we must replace them with underscore $newkey = preg_replace('/[^0-9a-zA-Z_\\.]/', '_', $oid[0]); $item = array('name' => $oid[1], 'key_' => $newkey, 'hostid' => $templateid, 'delay' => $delay, 'history' => $history, 'status' => ITEM_STATUS_ACTIVE, 'type' => $snmp_version, 'snmp_community' => $community, 'snmp_oid' => $oid_num, 'value_type' => $value_type, 'trapper_hosts' => null, 'snmp_port' => $server_port, 'units' => $units, 'multiplier' => $multiplier, 'delta' => $delta, 'snmpv3_securityname' => null, 'snmpv3_securitylevel' => null, 'snmpv3_authpassphrase' => null, 'snmpv3_privpassphrase' => null, 'formula' => $formula, 'trends' => $trends, 'logtimefmt' => null, 'valuemapid' => null, 'delay_flex' => null, 'authtype' => null, 'username' => null, 'password' => null, 'publickey' => null, 'privatekey' => null, 'params' => null, 'ipmi_sensor' => null, 'data_type' => $data_type); array_push($items, $item); } DBstart(); $result = API::Item()->create($items); show_messages($result, _('Item added'), _('Cannot add item')); $result = DBend($result); $itemids = array(); if ($result) { $itemids = $result['itemids']; } // Create graphs if ($graph_create) { createGraph($itemids, $graph_name, $graph_width, $graph_height, $graph_type, $graph_func, $draw_type, $yaxisside); } } else { // Build widget //Header $form = new CForm(); $form->cleanItems(); $form->setMethod('post'); if (isset($_REQUEST['form'])) { // MIB file import $import_wdgt = new CWidget(); $import_wdgt->addPageHeader(_('SNMP Builder'), $form); $data = array(); $data['form'] = get_request('form'); $data['widget'] = $import_wdgt; $importForm = new CView('administration.snmp_builder', $data);
function checkGraph($xmlfile, $graphfile) { if (!file_exists($graphfile)) { createGraph($xmlfile, $graphfile); } else { if (filemtime($xmlfile) >= filemtime($graphfile)) { createGraph($xmlfile, $graphfile); } } }
case 'function_graph': $dataFile = get('dataFile'); $showFraction = 100 - intval(get('showFraction') * 100); if ($dataFile == '0') { $files = Webgrind_FileHandler::getInstance()->getTraceList(1); $dataFile = $files[0]['filename']; } if (!is_executable(Webgrind::$config->pythonExecutable)) { die("can't find python interpreter"); } if (!is_executable(Webgrind::$config->dotExecutable)) { die("can't find drawing tool"); } $filename = Webgrind::$config->storageDir . '/' . $dataFile . '-' . $showFraction . Webgrind::$config->preprocessedSuffix . '.png'; if (!file_exists($filename)) { if (!createGraph(Webgrind::$config->xdebugOutputDir . '/' . $dataFile, $filename, $showFraction)) { die("can't generate graph"); } } header("Content-Type: image/png"); readfile($filename); break; default: $welcome = ''; $storageDir = Webgrind::$config->storageDir; $xdebugOutputDir = Webgrind::$config->xdebugOutputDir; if (!file_exists($storageDir) || !is_writable($storageDir)) { $welcome .= "Webgrind storageDir {$storageDir} does not exist or is not writeable.<br>"; } if (!file_exists($xdebugOutputDir) || !is_readable($xdebugOutputDir)) { $welcome .= "Webgrind profilerDir {$xdebugOutputDir} does not exist or is not readable.<br>";