preparaQuery("INSERT INTO zbxe_preferences (userid, tx_option, tx_value, st_ativo) VALUES('0', 'menu_09_geo', 'zbxe-geolocation|Geolocation', '1')"); } else { // Modo de upgrade somente ----------------------------------------------------- echo "<br>Banco ja inicializado! Serao inseridas apenas linhas complementares...<br>"; } // Verificando se e uma estrutura com NODES $node = intval(valorCampo('select count(*) as total from nodes', 'total')); //var_dump($node); if ($node > 0) { echo "Sem suporte a node para a importação de imagens em node ainda..."; } else { $query = "select nextid+1 as nextid from ids " . "where table_name = 'images' and field_name = 'imageid' and nodeid = {$node}"; $idAtual = intval(valorCampo($query, 'nextid')); if ($idAtual == 0) { $query = "select max(imageid)+1 as nextid from images "; $idAtual = intval(valorCampo($query, 'nextid')); } if (valorCampo("select imageid from images where name = 'zbxe_logo'", 'imageid') == 0) { echo "Inserindo logotipo personalizado [{$idAtual}]...<br>"; // Logotipo personalizado do ZE + Zabbix Brasil $query = "INSERT INTO images (imageid, imagetype, name, image) " . "VALUES ({$idAtual}, 1, 'zbxe_logo', " . ($DB['TYPE'] == ZBX_DB_POSTGRESQL ? $logo_zbxe_post : "0x" . $logo_zbxe) . ");"; preparaQuery($query); $query = "update ids set nextid = {$idAtual} where table_name = 'images' " . "and field_name = 'imageid' and nodeid = {$node};"; preparaQuery($query); } else { echo "Atualizando logotipo personalizado...<br>"; $query = "update images set image = " . ($DB['TYPE'] == ZBX_DB_POSTGRESQL ? $logo_zbxe_post : "0x" . $logo_zbxe) . " where name = 'zbxe_logo';"; preparaQuery($query); } } echo "Pronto !!!";
debugInfo($p_query, $_REQUEST['p_debug'] == 'S'); $result = mysql_query($p_query); if (!$result) { die("Invalid query: " . mysql_error()); return 0; } else { return $result; } } function arraySelect($p_query) { $result = preparaQuery($p_query); $retorno = array(); $cont = 0; while ($row = @mysql_fetch_assoc($result)) { $retorno[$cont] = $row; $cont++; } return $retorno; } conectaBD(); if ($_REQUEST['p_acao'] == "LLD") { $dados = arraySelect('show tables'); foreach ($dados as $linha) { $json[count($json)]['{#NOME}'] = $linha['Tables_in_zabbix']; } echo json_encode(array('data' => $json)); } if ($_REQUEST['p_acao'] == "count") { echo valorCampo('select count(*) as id from ' . $_REQUEST['p_tabela'], 'id'); }
$filter_table = new CTable('', 'filter_config'); $filter_table->setAttribute('border', 0); $filter_table->setAttribute('width', '100%'); // Idenfifica se o padrão foi informado para pesquisar ========================================== $completo = $keyStandard !== ''; /*----------- Implementa o Filtro ---------------*/ $filter_table->addItem(new CDiv(_('Wizard'), 'thin_header')); // Search standard $filter_table->addRow(array(array(bold(_('Group')), ': ', $cmbGroups), array(bold(_('Host')), ': ', $cmbHosts), exibeConteudo($hostid > 0, array(bold(_('Application')), ': ', $cmbApplications)), exibeConteudo($applicationid > 0, array(bold(_('Item')), ': ', $cmbItems)), array())); $filter_table2 = new CTable('', 'filter_config'); // Place to run the search $filter_table2->setAttribute('border', 0); $filter_table2->setAttribute('width', '100%'); $filter_table2->addItem(new CDiv(_('Search definition'), 'thin_header')); if ($itemid > 0 and $keyStandard == "") { $keyStandard = valorCampo('select key_ as id from items where itemid = ' . $itemid, 'id'); } $filter_table2->addRow(array(array(bold(_zeT('Search group')), ': ', $cmbGroupSearch), array(bold(_zeT('Item key')), ' (' . _('like') . '): ', new CTextBox('keyStandard', $keyStandard, 60)), array(bold(_zeT('Sort Order')), ': ', $cmbOrdem), array())); $filter_form = new CForm(); $filter_form->setMethod('get'); $filter_form->setAttribute('name', 'zbx_filter'); $filter_form->setAttribute('id', 'zbx_filter'); $reset = new CButton('reset', _('Reset')); $reset->onClick("javascript: clearAllForm('zbx_filter');"); $grafico = new CButton('grafico', _zeT('Chart')); // Habilita o botão de geração de gráfico quando tem host e item selecionado ============================================= if ($hostid < 1 and $itemid < 1) { $grafico->setAttribute('disabled', ''); } $grafico->onClick("javascript: fnGrafico();"); $filter = new CButton('filter', _zeT("Update Filter"));
$result = DBselect($query); $cmbItems->additem("0", ""); $descItem = ""; while ($row_extra = DBfetch($result)) { $descricao = $row_extra['name']; if (strpos($descricao, "\$") !== false) { $tmp = explode("[", $row_extra['key_']); $tmp = explode(",", str_replace("]", "", $tmp[1])); for ($i = 0; $i < count($tmp); $i++) { $descricao = str_replace("\$" . ($i + 1), $tmp[$i], $descricao); } } $descItem = $row_extra['id'] == $itemid ? $descricao : $descItem; $cmbItems->additem($row_extra['id'], $descricao); } $tituloGrafico = valorCampo('select name as id from hosts where hostid = ' . $hostid, 'id') . " - " . $descItem; // FIM Combos de filtro ========================================================= $hostprof_wdgt->addHeader($titulo, array()); $filter_table = new CTable('', 'filter_config'); $filter_table->setAttribute('border', 0); $filter_table->setAttribute('width', '100%'); $cmbTimeSource = new CComboBox('timeshiftsource', $timeShiftSource, 'javascript: submit();'); $cmbTimeProjection = new CComboBox('timeshiftprojection', $timeShiftProjection, 'javascript: submit();'); $completo = get_request('itemid', 0) > 0; $cmbAgregation = new CComboBox('agregation', get_request('agregation', 0), 'javascript: submit();'); if ($completo) { $intervalDesc = array('', _zeT('Day'), _zeT('Week'), _zeT('Month'), _zeT('Year')); $intervalFactor = array(0, 1, 7, 30, 365); $intervalFactor2 = array(0, '+1 days', '+1 week', '+1 months', '+1 years'); $sourceAgregator = array('hu.value_max', 'hu.value_min', 'hu.value_avg'); // $sourceAgregator = array ('AVG(hu.value_max)','AVG(hu.value_min)','AVG(hu.value_avg)');
function zbxeConfigValue($param, $id = 0) { $query = 'select tx_value from zbxe_preferences where userid = ' . $id . " and tx_option = " . quotestr($param); //var_dump("<br>[$query]<br>"); $retorno = valorCampo($query, 'tx_value'); return $retorno; }