Commit 655b36ce64a87b044db97642ad9b0ac715c86f1f
1 parent
c8e05829
Exists in
master
and in
1 other branch
Separando envio de velocidades. Tratando sistemas operacionais dos usuarios
Showing
3 changed files
with
81 additions
and
57 deletions
Show diff stats
rn/MdEstatisticasAgendamentoRN.php
| ... | ... | @@ -32,6 +32,9 @@ class MdEstatisticasAgendamentoRN extends InfraRN { |
| 32 | 32 | |
| 33 | 33 | $acessos = $coletor->obterAcessosUsuarios($data); |
| 34 | 34 | $enviar->enviarAcessos($acessos, $id); |
| 35 | + | |
| 36 | + $velocidades = $coletor->obterVelocidadePorCidade(); | |
| 37 | + $enviar->enviarVelocidades($velocidades, $id); | |
| 35 | 38 | |
| 36 | 39 | LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug(),InfraLog::$INFORMACAO); |
| 37 | 40 | ... | ... |
rn/MdEstatisticasColetarRN.php
| ... | ... | @@ -18,40 +18,41 @@ class MdEstatisticasColetarRN extends InfraRN { |
| 18 | 18 | |
| 19 | 19 | $objConfiguracaoSEI = ConfiguracaoSEI::getInstance(); |
| 20 | 20 | $orgaoSigla = $objConfiguracaoSEI->getValor('MdEstatisticas','sigla', false, ''); |
| 21 | - | |
| 22 | - $indicadores = array( | |
| 23 | - 'dataColeta' => $this->obterDataColeta(), | |
| 24 | - 'orgaoSigla' => $orgaoSigla, | |
| 25 | - 'seiVersao' => $this->obterVersaoSEI(), | |
| 26 | - 'phpVersao' => $this->obterVersaoPHP(), | |
| 27 | - 'memcachedVersao' => $this->obterVersaoMemcached(), | |
| 28 | - 'solrVersao' => $this->obterVersaoSolr(), | |
| 29 | - 'protocolo' => $this->obterProtocolo(), | |
| 30 | - 'quantidadeUnidades' => $this->obterQuantidadeUnidades(), | |
| 31 | - 'quantidadeProcedimentos' => $this->obterQuantidadeProcessosAdministrativos(), | |
| 32 | - 'quantidadeUsuarios' => $this->obterQuantidadeUsuarios(), | |
| 33 | - 'quantidadeDocumentosInternos' => $this->obterQuantidadeDocumentosInternos(), | |
| 34 | - 'quantidadeDocumentosExternos' => $this->obterQuantidadeDocumentosExternos(), | |
| 35 | - 'quantidadeMemoria' => $this->obterUsoMemoria(), | |
| 36 | - 'porcentagemCPU' => $this->obterUsoCPU(), | |
| 37 | - 'estrategiaCessao' => $this->obterEstrategiaCessao(), | |
| 38 | - 'tamanhoDatabase' => $this->obterTamanhoDataBase(), | |
| 39 | - 'tabelasTamanhos' => $this->obterTamanhoTabelas(), | |
| 40 | - 'bancoSei' => $this->obterTipoSGBD(), | |
| 41 | - 'bancoVersao' => $this->obterBancoVersao(), | |
| 42 | - 'servidorAplicacao' => $this->obterServidorAplicacao(), | |
| 43 | - 'sistemaOperacional' => $this->obterSistemaOperacional(), | |
| 44 | - 'sistemaOperacionalDetalhado' => $this->obterSistemaOperacionalDetalhado(), | |
| 45 | - 'navegadores' => $this->obterNavegadores(), | |
| 46 | - 'modulos' => $this->obterPlugins(), | |
| 47 | - 'sistemasOperacionaisUsuarios' => $this->obterSistemasOperacionaisUsuarios(), | |
| 48 | - 'tamanhoFilesystem' => $this->obterTamanhoFileSystem(), | |
| 49 | - 'anexosTamanhos' => $this->obterTamanhoDocumentosExternos(), | |
| 50 | - 'extensoes' => $this->obterQuantidadeDocumentosExternosPorExtensao(), | |
| 51 | - 'velocidades' => $this->obterVelocidadePorCidade() | |
| 52 | - ); | |
| 53 | - | |
| 54 | - return $indicadores; | |
| 21 | + | |
| 22 | + $ind = array(); | |
| 23 | + | |
| 24 | + $ind['dataColeta'] = $this->obterDataColeta(); | |
| 25 | + $ind['orgaoSigla'] = $orgaoSigla; | |
| 26 | + $ind['seiVersao'] = $this->obterVersaoSEI(); | |
| 27 | + $ind['phpVersao'] = $this->obterVersaoPHP(); | |
| 28 | + $ind['memcachedVersao'] = $this->obterVersaoMemcached(); | |
| 29 | + $ind['solrVersao'] = $this->obterVersaoSolr(); | |
| 30 | + $ind['protocolo'] = $this->obterProtocolo(); | |
| 31 | + $ind['quantidadeUnidades'] = $this->obterQuantidadeUnidades(); | |
| 32 | + $ind['quantidadeProcedimentos'] = $this->obterQuantidadeProcessosAdministrativos(); | |
| 33 | + $ind['quantidadeUsuarios'] = $this->obterQuantidadeUsuarios(); | |
| 34 | + $ind['quantidadeDocumentosInternos'] = $this->obterQuantidadeDocumentosInternos(); | |
| 35 | + $ind['quantidadeDocumentosExternos'] = $this->obterQuantidadeDocumentosExternos(); | |
| 36 | + $ind['quantidadeMemoria'] = $this->obterUsoMemoria(); | |
| 37 | + $ind['porcentagemCPU'] = $this->obterUsoCPU(); | |
| 38 | + $ind['estrategiaCessao'] = $this->obterEstrategiaCessao(); | |
| 39 | + $ind['tamanhoDatabase'] = $this->obterTamanhoDataBase(); | |
| 40 | + $ind['bancoSei'] = $this->obterTipoSGBD(); | |
| 41 | + $ind['bancoVersao'] = $this->obterBancoVersao(); | |
| 42 | + $ind['servidorAplicacao'] = $this->obterServidorAplicacao(); | |
| 43 | + $ind['sistemaOperacional'] = $this->obterSistemaOperacional(); | |
| 44 | + $ind['sistemaOperacionalDetalhado'] = $this->obterSistemaOperacionalDetalhado(); | |
| 45 | + $ind['tamanhoFilesystem'] = $this->obterTamanhoFileSystem(); | |
| 46 | + $ind['tabelasTamanhos'] = $this->obterTamanhoTabelas(); | |
| 47 | + $ind['modulos'] = $this->obterPlugins(); | |
| 48 | + $ind['extensoes'] = $this->obterQuantidadeDocumentosExternosPorExtensao(); | |
| 49 | + $ind['anexosTamanhos'] = $this->obterTamanhoDocumentosExternos(); | |
| 50 | + $ind['sistemasOperacionaisUsuarios'] = $this->obterSistemasOperacionaisUsuarios(); | |
| 51 | + $ind['navegadores'] = $this->obterNavegadores(); | |
| 52 | + | |
| 53 | + InfraDebug::getInstance()->gravar('Ind: ' . json_encode($ind), InfraLog::$INFORMACAO); | |
| 54 | + | |
| 55 | + return $ind; | |
| 55 | 56 | |
| 56 | 57 | } catch(Exception $e) { |
| 57 | 58 | InfraDebug::getInstance()->setBolLigado(false); |
| ... | ... | @@ -161,20 +162,11 @@ class MdEstatisticasColetarRN extends InfraRN { |
| 161 | 162 | } |
| 162 | 163 | |
| 163 | 164 | private function obterNavegadores(){ |
| 164 | - $query = "select count(*) as quantidade, identificacao, versao from infra_navegador group by identificacao,versao"; | |
| 165 | + $query = "select count(*) as quantidade, identificacao as nome, versao from infra_navegador group by identificacao,versao"; | |
| 165 | 166 | $rs = BancoSEI::getInstance()->consultarSql($query); |
| 166 | - $lista = array(); | |
| 167 | - foreach($rs as $r) { | |
| 168 | - $result = array( | |
| 169 | - 'quantidade' => (int)$r['quantidade'], | |
| 170 | - 'nome' => $r['identificacao'], | |
| 171 | - 'versao' => $r['versao'] | |
| 172 | - ); | |
| 173 | - array_push($lista, $result); | |
| 174 | - } | |
| 175 | - | |
| 176 | - InfraDebug::getInstance()->gravar('SEI13 - Quantidade de Navegadores: ' . json_encode($lista), InfraLog::$INFORMACAO); | |
| 177 | - return $lista; | |
| 167 | + | |
| 168 | + InfraDebug::getInstance()->gravar('SEI13 - Quantidade de Navegadores: ' . json_encode($rs), InfraLog::$INFORMACAO); | |
| 169 | + return $rs; | |
| 178 | 170 | } |
| 179 | 171 | |
| 180 | 172 | private function obterTipoSGBD(){ |
| ... | ... | @@ -377,8 +369,26 @@ class MdEstatisticasColetarRN extends InfraRN { |
| 377 | 369 | } else { |
| 378 | 370 | $query = "select distinct user_agent as nome from infra_auditoria where user_agent is not null"; |
| 379 | 371 | } |
| 380 | - InfraDebug::getInstance()->gravar('query: ' . json_encode($query), InfraLog::$INFORMACAO); | |
| 381 | 372 | $sistemas = BancoSEI::getInstance()->consultarSql($query); |
| 373 | + | |
| 374 | + $lista = array(); | |
| 375 | + foreach($sistemas as $r) { | |
| 376 | + $texto = $r['nome']; | |
| 377 | + $inicio = strpos($texto, '('); | |
| 378 | + if ($inicio !== false) { | |
| 379 | + $fim = strpos($texto, ')', $inicio); | |
| 380 | + $nome = substr($texto, $inicio + 1, $fim - $inicio -1); | |
| 381 | + array_push($lista, $nome); | |
| 382 | + } | |
| 383 | + } | |
| 384 | + $lista = array_unique($lista); | |
| 385 | + | |
| 386 | + $sistemas = array(); | |
| 387 | + foreach($lista as $n) { | |
| 388 | + $result = array('nome'=>$n); | |
| 389 | + array_push($sistemas, $result); | |
| 390 | + } | |
| 391 | + | |
| 382 | 392 | InfraDebug::getInstance()->gravar('SEI26 - Sistemas Operacionais dos Clientes: ' . json_encode($sistemas), InfraLog::$INFORMACAO); |
| 383 | 393 | return $sistemas; |
| 384 | 394 | } |
| ... | ... | @@ -418,9 +428,9 @@ class MdEstatisticasColetarRN extends InfraRN { |
| 418 | 428 | return $versao; |
| 419 | 429 | } |
| 420 | 430 | |
| 421 | - private function obterVelocidadePorCidade(){ | |
| 431 | + public function obterVelocidadePorCidade(){ | |
| 422 | 432 | $query = " |
| 423 | - select d.nome as nome_cidade, e.nome as nome_uf, avg(velocidade) as media_velocidade | |
| 433 | + select d.nome as cidade, e.nome as uf, avg(velocidade) as velocidade | |
| 424 | 434 | from velocidade_transferencia a |
| 425 | 435 | join unidade b on b.id_unidade = a.id_unidade |
| 426 | 436 | join contato c on b.id_contato = c.id_contato |
| ... | ... | @@ -432,13 +442,13 @@ class MdEstatisticasColetarRN extends InfraRN { |
| 432 | 442 | $rs = BancoSEI::getInstance()->consultarSql($query); |
| 433 | 443 | $lista = array(); |
| 434 | 444 | foreach($rs as $r) { |
| 435 | - $result = array( | |
| 436 | - 'cidade' => utf8_encode($r['nome_cidade']), | |
| 437 | - 'uf' => utf8_encode($r['nome_uf']), | |
| 438 | - 'velocidade' => $r['media_velocidade'] | |
| 439 | - ); | |
| 440 | - | |
| 441 | - array_push($lista, $result); | |
| 445 | + $result = array( | |
| 446 | + 'cidade' => utf8_encode($r['cidade']), | |
| 447 | + 'uf' => utf8_encode($r['uf']), | |
| 448 | + 'velocidade' => $r['velocidade'] | |
| 449 | + ); | |
| 450 | + | |
| 451 | + array_push($lista, $result); | |
| 442 | 452 | } |
| 443 | 453 | InfraDebug::getInstance()->gravar('SEI14 - Quantidade de bytes de transferência: ' . json_encode($lista), InfraLog::$INFORMACAO); |
| 444 | 454 | return $lista; | ... | ... |
rn/MdEstatisticasEnviarRN.php
| ... | ... | @@ -35,6 +35,17 @@ class MdEstatisticasEnviarRN extends InfraRN { |
| 35 | 35 | InfraDebug::getInstance()->gravar('URL: ' . json_encode($obj), InfraLog::$INFORMACAO); |
| 36 | 36 | return $this->doPost($url, $obj, false); |
| 37 | 37 | } |
| 38 | + | |
| 39 | + public function enviarVelocidades($velocidades, $id) { | |
| 40 | + $url = $this->url . '/velocidades'; | |
| 41 | + InfraDebug::getInstance()->gravar('URL: ' . $url, InfraLog::$INFORMACAO); | |
| 42 | + $obj = array( | |
| 43 | + id => $id, | |
| 44 | + velocidades => $velocidades | |
| 45 | + ); | |
| 46 | + InfraDebug::getInstance()->gravar('URL: ' . json_encode($obj), InfraLog::$INFORMACAO); | |
| 47 | + return $this->doPost($url, $obj, false); | |
| 48 | + } | |
| 38 | 49 | |
| 39 | 50 | private function doPost($url, $json, $isjson=true) { |
| 40 | 51 | $data = json_encode($json); | ... | ... |