├── .gitignore ├── 0001-13-11-2013.patch ├── LEIAME.txt ├── LEIAME.txt~ ├── README.md ├── README.md~ ├── README.txt ├── class ├── Conexao.class.php └── Grupos.class.php ├── css ├── geral.css └── grupo.css ├── geolocation.conf ├── grupo.php ├── images ├── camera.png ├── carregando.gif ├── off.png └── on.png ├── includes └── autoload.php ├── index.php ├── index.php~ ├── js ├── jquery-1.7.2.js ├── markerwithlabel.js ├── markerwithlabel_packed.js └── oms.min.js ├── kmz └── latinoware.kmz ├── layers.conf ├── misc └── geolocation.php └── zabbix-geolocation └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | LEIAME.txt 2 | -------------------------------------------------------------------------------- /0001-13-11-2013.patch: -------------------------------------------------------------------------------- 1 | From 023242556de3b7b3e263b133708e3ef7c9e0f0e7 Mon Sep 17 00:00:00 2001 2 | From: aristotelesaraujo 3 | Date: Wed, 13 Nov 2013 22:47:31 -0300 4 | Subject: [PATCH] 13/11/2013 5 | 6 | --- 7 | README.md | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/README.md b/README.md 11 | index a96ef11..73b6df3 100644 12 | --- a/README.md 13 | +++ b/README.md 14 | @@ -169,3 +169,4 @@ aristoteles.araujo @ gmail.com 15 | 16 | Translation: 17 | André Déo - Zabbix-Brasil 18 | +13/11/2013 19 | -- 20 | 1.7.9.5 21 | 22 | -------------------------------------------------------------------------------- /LEIAME.txt: -------------------------------------------------------------------------------- 1 | Atualizações: 2 | 3 | Geolocalização não possuia controle de usuários, assim um usuário com poucos privilégios poderia acessar todos os grupos que estão cadastrados. Foram criadas novas caracteristícas que permite este controle. 4 | 5 | Autor da atualização: Leonardo D. Lauermann 6 | 7 | Nota: Leonardo a comunidade Zabbix agradeçe a sua colaboração. Viva o software livre!!!! \o/\o/\o/\o/\o/\o/ 8 | 9 | Geolocalização vrs0.3.3 (versão Tremembé) 10 | Os tremembés eram originalmente nômades que viviam num território que estendia-se 11 | do sul do Maranhão até o Rio Acaraú, no atual estado do Ceará 12 | fonte: pt.wikipedia.org 13 | 14 | Novas características: 15 | * Mapa com meteorologia 16 | * Suporte a host com DNS 17 | * Correção de bug para uso no menu do Zabbix 2.0 18 | * Repositório oficial agora no GitHub: https://github.com/aristotelesaraujo/zabbix-geolocation 19 | 20 | No arquivo geolocation.conf foi incluída a chave weather=[yes|no], 21 | para ativar ou desativar a exibição de meteorologia. 22 | 23 | 24 | 25 | Geolocalização vrs0.3.3 (versão Kanindé) 26 | Grande tribo de Tarairius, que vivia na região central do Ceará pelo sertões de 27 | Quixadá, Canindé e Alto Banabuiú (Quixeramobim) - Setembro de 2013 28 | fonte: pt.wikipedia.org 29 | 30 | Novas características: 31 | * Permite inclusão de camadas com arquivo .KMZ 32 | * Implementação de Overlapping Marker Spiderfier, para expandir hosts sobrepostos 33 | 34 | Info: Alteração no modo de fazer zoom: 35 | Zoom in -> duplo clique botão esquerdo 36 | Zoom out -> duplo clique botão direito 37 | 38 | 39 | 40 | Geolocalização vrs0.3.2 (versão Kariri) 41 | Dia Internacional dos Povos Indígenas - Agosto de 2013 42 | Download Tarball vrs0.3.2 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.2.tar.gz 43 | 44 | Nova característica: 45 | * suporte ao PostgreSQL 46 | 47 | 48 | 49 | 50 | 51 | Geolocalização vrs 0.3.1 (versão Sapucaí) 52 | Carnaval - Fevereiro de 2013 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.tar.gz 53 | Download Tarball vrs0.3.1 54 | 55 | Contatos: 56 | Leandro Alves Machado - leandro.machado@sspds.ce.gov.br 57 | Aristóteles Araújo - aristoteles.araujo@sspds.ce.gov.br 58 | 59 | 60 | Vantagens do uso do plugin: 61 | 62 | a. Reduz o tempo de criação de uma mapa, pois não é necessário colocar uma imagem de fundo e adicionar/configurar todos os hosts. 63 | b. A imagem é dinâmica, permitindo zoom e demais recursos do Google Maps 64 | c. Seleciona o host no combobox e faz zoom do local do host 65 | 66 | 67 | 1. INSTALAÇÃO NA GUIA MONITORAMENTO 68 | 69 | 1.1 Crie o diretório extras e descompacte o tarball na pasta zabbix: 70 | 71 | # cd /var/www/html/zabbix 72 | # mkdir extras 73 | # cd extras 74 | # cp //zabbix-geolocalizacao-v0.3.2.tar.gz . 75 | # tar zxvf zabbix-geolocalizacao-v0.3.2.tar.gz 76 | # cp /geolocation/misc/geolocation.php /var/www/html/zabbix 77 | 78 | Defina as permissões do diretório com o mesmo usuário/grupo do zabbix,por exemplo: 79 | 80 | #cd .. 81 | #chown -R apache.apache extras 82 | 83 | 84 | 1.2 Criando item no menu: 85 | 86 | Editar o arquivo ../zabbix/include/menu.inc.php 87 | 88 | # vi ../include/menu.inc.php 89 | 90 | Localize a linha: 'label' => _('IT services'), contida no trecho de 91 | código abaixo, no menu Monitoring: 92 | 93 | array( 94 | 'url' => 'srv_status.php', 95 | 'label' => _('IT services'), 96 | 'force_disable_all_nodes' => true, 97 | 'sub_pages' => array('report3.php', 'chart5.php') 98 | ), 99 | 100 | Após o trecho acima inclua o código abaixo: 101 | 102 | array( 103 | 'url' => 'geolocation.php', 104 | 'label' => _('Geolocalização') 105 | ), 106 | 107 | Salve o arquivo. 108 | 109 | Esta alteração cria o link Geolocalização no menu de Monitoramento. 110 | Clique em Monitoramento -> Geolocalização para ter acesso a interface. 111 | 112 | Na interface tem duas ComboBox, na primeira estão os Grupos de Hosts e 113 | na segunda a Lista de Hosts pertencentes ao grupo selecionado. 114 | Os itens em vermelho, são os hosts que apresentam algum incidente. 115 | 116 | 1.2 Configurar php.ini: 117 | 118 | Edite o arquivo php.ini, normalmente em /etc/php.ini, e descomente a opção short_open_tag deixando a flag como On 119 | 120 | #vi /etc/php.ini 121 | 122 | short_open_tag=On 123 | Salve o arquivo e reinicie o apache 124 | 125 | 126 | 1.3 Definindo Grupo Padrão: 127 | 128 | Para definir o Grupo de Hosts padrão, altere a linha group 129 | no arquivo ../zabbix/extras/geolocation/geolocation.conf 130 | informando o id do Grupo desejado. 131 | 132 | group=1 133 | 134 | Uma forma de saber qual o id do Grupo é abrir a interface de 135 | Geolocalização e olhar o número na frente do grupo desejado. 136 | 137 | 138 | 139 | 2. INSTALAÇÃO NA GUIA DE TELAS, VIA URL 140 | 141 | Clique em Configurações -> Telas -> Criar Tela 142 | 143 | Nome: Geolocalização 144 | 145 | Clique em Salvar. 146 | 147 | Agora clique em Geolocalização, na lista de telas. 148 | 149 | Clique em Alterar para incluir a URL de geolocalização: 150 | 151 | Recurso: url 152 | Url: http://IP-ou-Hostname-Zabbix/zabbix/extras/geolocation/index.php 153 | Largura: 1028 154 | Altura: 760 155 | Alinhamento horizontal: Centralizar 156 | Alinhamento vertical: Centro 157 | 158 | Clique em Salvar. 159 | 160 | Clique em Monitoramento -> Telas 161 | Na combobox Telas, selecione: Geolocalização para acessar a interface. 162 | 163 | 164 | 165 | 3. CADASTRAR/ALTERAR HOSTS PARA GEOLOCALIZAÇÃO 166 | 167 | Para que os host sejam exibidos no Mapa de Geolocalização é necessário 168 | informar a latitude e a longitude dos mesmos. 169 | Para isso clique em Configurações -> Hosts e selecione o host que deseja 170 | monitorar, entre na aba Inventário do host. 171 | Clique em Manual, preencha longitude e latitude e clique em Salvar. 172 | Agora repita o processo para todos os demais hosts e retorne ao menu 173 | de Geolocalização. 174 | 175 | 4. DEPENDÊNCIAS 176 | 177 | 4.1 fping 178 | O fping deve estar instalado 179 | 180 | Dica do Daniel Schaeffer: 181 | Como instalar o fping para quem usa CentOS ou RedHat: 182 | http://www.tecmint.com/install-fping-icmp-program-on-rhel-centos-6-5-4/ 183 | 184 | 185 | 4.2 MySQL ou PostgreSQL 186 | A versão atual funciona com MySQL ou PostgreSQL 187 | 188 | 189 | 190 | Bom trabalho a todos. 191 | 192 | 8^) 193 | 194 | Aristóteles Rêgo de Araújo 195 | aristoteles.araujo@sspds.ce.gov.br 196 | aristoteles.araujo@gmail.com 197 | 198 | 199 | -------------------------------------------------------------------------------- /LEIAME.txt~: -------------------------------------------------------------------------------- 1 | Geolocalização vrs0.3.3 (versão Kanindé) 2 | Grande tribo de Tarairius, que vivia na região central do Ceará pelo sertões de Quixadá, Canindé e Alto Banabuiú (Quixeramobim) - Setembro de 2013 3 | fonte: pt.wikipedia.org 4 | 5 | Novas características: 6 | * Permite inclusão de camadas com arquivo .KMZ 7 | * Implementação de Overlapping Marker Spiderfier, para expandir hosts sobrepostos 8 | 9 | Info: Alteração no modo de fazer zoom: 10 | Zoom in -> duplo clique botão esquerdo 11 | Zoom out -> duplo clique botão direito 12 | 13 | 14 | 15 | Geolocalização vrs0.3.2 (versão Kariri) 16 | Dia Internacional dos Povos Indígenas - Agosto de 2013 17 | Download Tarball vrs0.3.2 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.2.tar.gz 18 | 19 | Nova característica: 20 | * suporte ao PostgreSQL 21 | 22 | 23 | 24 | 25 | 26 | Geolocalização vrs 0.3.1 (versão Sapucaí) 27 | Carnaval - Fevereiro de 2013 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.tar.gz 28 | Download Tarball vrs0.3.1 29 | 30 | Contatos: 31 | Leandro Alves Machado - leandro.machado@sspds.ce.gov.br 32 | Aristóteles Araújo - aristoteles.araujo@sspds.ce.gov.br 33 | 34 | 35 | Vantagens do uso do plugin: 36 | 37 | a. Reduz o tempo de criação de uma mapa, pois não é necessário colocar uma imagem de fundo e adicionar/configurar todos os hosts. 38 | b. A imagem é dinâmica, permitindo zoom e demais recursos do Google Maps 39 | c. Seleciona o host no combobox e faz zoom do local do host 40 | 41 | 42 | 1. INSTALAÇÃO NA GUIA MONITORAMENTO 43 | 44 | 1.1 Crie o diretório extras e descompacte o tarball na pasta zabbix: 45 | 46 | # cd /var/www/html/zabbix 47 | # mkdir extras 48 | # cd extras 49 | # cp //zabbix-geolocalizacao-v0.3.2.tar.gz . 50 | # tar zxvf zabbix-geolocalizacao-v0.3.2.tar.gz 51 | # cp /geolocation/misc/geolocation.php /var/www/html/zabbix 52 | 53 | Defina as permissões do diretório com o mesmo usuário/grupo do zabbix,por exemplo: 54 | 55 | #cd .. 56 | #chown -R apache.apache extras 57 | 58 | 59 | 1.2 Criando item no menu: 60 | 61 | Editar o arquivo ../zabbix/include/menu.inc.php 62 | 63 | # vi ../include/menu.inc.php 64 | 65 | Localize a linha: 'label' => _('IT services'), contida no trecho de 66 | código abaixo, no menu Monitoring: 67 | 68 | array( 69 | 'url' => 'srv_status.php', 70 | 'label' => _('IT services'), 71 | 'force_disable_all_nodes' => true, 72 | 'sub_pages' => array('report3.php', 'chart5.php') 73 | ), 74 | 75 | Após o trecho acima inclua o código abaixo: 76 | 77 | array( 78 | 'url' => 'geolocation.php', 79 | 'label' => _('Geolocalização') 80 | ), 81 | 82 | Salve o arquivo. 83 | 84 | Esta alteração cria o link Geolocalização no menu de Monitoramento. 85 | Clique em Monitoramento -> Geolocalização para ter acesso a interface. 86 | 87 | Na interface tem duas ComboBox, na primeira estão os Grupos de Hosts e 88 | na segunda a Lista de Hosts pertencentes ao grupo selecionado. 89 | Os itens em vermelho, são os hosts que apresentam algum incidente. 90 | 91 | 1.2 Configurar php.ini: 92 | 93 | Edite o arquivo php.ini, normalmente em /etc/php.ini, e descomente a opção short_open_tag deixando a flag como On 94 | 95 | #vi /etc/php.ini 96 | 97 | short_open_tag=On 98 | Salve o arquivo e reinicie o apache 99 | 100 | 101 | 1.3 Definindo Grupo Padrão: 102 | 103 | Para definir o Grupo de Hosts padrão, altere a linha group 104 | no arquivo ../zabbix/extras/geolocation/geolocation.conf 105 | informando o id do Grupo desejado. 106 | 107 | group=1 108 | 109 | Uma forma de saber qual o id do Grupo é abrir a interface de 110 | Geolocalização e olhar o número na frente do grupo desejado. 111 | 112 | 113 | 114 | 2. INSTALAÇÃO NA GUIA DE TELAS, VIA URL 115 | 116 | Clique em Configurações -> Telas -> Criar Tela 117 | 118 | Nome: Geolocalização 119 | 120 | Clique em Salvar. 121 | 122 | Agora clique em Geolocalização, na lista de telas. 123 | 124 | Clique em Alterar para incluir a URL de geolocalização: 125 | 126 | Recurso: url 127 | Url: http://IP-ou-Hostname-Zabbix/zabbix/extras/geolocation/index.php 128 | Largura: 1028 129 | Altura: 760 130 | Alinhamento horizontal: Centralizar 131 | Alinhamento vertical: Centro 132 | 133 | Clique em Salvar. 134 | 135 | Clique em Monitoramento -> Telas 136 | Na combobox Telas, selecione: Geolocalização para acessar a interface. 137 | 138 | 139 | 140 | 3. CADASTRAR/ALTERAR HOSTS PARA GEOLOCALIZAÇÃO 141 | 142 | Para que os host sejam exibidos no Mapa de Geolocalização é necessário 143 | informar a latitude e a longitude dos mesmos. 144 | Para isso clique em Configurações -> Hosts e selecione o host que deseja 145 | monitorar, entre na aba Inventário do host. 146 | Clique em Manual, preencha longitude e latitude e clique em Salvar. 147 | Agora repita o processo para todos os demais hosts e retorne ao menu 148 | de Geolocalização. 149 | 150 | 4. DEPENDÊNCIAS 151 | 152 | 4.1 fping 153 | O fping deve estar instalado 154 | 155 | Dica do Daniel Schaeffer: 156 | Como instalar o fping para quem usa CentOS ou RedHat: 157 | http://www.tecmint.com/install-fping-icmp-program-on-rhel-centos-6-5-4/ 158 | 159 | 160 | 4.2 MySQL ou PostgreSQL 161 | A versão atual funciona com MySQL ou PostgreSQL 162 | 163 | 164 | 165 | Bom trabalho a todos. 166 | 167 | 8^) 168 | 169 | Aristóteles Rêgo de Araújo 170 | aristoteles.araujo@sspds.ce.gov.br 171 | aristoteles.araujo@gmail.com 172 | 173 | 174 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | zabbix-geolocation 2 | ================== 3 | 4 | Plugin de geolocalização para Zabbix 5 | 6 | 7 | Implementing Geolocation in Zabbix 8 | Zabbix - Extras 9 | 10 | 09/08/2013 11 | Launch! 12 | Geolocation vrs0.3.2 (version Kariri ) 13 | International Day of Indigenous People - August 2013 14 | Download Tarball vrs0.3.2 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.2.tar.gz 15 | New feature: 16 | PostgreSQL support 17 | 18 | 19 | Geolocation vrs 0.3.1 (version Sapucaí ) 20 | Carnival - February 2013 21 | Download Tarball vrs0.3.1 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.tar.gz 22 | 23 | contacts : 24 | Leandro Alves Machado - leandro.machado@sspds.ce.gov.br 25 | Aristotle Araújo - aristoteles.araujo@sspds.ce.gov.br 26 | 27 | 28 | This is the first version available for Zabbix community. 29 | Soon be integrated with this installation package Zabbix - Extras 30 | 31 | Advantages of using the plugin : 32 | 33 | a. Reduces the time to create a map, it is not necessary to put a background image and add / configure all hosts . 34 | b . The image is dynamic , allowing zoom and other features by Google Maps 35 | c . Select the host in the combobox and zoom the local of host 36 | 37 | 38 | 1. INSTALLATION AT GUIDE MONITORING 39 | 40 | 1.1 Create the extras directory and unpack the tarball at zabbix folder 41 | 42 | cd /var/www/html/zabbix 43 | mkdir extras 44 | cd extras 45 | cp //zabbix-geolocation-v0.3.2.tar.gz . 46 | tar zxvf zabbix-geolocation-v0.3.2.tar.gz 47 | cd zabbix-geolocalizacao-v0.3.2 48 | cp geolocation/misc/geolocation.php /var/www/html/zabbix 49 | 50 | Set the directory permissions with the same user/group from zabbix, for example 51 | 52 | cd ../.. 53 | chown -R apache.apache extras 54 | 55 | 56 | 1.2 Creating the menu item 57 | 58 | Edit the file ../zabbix/include/menu.inc.php 59 | 60 | vi ../include/menu.inc.php 61 | 62 | Locate the line: 'label' => _('IT services') contained in the excerpt of code below, at the Monitoring menu: 63 | 64 | array( 65 | 'url' => 'srv_status.php' 66 | 'label' => _(' IT services'), 67 | 'force_disable_all_nodes' => true, 68 | 'sub_pages' => array('report3.php','chart5.php') 69 | ), 70 | 71 | After the excerpt above includes the code below 72 | 73 | array( 74 | 'url' => 'geolocation.php', 75 | 'label' => _('Geolocation') 76 | ), 77 | 78 | Save the file . 79 | 80 | This change creates the link Geolocation at Monitoring menu. 81 | Click Monitoring - > Geolocation to access the interface. 82 | 83 | The Interface has two ComboBox , the first are the Groups and Hosts 84 | and the second List the Hosts belonging to the selected group. 85 | The items in red are the hosts that have an incident. 86 | 87 | 1.2 Configuring php.ini: 88 | 89 | Edit the php.ini file , usually /etc/php.ini and uncomment the option short_open_tag to leaving the flag On 90 | 91 | vi /etc/php.ini 92 | 93 | short_open_tag=On 94 | Save the file and restart apache 95 | 96 | 97 | 1.3 Defining Default Group 98 | 99 | To set the default host group, change the line group in file ../zabbix/extras/geolocation/geolocation.conf 100 | informing the id of the desired Group. 101 | 102 | group=1 103 | 104 | One way to know the id of the Group is to open the interface 105 | Geolocation and look at the number in front of the desired group. 106 | 107 | 108 | 2 . INSTALLATION AT THE SCREEN GUIDE, VIA URL 109 | 110 | Click Configuration -> Screens -> Create Screen 111 | 112 | Name: Geolocation 113 | 114 | Click Save. 115 | 116 | Now click in Geolocation in the list of screens. 117 | 118 | Click Change to include the URL of geolocation 119 | 120 | Resource: url 121 | Url: http://IP-ou-Hostname-Zabbix/zabbix/extras/geolocation/index.php 122 | Width : 1028 123 | Height: 760 124 | Horizontal align: Center 125 | Vertical align: Middle 126 | 127 | Click Save. 128 | 129 | Click Monitoring -> Screens 130 | In the combobox of Screens, select : Geolocation to access the interface . 131 | 132 | 133 | 134 | 3 . REGISTER/CHANGE HOSTS FOR GEOLOCATION 135 | 136 | For showing hosts in Geolocation Map is required informing the latitude and longitude thereof. 137 | 138 | For this click Configuration -> Hosts and select the host you want to monitor, click the Host Inventory tab. 139 | 140 | Click Manual, fill Location latitude and Location longitude, and click Save. 141 | 142 | Fill out the latitude and longitude data in decimal format. Example: -22.951916, -43.210438 143 | 144 | To know the coordinates, find the location on Google, click the right mouse button and select "What is there here?". In the search bar appears latitude and longitude. 145 | 146 | Now repeat the process for all other hosts and return to Geolocation menu. 147 | 148 | 4 . DEPENDENCIES 149 | 150 | 4.1 fping 151 | The fping must be installed. 152 | 153 | Tip of Daniel Schaeffer : 154 | How to install fping for anyone who uses CentOS or RedHat 155 | http://www.tecmint.com/install-fping-icmp-program-on-rhel-centos-6-5-4/ 156 | 157 | 158 | MySQL 4.2 or PostgreSQL 159 | The current version works with MySQL or PostgreSQL. 160 | 161 | 162 | Good job to all . 163 | 164 | 8 ^ ) 165 | 166 | Aristotle Rego de Araújo 167 | aristoteles.araujo @ sspds.ce.gov.br 168 | aristoteles.araujo @ gmail.com 169 | 170 | Translation: 171 | André Déo - Zabbix-Brasil 172 | 13/11/2013 173 | -------------------------------------------------------------------------------- /README.md~: -------------------------------------------------------------------------------- 1 | zabbix-geolocation 2 | ================== 3 | 4 | Plugin de geolocalização para Zabbix 5 | 6 | 7 | Implementing Geolocation in Zabbix 8 | Zabbix - Extras 9 | 10 | 09/08/2013 11 | Launch! 12 | Geolocation vrs0.3.2 (version Kariri ) 13 | International Day of Indigenous People - August 2013 14 | Download Tarball vrs0.3.2 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.2.tar.gz 15 | New feature: 16 | PostgreSQL support 17 | 18 | 19 | Geolocation vrs 0.3.1 (version Sapucaí ) 20 | Carnival - February 2013 21 | Download Tarball vrs0.3.1 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.tar.gz 22 | 23 | contacts : 24 | Leandro Alves Machado - leandro.machado@sspds.ce.gov.br 25 | Aristotle Araújo - aristoteles.araujo@sspds.ce.gov.br 26 | 27 | 28 | This is the first version available for Zabbix community. 29 | Soon be integrated with this installation package Zabbix - Extras 30 | 31 | Advantages of using the plugin : 32 | 33 | a. Reduces the time to create a map, it is not necessary to put a background image and add / configure all hosts . 34 | b . The image is dynamic , allowing zoom and other features by Google Maps 35 | c . Select the host in the combobox and zoom the local of host 36 | 37 | 38 | 1. INSTALLATION AT GUIDE MONITORING 39 | 40 | 1.1 Create the extras directory and unpack the tarball at zabbix folder 41 | 42 | cd /var/www/html/zabbix 43 | mkdir extras 44 | cd extras 45 | cp //zabbix-geolocation-v0.3.2.tar.gz . 46 | tar zxvf zabbix-geolocation-v0.3.2.tar.gz 47 | cd zabbix-geolocalizacao-v0.3.2 48 | cp geolocation/misc/geolocation.php /var/www/html/zabbix 49 | 50 | Set the directory permissions with the same user/group from zabbix, for example 51 | 52 | cd ../.. 53 | chown -R apache.apache extras 54 | 55 | 56 | 1.2 Creating the menu item 57 | 58 | Edit the file ../zabbix/include/menu.inc.php 59 | 60 | vi ../include/menu.inc.php 61 | 62 | Locate the line: 'label' => _('IT services') contained in the excerpt of code below, at the Monitoring menu: 63 | 64 | array( 65 | 'url' => 'srv_status.php' 66 | 'label' => _(' IT services'), 67 | 'force_disable_all_nodes' => true, 68 | 'sub_pages' => array('report3.php','chart5.php') 69 | ), 70 | 71 | After the excerpt above includes the code below 72 | 73 | array( 74 | 'url' => 'geolocation.php', 75 | 'label' => _('Geolocation') 76 | ), 77 | 78 | Save the file . 79 | 80 | This change creates the link Geolocation at Monitoring menu. 81 | Click Monitoring - > Geolocation to access the interface. 82 | 83 | The Interface has two ComboBox , the first are the Groups and Hosts 84 | and the second List the Hosts belonging to the selected group. 85 | The items in red are the hosts that have an incident. 86 | 87 | 1.2 Configuring php.ini: 88 | 89 | Edit the php.ini file , usually /etc/php.ini and uncomment the option short_open_tag to leaving the flag On 90 | 91 | vi /etc/php.ini 92 | 93 | short_open_tag=On 94 | Save the file and restart apache 95 | 96 | 97 | 1.3 Defining Default Group 98 | 99 | To set the default host group, change the line group in file ../zabbix/extras/geolocation/geolocation.conf 100 | informing the id of the desired Group. 101 | 102 | group=1 103 | 104 | One way to know the id of the Group is to open the interface 105 | Geolocation and look at the number in front of the desired group. 106 | 107 | 108 | 2 . INSTALLATION AT THE SCREEN GUIDE, VIA URL 109 | 110 | Click Configuration -> Screens -> Create Screen 111 | 112 | Name: Geolocation 113 | 114 | Click Save. 115 | 116 | Now click in Geolocation in the list of screens. 117 | 118 | Click Change to include the URL of geolocation 119 | 120 | Resource: url 121 | Url: http://IP-ou-Hostname-Zabbix/zabbix/extras/geolocation/index.php 122 | Width : 1028 123 | Height: 760 124 | Horizontal align: Center 125 | Vertical align: Middle 126 | 127 | Click Save. 128 | 129 | Click Monitoring -> Screens 130 | In the combobox of Screens, select : Geolocation to access the interface . 131 | 132 | 133 | 134 | 3 . REGISTER/CHANGE HOSTS FOR GEOLOCATION 135 | 136 | For showing hosts in Geolocation Map is required informing the latitude and longitude thereof. 137 | 138 | For this click Configuration -> Hosts and select the host you want to monitor, click the Host Inventory tab. 139 | 140 | Click Manual, fill Location latitude and Location longitude, and click Save. 141 | 142 | Fill out the latitude and longitude data in decimal format. Example: -22.951916, -43.210438 143 | 144 | To know the coordinates, find the location on Google, click the right mouse button and select "What is there here?". In the search bar appears latitude and longitude. 145 | 146 | Now repeat the process for all other hosts and return to Geolocation menu. 147 | 148 | 4 . DEPENDENCIES 149 | 150 | 4.1 fping 151 | The fping must be installed. 152 | 153 | Tip of Daniel Schaeffer : 154 | How to install fping for anyone who uses CentOS or RedHat 155 | http://www.tecmint.com/install-fping-icmp-program-on-rhel-centos-6-5-4/ 156 | 157 | 158 | MySQL 4.2 or PostgreSQL 159 | The current version works with MySQL or PostgreSQL. 160 | 161 | 162 | Good job to all . 163 | 164 | 8 ^ ) 165 | 166 | Aristotle Rego de Araújo 167 | aristoteles.araujo @ sspds.ce.gov.br 168 | aristoteles.araujo @ gmail.com 169 | 170 | Translation: 171 | André Déo - Zabbix-Brasil 172 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aristotelesaraujo/zabbix-geolocation/487c319bbe59c7a81f88cef69fce30e2eab9c1e0/README.txt -------------------------------------------------------------------------------- /class/Conexao.class.php: -------------------------------------------------------------------------------- 1 | 26 | host = $DB['SERVER']; 56 | $this->user = $DB['USER']; 57 | $this->password = $DB['PASSWORD']; 58 | $this->dbname = $DB['DATABASE']; 59 | $this->dbtype = $DB['TYPE']; 60 | $this->zdbtype = $this->dbtype; 61 | 62 | //echo $this->zdbtype; 63 | 64 | if ($this->dbtype=='MYSQL'){ 65 | $this->con = @mysql_connect($this->host,$this->user,$this->password); 66 | @mysql_select_db($this->dbname,$this->con); 67 | if ($this->con) { 68 | //echo "Conexao efetuada com sucesso"; 69 | } else { 70 | echo "Conexao nao efetuada
" . mysql_error(); 71 | } 72 | } elseif ($this->dbtype=='POSTGRESQL') { 73 | $connect = "host=$this->host user=$this->user password=$this->password dbname=$this->dbname"; 74 | $this->con = pg_connect($connect); 75 | if ($this->con) { 76 | //echo "Conexao efetuada com sucesso"; 77 | } else { 78 | echo "Conexao nao efetuada
"; 79 | } 80 | 81 | 82 | } 83 | 84 | $this->group = $informacao['4']; 85 | } 86 | 87 | 88 | //Metodo que fecha a conexao com o banco de dados 89 | function desconectar() { 90 | if ($this->dbtype=='MYSQL') { 91 | @mysql_close($this->con); 92 | } elseif ($this->dbtype=='POSTGRESQL') { 93 | pg_close($this->con); 94 | } 95 | } 96 | 97 | } 98 | 99 | ?> 100 | -------------------------------------------------------------------------------- /class/Grupos.class.php: -------------------------------------------------------------------------------- 1 | 26 | ** Leonardo Lauermann 27 | ** 28 | **/ 29 | ?> 30 | conectar(); 40 | 41 | $cookie = $_COOKIE["zbx_sessionid"]; 42 | 43 | $query = "SELECT DISTINCT groups.groupid, groups.name from users 44 | join users_groups on users_groups.userid = users.userid 45 | join usrgrp on users_groups.usrgrpid = usrgrp.usrgrpid 46 | join rights on rights.groupid = usrgrp.usrgrpid 47 | join groups on rights.id = groups.groupid 48 | where rights.permission <> 0 and 49 | users_groups.usrgrpid = (SELECT DISTINCT users_groups.usrgrpid from sessions 50 | join users on sessions.userid = users.userid 51 | join users_groups on users_groups.userid = users.userid 52 | where sessions.sessionid = '".$cookie."') 53 | ORDER BY users_groups.usrgrpid ASC"; 54 | 55 | if ($this->zdbtype=='MYSQL') { 56 | $res = mysql_query($query); 57 | while ($dados = mysql_fetch_array($res)) { 58 | $groupid[] = strtoupper($dados["groupid"]); 59 | $name[] = strtoupper($dados["name"]); 60 | } 61 | 62 | } elseif ($this->zdbtype=='POSTGRESQL') { 63 | $res = pg_query($query); 64 | while ($dados = pg_fetch_array($res)) { 65 | $groupid[] = strtoupper($dados["groupid"]); 66 | $name[] = strtoupper($dados["name"]); 67 | } 68 | } 69 | // Usuário super admin não possui privilégios cadastrados, necessário realizar select geral 70 | if (count($groupid) == 0){ 71 | $query = "SELECT groupid, name FROM groups ORDER BY groupid ASC"; 72 | } 73 | 74 | if ($this->zdbtype=='MYSQL') { 75 | $res = mysql_query($query); 76 | while ($dados = mysql_fetch_array($res)) { 77 | $groupid[] = strtoupper($dados["groupid"]); 78 | $name[] = strtoupper($dados["name"]); 79 | } 80 | 81 | } elseif ($this->zdbtype=='POSTGRESQL') { 82 | $res = pg_query($query); 83 | while ($dados = pg_fetch_array($res)) { 84 | $groupid[] = strtoupper($dados["groupid"]); 85 | $name[] = strtoupper($dados["name"]); 86 | } 87 | } 88 | 89 | $grupos = array(); 90 | 91 | for ($i = 0; $i < count($groupid); $i++) { 92 | $grupos[$groupid[$i]] = $name[$i]; 93 | } 94 | 95 | $this->desconectar(); 96 | 97 | return $grupos; 98 | } 99 | 100 | function get_hosts($grupo) { 101 | 102 | $this->conectar(); 103 | 104 | $arquivo = 'geolocation.conf'; 105 | $handle = fopen($arquivo,'r'); 106 | $conteudo = fread($handle, filesize ($arquivo)); 107 | fclose ($handle); 108 | 109 | $texto = explode("\n",$conteudo); 110 | 111 | for ($i = 0; $i < count($texto); $i++) { 112 | $informacao[$i] = rtrim(substr($texto[$i], strpos($texto[$i],'=') + 1)); 113 | } 114 | 115 | $query = "SELECT DISTINCT HG.hostgroupid, HG.hostid, HG.groupid, H.host, I.ip, I.dns, HI.location_lat, HI.location_lon 116 | FROM hosts_groups as HG , hosts as H, interface as I, host_inventory as HI 117 | WHERE HG.groupid = ".$grupo." 118 | AND HG.hostid = H.hostid 119 | AND I.hostid = H.hostid 120 | AND HI.hostid = H.hostid 121 | AND HI.location_lat != '' 122 | AND HI.location_lon != '' 123 | ORDER BY H.host ASC"; 124 | 125 | if ($this->zdbtype=='MYSQL') { 126 | $res = mysql_query($query); 127 | $dbtype_func = "mysql_fetch_array"; //0.3.5 128 | } elseif ($this->zdbtype=='POSTGRESQL') { 129 | $res = pg_query($query); 130 | $dbtype_func = "pg_fetch_array"; //0.3.5 131 | } 132 | 133 | while ($dados = $dbtype_func($res)) { //0.3.5 134 | $hostid[] = $dados["hostid"]; 135 | $host[] = $dados["host"]; 136 | $ip[] = $dados["ip"]; 137 | $dns[] = $dados["dns"]; 138 | $lat[] = $dados["location_lat"]; 139 | $lon[] = $dados["location_lon"]; 140 | } 141 | 142 | $ponto_lat = array_sum($lat)/count($host); 143 | $ponto_lon = array_sum($lon)/count($host); 144 | 145 | if (count($host) <= 0) { 146 | return print ""; 149 | } 150 | 151 | $this->hostid = $hostid; 152 | $this->host = $host; 153 | $this->ip = $ip; 154 | $this->dns = $dns; 155 | $this->lat = $lat; 156 | $this->ponto_lat = $ponto_lat; 157 | $this->lon = $lon; 158 | $this->ponto_lon = $ponto_lon; 159 | $this->qtd_hosts = count($host); 160 | 161 | for ($i = 0; $i < $this->qtd_hosts; $i++) { 162 | 163 | if ($this->ip[$i] <> "") { 164 | $this->cmd[$i] = 'fping -r 1 -b '.$informacao['5'].' -t '.$informacao['6'].' ' . $this->ip[$i]; 165 | } else { 166 | $this->cmd[$i] = 'fping -r 1 -b '.$informacao['5'].' -t '.$informacao['6'].' ' . $this->dns[$i]; 167 | } 168 | 169 | //$this->cmd[$i] = 'fping -r 1 -b '.$informacao['5'].' -t '.$informacao['6'].' ' . $this->ip[$i]; 170 | //echo $this->cmd[$i] . "
"; 171 | exec($this->cmd[$i],$this->saida[$i],$this->retorno); 172 | $this->status[$i] = $this->retorno; 173 | 174 | //string exec ( string $command [, array &$output [, int &$return_var ]] ) 175 | 176 | 177 | } 178 | 179 | $this->desconectar(); 180 | } 181 | 182 | } 183 | 184 | ?> 185 | -------------------------------------------------------------------------------- /css/geral.css: -------------------------------------------------------------------------------- 1 | @CHARSET "ISO-8859-1"; 2 | 3 | /* GERAL CSS */ 4 | 5 | * 6 | { 7 | margin: 0; 8 | padding: 0; 9 | } 10 | 11 | html { 12 | height: 99.9%; 13 | width: 99.9%; 14 | } 15 | 16 | body { 17 | height: 99.9%; 18 | width: 99.9%; 19 | margin: 0 auto; 20 | } 21 | 22 | #pagina-principal { 23 | height: 89.5%; 24 | width: 100%; 25 | } 26 | 27 | #pagina-principal-tabela { 28 | width: 99.9%; 29 | height: 99.9%; 30 | margin-top: 2px; 31 | } 32 | 33 | .pagina-principal-topo { 34 | height: 30px; 35 | width: 100%; 36 | z-index: 5; 37 | background: #FFFFFF; 38 | border: 1px solid #3377AA; 39 | color: #222222; 40 | color: inherit; 41 | } 42 | 43 | .pagina-principal-centro { 44 | height: 100%; 45 | border: 1px solid #000000; 46 | background: #EBEFF2; 47 | } 48 | 49 | 50 | 51 | /* APLICACAO CSS */ 52 | 53 | #mapa { 54 | height: 100%; 55 | width: 100%; 56 | border: 0px solid black; 57 | } 58 | 59 | #camadas { 60 | float:right; 61 | width: 200px; 62 | border:0px solid black; 63 | } 64 | 65 | #refreshs { 66 | float:right; 67 | width: 265px; 68 | border:0px solid black; 69 | } 70 | 71 | #contaodr { 72 | float:right; 73 | width: 265px; 74 | border:1px solid black; 75 | } 76 | 77 | #grupos { 78 | width: 300px; 79 | border: 0px solid black; 80 | font-family: Arial; 81 | font-size: 15px; 82 | font-weight: bold; 83 | color: #767688; 84 | margin-left: 20px; 85 | float: right; 86 | } 87 | 88 | #grupo { 89 | float: right; 90 | margin-right: 4px; 91 | } 92 | 93 | #host { 94 | 95 | } 96 | 97 | #camada { 98 | width: 200px; 99 | } 100 | 101 | #hosts { 102 | width: 560px; 103 | border: 0px solid black; 104 | font-family: Arial; 105 | font-size: 15px; 106 | font-weight: bold; 107 | color: #767688; 108 | margin-left: 5px; 109 | float: left; 110 | } 111 | 112 | #camadas { 113 | border: 0px solid black; 114 | float: right; 115 | } 116 | 117 | #latitude { 118 | width: 120px; 119 | float: left; 120 | border: 0px solid black; 121 | margin-top: 0.3%; 122 | font-size: 11px; 123 | font-weight: bold; 124 | font-family: Arial; 125 | color: #224488; 126 | font-weight: bold; 127 | margin-left: 2px; 128 | font-family: verdana,arial,helvetica,sans-serif; 129 | } 130 | 131 | #longitude { 132 | width: 120px; 133 | float: left; 134 | border: 0px solid black; 135 | margin-top: 0.3%; 136 | font-size: 11px; 137 | font-weight: bold; 138 | font-family: Arial; 139 | color: #224488; 140 | font-weight: bold; 141 | margin-left: 2px; 142 | font-family: verdana,arial,helvetica,sans-serif; 143 | } 144 | 145 | select { 146 | cursor: pointer; 147 | } 148 | 149 | input { 150 | background-color: white; 151 | border: 1px solid #ACA899; 152 | font-family: Verdana,arial,helvetica,sans-serif; 153 | font-size: 10px; 154 | margin: 0 1px; 155 | } 156 | 157 | input:focus { 158 | border-color: #6e8ab4; 159 | } 160 | 161 | input:hover { 162 | border-color: #6e8ab4; 163 | } 164 | 165 | .carregando { 166 | width: 100%; 167 | height: 100%; 168 | text-align: center; 169 | border: 0px solid black; 170 | } 171 | 172 | #carregando_imagem { 173 | width: 100%; 174 | height: 90%; 175 | background: url("../images/carregando.gif") no-repeat; 176 | background-position:center; 177 | border: 0px solid black; 178 | } 179 | 180 | OPTION.erro { 181 | color: red; 182 | } 183 | 184 | #div { 185 | width:99%; 186 | border: 1px solid #7E9AB4; 187 | } 188 | 189 | #tabela { 190 | width:100%; 191 | height:100%; 192 | border-collapse: collapse; 193 | } 194 | 195 | .topo { 196 | background: url("/zabbix/styles/themes/originalblue/images/bg_h-hard_55.png") repeat-x scroll 50% 50% #779DC0; 197 | color: #FFFFFF; 198 | font-weight: bold; 199 | /*font-weight: bold;*/ 200 | height: 18px; 201 | line-height: 18px; 202 | margin-bottom: 2px; 203 | font-family: verdana,arial,helvetica,sans-serif; 204 | font-size: 11px; 205 | text-align: center; 206 | 207 | } 208 | 209 | .ip { 210 | color: #000000; 211 | background: #FFFFFF;; 212 | font-family: verdana,arial,helvetica,sans-serif; 213 | } 214 | 215 | .lat { 216 | color: #000000; 217 | background: #EBEFF2; 218 | font-family: verdana,arial,helvetica,sans-serif; 219 | } 220 | 221 | .lon { 222 | color: #000000; 223 | background: #FFFFFF; 224 | font-family: verdana,arial,helvetica,sans-serif; 225 | } 226 | 227 | .status { 228 | color: #000000; 229 | background: #EBEFF2; 230 | font-family: verdana,arial,helvetica,sans-serif; 231 | } 232 | 233 | /* 234 | .CSSTableGenerator { 235 | margin:0px;padding:0px; 236 | width:99%; 237 | box-shadow: 10px 10px 5px #888888; 238 | 239 | border:1px solid #000000; 240 | 241 | -moz-border-radius-bottomleft:0px; 242 | 243 | -webkit-border-bottom-left-radius:0px; 244 | 245 | border-bottom-left-radius:0px; 246 | 247 | 248 | 249 | -moz-border-radius-bottomright:0px; 250 | 251 | -webkit-border-bottom-right-radius:0px; 252 | 253 | border-bottom-right-radius:0px; 254 | 255 | 256 | 257 | -moz-border-radius-topright:0px; 258 | 259 | -webkit-border-top-right-radius:0px; 260 | 261 | border-top-right-radius:0px; 262 | 263 | 264 | 265 | -moz-border-radius-topleft:0px; 266 | 267 | -webkit-border-top-left-radius:0px; 268 | 269 | border-top-left-radius:0px; 270 | 271 | }.CSSTableGenerator table{ 272 | 273 | width:100%; 274 | 275 | height:100%; 276 | 277 | margin:0px;padding:0px; 278 | 279 | }.CSSTableGenerator tr:last-child td:last-child { 280 | 281 | -moz-border-radius-bottomright:0px; 282 | 283 | -webkit-border-bottom-right-radius:0px; 284 | 285 | border-bottom-right-radius:0px; 286 | 287 | } 288 | 289 | .CSSTableGenerator table tr:first-child td:first-child { 290 | 291 | -moz-border-radius-topleft:0px; 292 | 293 | -webkit-border-top-left-radius:0px; 294 | 295 | border-top-left-radius:0px; 296 | 297 | } 298 | 299 | .CSSTableGenerator table tr:first-child td:last-child { 300 | 301 | -moz-border-radius-topright:0px; 302 | 303 | -webkit-border-top-right-radius:0px; 304 | 305 | border-top-right-radius:0px; 306 | 307 | }.CSSTableGenerator tr:last-child td:first-child{ 308 | 309 | -moz-border-radius-bottomleft:0px; 310 | 311 | -webkit-border-bottom-left-radius:0px; 312 | 313 | border-bottom-left-radius:0px; 314 | 315 | }.CSSTableGenerator tr:hover td{ 316 | 317 | 318 | 319 | } 320 | .CSSTableGenerator tr:nth-child(odd){ background-color:#aad4ff; } 321 | 322 | .CSSTableGenerator tr:nth-child(even) { background-color:#ffffff; } 323 | .CSSTableGenerator td{ 324 | 325 | vertical-align:middle; 326 | 327 | 328 | 329 | 330 | 331 | border:1px solid #000000; 332 | 333 | border-width:0px 1px 1px 0px; 334 | 335 | text-align:left; 336 | 337 | padding:7px; 338 | 339 | font-size:10px; 340 | font-weight: bold; 341 | font-family:Arial; 342 | 343 | font-weight:normal; 344 | 345 | color:#000000; 346 | 347 | }.CSSTableGenerator tr:last-child td{ 348 | 349 | border-width:0px 1px 0px 0px; 350 | 351 | }.CSSTableGenerator tr td:last-child{ 352 | 353 | border-width:0px 0px 1px 0px; 354 | 355 | }.CSSTableGenerator tr:last-child td:last-child{ 356 | 357 | border-width:0px 0px 0px 0px; 358 | 359 | } 360 | 361 | .CSSTableGenerator tr:first-child td{ 362 | background:-o-linear-gradient(bottom, #005fbf 5%, #003f7f 100%); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #005fbf), color-stop(1, #003f7f) ); 363 | background:-moz-linear-gradient( center top, #005fbf 5%, #003f7f 100% ); 364 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#005fbf", endColorstr="#003f7f"); background: -o-linear-gradient(top,#005fbf,003f7f); 365 | 366 | 367 | background-color:#005fbf; 368 | 369 | border:0px solid #000000; 370 | 371 | text-align:center; 372 | 373 | border-width:0px 0px 1px 1px; 374 | 375 | font-size:10px; 376 | 377 | font-family: verdana,arial,helvetica,sans-serif; 378 | 379 | font-weight:bold; 380 | 381 | color:#ffffff; 382 | 383 | } 384 | 385 | .CSSTableGenerator tr:first-child:hover td{ 386 | 387 | background:-o-linear-gradient(bottom, #005fbf 5%, #003f7f 100%); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #005fbf), color-stop(1, #003f7f) ); 388 | background:-moz-linear-gradient( center top, #005fbf 5%, #003f7f 100% ); 389 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#005fbf", endColorstr="#003f7f"); background: -o-linear-gradient(top,#005fbf,003f7f); 390 | 391 | 392 | background-color:#005fbf; 393 | 394 | } 395 | 396 | .CSSTableGenerator tr:first-child td:first-child{ 397 | 398 | border-width:0px 0px 1px 0px; 399 | 400 | } 401 | 402 | .CSSTableGenerator tr:first-child td:last-child{ 403 | 404 | border-width:0px 0px 1px 1px; 405 | 406 | } 407 | 408 | */ 409 | 410 | -------------------------------------------------------------------------------- /css/grupo.css: -------------------------------------------------------------------------------- 1 | @CHARSET "ISO-8859-1"; 2 | 3 | * { 4 | margin: 0; 5 | padding: 0; 6 | } 7 | 8 | html { 9 | width: 100%; 10 | height: 100%; 11 | } 12 | 13 | body { 14 | width: 99.7%; 15 | height: 99.7%; 16 | border: 0px solid black; 17 | } 18 | 19 | #pagina-grupo { 20 | width: 100%; 21 | height: 100%; 22 | margin: 0; 23 | padding: 0; 24 | border-collapse: collapse; 25 | } 26 | 27 | #pagina-grupo-contexto { 28 | width: 100%; 29 | height: 100%; 30 | } 31 | 32 | #pagina-grupo-mapa { 33 | width: 99.15%; 34 | height: 84.15%; 35 | z-index: 0; 36 | position: absolute; 37 | background: #EBEFF2; 38 | } 39 | 40 | #pagina-grupo-host { 41 | height: 25px; 42 | width: 600px; 43 | border: 0px solid black; 44 | z-index: 100; 45 | position: absolute; 46 | margin-top: 5px; 47 | margin-right: 140px; 48 | right: 0; 49 | float: center; 50 | text-align: right; 51 | } 52 | 53 | .labels { 54 | font-size: 10px; 55 | color: #000000; 56 | font-weight: bold; 57 | } 58 | -------------------------------------------------------------------------------- /geolocation.conf: -------------------------------------------------------------------------------- 1 | host=obsoleto 2 | user=obsoleto 3 | password=obsoleto 4 | dbname=obsoleto 5 | group=6 6 | byte=24 7 | timeout=100 8 | weather=yes 9 | -------------------------------------------------------------------------------- /grupo.php: -------------------------------------------------------------------------------- 1 | 26 | get_hosts($_POST['grupo']); 32 | 33 | //Read configuracao de weather 34 | $ponteiro = fopen ("geolocation.conf","r"); 35 | while (!feof ($ponteiro)) { 36 | $linha = fgets($ponteiro,4096); 37 | $tamLinha = strlen($linha); 38 | $posIgual = strpos($linha,'='); 39 | $chave = substr($linha,0,$posIgual); 40 | if ( $chave == "weather") { 41 | $vChaveWeather = substr($linha,$posLinha+1+$posIgual); 42 | //echo $chave.'='.$vChaveWeather.'
'; 43 | } 44 | }//fim while 45 | 46 | ?> 47 | 48 | 328 | 329 |
330 | 331 |
332 | 333 | qtd_hosts == 0) { 335 | ?> 336 | 339 | 342 | 106 | get_grupos(); 109 | 110 | foreach ($grupos as $indice => $grupos_item): 111 | 112 | if ($grupo->group == $indice) { 113 | ?> 114 | 115 | 118 | 119 | 123 | 124 | 125 |
126 | 127 |
128 | 129 | "; 131 | echo ""; 132 | $ponteiro = fopen ("layers.conf","r"); 133 | while (!feof ($ponteiro)) { 134 | $linha = fgets($ponteiro,4096); 135 | $tamLinha = strlen($linha); 136 | $posIgual = strpos($linha,'='); 137 | echo ""; 138 | }//fim while 139 | echo ""; 140 | fclose ($ponteiro); 141 | ?> 142 | 143 |
144 | 145 | 146 | 147 | 148 | 149 | 150 |
151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /index.php~: -------------------------------------------------------------------------------- 1 | 26 | conectar(); 32 | 33 | ?> 34 | 35 | 36 | 37 | 38 | 39 | Geolocalização - SSPDS/CE 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 | 87 | 88 | 89 | 90 | 138 | 139 | 140 | 141 | 144 | 145 | 146 |
91 | 92 |
Long: 0.000000
93 | 94 |
Lat: 0.000000
95 | 96 |
97 | 117 |
118 | 119 |
120 | 121 | "; 123 | echo ""; 124 | $ponteiro = fopen ("layers.conf","r"); 125 | while (!feof ($ponteiro)) { 126 | $linha = fgets($ponteiro,4096); 127 | $tamLinha = strlen($linha); 128 | $posIgual = strpos($linha,'='); 129 | echo ""; 130 | }//fim while 131 | echo ""; 132 | fclose ($ponteiro); 133 | ?> 134 | 135 |
136 | 137 |
142 |
143 |
147 | 148 |
149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /js/markerwithlabel.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @name MarkerWithLabel for V3 3 | * @version 1.1.1 [March 11, 2011] 4 | * @author Gary Little (inspired by code from Marc Ridey of Google). 5 | * @copyright Copyright 2010 Gary Little [gary at luxcentral.com] 6 | * @fileoverview MarkerWithLabel extends the Google Maps JavaScript API V3 7 | * google.maps.Marker class. 8 | *

9 | * MarkerWithLabel allows you to define markers with associated labels. As you would expect, 10 | * if the marker is draggable, so too will be the label. In addition, a marker with a label 11 | * responds to all mouse events in the same manner as a regular marker. It also fires mouse 12 | * events and "property changed" events just as a regular marker would. Version 1.1 adds 13 | * support for the raiseOnDrag feature introduced in API V3.3. 14 | *

15 | * If you drag a marker by its label, you can cancel the drag and return the marker to its 16 | * original position by pressing the Esc key. This doesn't work if you drag the marker 17 | * itself because this feature is not (yet) supported in the google.maps.Marker class. 18 | */ 19 | 20 | /*! 21 | * 22 | * Licensed under the Apache License, Version 2.0 (the "License"); 23 | * you may not use this file except in compliance with the License. 24 | * You may obtain a copy of the License at 25 | * 26 | * http://www.apache.org/licenses/LICENSE-2.0 27 | * 28 | * Unless required by applicable law or agreed to in writing, software 29 | * distributed under the License is distributed on an "AS IS" BASIS, 30 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | * See the License for the specific language governing permissions and 32 | * limitations under the License. 33 | */ 34 | 35 | /*jslint browser:true */ 36 | /*global document,google */ 37 | 38 | /** 39 | * This constructor creates a label and associates it with a marker. 40 | * It is for the private use of the MarkerWithLabel class. 41 | * @constructor 42 | * @param {Marker} marker The marker with which the label is to be associated. 43 | * @private 44 | */ 45 | function MarkerLabel_(marker) { 46 | this.marker_ = marker; 47 | 48 | this.labelDiv_ = document.createElement("div"); 49 | this.labelDiv_.style.cssText = "position: absolute; overflow: hidden;"; 50 | 51 | // Set up the DIV for handling mouse events in the label. This DIV forms a transparent veil 52 | // in the "overlayMouseTarget" pane, a veil that covers just the label. This is done so that 53 | // events can be captured even if the label is in the shadow of a google.maps.InfoWindow. 54 | // Code is included here to ensure the veil is always exactly the same size as the label. 55 | this.eventDiv_ = document.createElement("div"); 56 | this.eventDiv_.style.cssText = this.labelDiv_.style.cssText; 57 | 58 | // This is needed for proper behavior on MSIE: 59 | this.eventDiv_.setAttribute("onselectstart", "return false;"); 60 | this.eventDiv_.setAttribute("ondragstart", "return false;"); 61 | 62 | // Set up the IMG for the "X" to be displayed when the marker is raised. 63 | this.crossDiv_ = document.createElement("img"); 64 | this.crossDiv_.style.cssText = "position: absolute; z-index: 1000002; display: none;"; 65 | // Hopefully Google never changes the standard "X" attributes: 66 | this.crossDiv_.style.marginLeft = "-8px"; 67 | this.crossDiv_.style.marginTop = "-9px"; 68 | this.crossDiv_.src = "http://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png"; 69 | } 70 | 71 | // MarkerLabel_ inherits from OverlayView: 72 | MarkerLabel_.prototype = new google.maps.OverlayView(); 73 | 74 | /** 75 | * Adds the DIV representing the label to the DOM. This method is called 76 | * automatically when the marker's setMap method is called. 77 | * @private 78 | */ 79 | MarkerLabel_.prototype.onAdd = function () { 80 | var me = this; 81 | var cMouseIsDown = false; 82 | var cDraggingLabel = false; 83 | var cSavedZIndex; 84 | var cLatOffset, cLngOffset; 85 | var cIgnoreClick; 86 | var cRaiseEnabled; 87 | var cStartPosition; 88 | var cStartCenter; 89 | // Constants: 90 | var cRaiseOffset = 20; 91 | var cDraggingCursor = "url(http://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur)"; 92 | 93 | // Stops all processing of an event. 94 | // 95 | var cAbortEvent = function (e) { 96 | if (e.preventDefault) { 97 | e.preventDefault(); 98 | } 99 | e.cancelBubble = true; 100 | if (e.stopPropagation) { 101 | e.stopPropagation(); 102 | } 103 | }; 104 | 105 | var cStopBounce = function () { 106 | me.marker_.setAnimation(null); 107 | }; 108 | 109 | this.getPanes().overlayImage.appendChild(this.labelDiv_); 110 | this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_); 111 | this.getPanes().overlayImage.appendChild(this.crossDiv_); 112 | 113 | this.listeners_ = [ 114 | google.maps.event.addDomListener(this.eventDiv_, "mouseover", function (e) { 115 | if (me.marker_.getDraggable() || me.marker_.getClickable()) { 116 | this.style.cursor = "pointer"; 117 | google.maps.event.trigger(me.marker_, "mouseover", e); 118 | } 119 | }), 120 | google.maps.event.addDomListener(this.eventDiv_, "mouseout", function (e) { 121 | if ((me.marker_.getDraggable() || me.marker_.getClickable()) && !cDraggingLabel) { 122 | this.style.cursor = me.marker_.getCursor(); 123 | google.maps.event.trigger(me.marker_, "mouseout", e); 124 | } 125 | }), 126 | google.maps.event.addDomListener(this.eventDiv_, "mousedown", function (e) { 127 | cDraggingLabel = false; 128 | if (me.marker_.getDraggable()) { 129 | cMouseIsDown = true; 130 | this.style.cursor = cDraggingCursor; 131 | } 132 | if (me.marker_.getDraggable() || me.marker_.getClickable()) { 133 | google.maps.event.trigger(me.marker_, "mousedown", e); 134 | cAbortEvent(e); // Prevent map pan when starting a drag on a label 135 | } 136 | }), 137 | google.maps.event.addDomListener(document, "mouseup", function (mEvent) { 138 | var position; 139 | if (cMouseIsDown) { 140 | cMouseIsDown = false; 141 | me.eventDiv_.style.cursor = "pointer"; 142 | google.maps.event.trigger(me.marker_, "mouseup", mEvent); 143 | } 144 | if (cDraggingLabel) { 145 | if (cRaiseEnabled) { // Lower the marker & label 146 | position = me.getProjection().fromLatLngToDivPixel(me.marker_.getPosition()); 147 | position.y += cRaiseOffset; 148 | me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position)); 149 | // This is not the same bouncing style as when the marker portion is dragged, 150 | // but it will have to do: 151 | try { // Will fail if running Google Maps API earlier than V3.3 152 | me.marker_.setAnimation(google.maps.Animation.BOUNCE); 153 | setTimeout(cStopBounce, 1406); 154 | } catch (e) {} 155 | } 156 | me.crossDiv_.style.display = "none"; 157 | me.marker_.setZIndex(cSavedZIndex); 158 | cIgnoreClick = true; // Set flag to ignore the click event reported after a label drag 159 | cDraggingLabel = false; 160 | mEvent.latLng = me.marker_.getPosition(); 161 | google.maps.event.trigger(me.marker_, "dragend", mEvent); 162 | } 163 | }), 164 | google.maps.event.addListener(me.marker_.getMap(), "mousemove", function (mEvent) { 165 | var position; 166 | if (cMouseIsDown) { 167 | if (cDraggingLabel) { 168 | // Change the reported location from the mouse position to the marker position: 169 | mEvent.latLng = new google.maps.LatLng(mEvent.latLng.lat() - cLatOffset, mEvent.latLng.lng() - cLngOffset); 170 | position = me.getProjection().fromLatLngToDivPixel(mEvent.latLng); 171 | if (cRaiseEnabled) { 172 | me.crossDiv_.style.left = position.x + "px"; 173 | me.crossDiv_.style.top = position.y + "px"; 174 | me.crossDiv_.style.display = ""; 175 | position.y -= cRaiseOffset; 176 | } 177 | me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position)); 178 | if (cRaiseEnabled) { // Don't raise the veil; this hack needed to make MSIE act properly 179 | me.eventDiv_.style.top = (position.y + cRaiseOffset) + "px"; 180 | } 181 | google.maps.event.trigger(me.marker_, "drag", mEvent); 182 | } else { 183 | // Calculate offsets from the click point to the marker position: 184 | cLatOffset = mEvent.latLng.lat() - me.marker_.getPosition().lat(); 185 | cLngOffset = mEvent.latLng.lng() - me.marker_.getPosition().lng(); 186 | cSavedZIndex = me.marker_.getZIndex(); 187 | cStartPosition = me.marker_.getPosition(); 188 | cStartCenter = me.marker_.getMap().getCenter(); 189 | cRaiseEnabled = me.marker_.get("raiseOnDrag"); 190 | cDraggingLabel = true; 191 | me.marker_.setZIndex(1000000); // Moves the marker & label to the foreground during a drag 192 | mEvent.latLng = me.marker_.getPosition(); 193 | google.maps.event.trigger(me.marker_, "dragstart", mEvent); 194 | } 195 | } 196 | }), 197 | google.maps.event.addDomListener(document, "keydown", function (e) { 198 | if (cDraggingLabel) { 199 | if (e.keyCode === 27) { // Esc key 200 | cRaiseEnabled = false; 201 | me.marker_.setPosition(cStartPosition); 202 | me.marker_.getMap().setCenter(cStartCenter); 203 | google.maps.event.trigger(document, "mouseup", e); 204 | } 205 | } 206 | }), 207 | google.maps.event.addDomListener(this.eventDiv_, "click", function (e) { 208 | if (me.marker_.getDraggable() || me.marker_.getClickable()) { 209 | if (cIgnoreClick) { // Ignore the click reported when a label drag ends 210 | cIgnoreClick = false; 211 | } else { 212 | google.maps.event.trigger(me.marker_, "click", e); 213 | cAbortEvent(e); // Prevent click from being passed on to map 214 | } 215 | } 216 | }), 217 | google.maps.event.addDomListener(this.eventDiv_, "dblclick", function (e) { 218 | if (me.marker_.getDraggable() || me.marker_.getClickable()) { 219 | google.maps.event.trigger(me.marker_, "dblclick", e); 220 | cAbortEvent(e); // Prevent map zoom when double-clicking on a label 221 | } 222 | }), 223 | google.maps.event.addListener(this.marker_, "dragstart", function (mEvent) { 224 | if (!cDraggingLabel) { 225 | cRaiseEnabled = this.get("raiseOnDrag"); 226 | } 227 | }), 228 | google.maps.event.addListener(this.marker_, "drag", function (mEvent) { 229 | if (!cDraggingLabel) { 230 | if (cRaiseEnabled) { 231 | me.setPosition(cRaiseOffset); 232 | // During a drag, the marker's z-index is temporarily set to 1000000 to 233 | // ensure it appears above all other markers. Also set the label's z-index 234 | // to 1000000 (plus or minus 1 depending on whether the label is supposed 235 | // to be above or below the marker). 236 | me.labelDiv_.style.zIndex = 1000000 + (this.get("labelInBackground") ? -1 : +1); 237 | } 238 | } 239 | }), 240 | google.maps.event.addListener(this.marker_, "dragend", function (mEvent) { 241 | if (!cDraggingLabel) { 242 | if (cRaiseEnabled) { 243 | me.setPosition(0); // Also restores z-index of label 244 | } 245 | } 246 | }), 247 | google.maps.event.addListener(this.marker_, "position_changed", function () { 248 | me.setPosition(); 249 | }), 250 | google.maps.event.addListener(this.marker_, "zindex_changed", function () { 251 | me.setZIndex(); 252 | }), 253 | google.maps.event.addListener(this.marker_, "visible_changed", function () { 254 | me.setVisible(); 255 | }), 256 | google.maps.event.addListener(this.marker_, "labelvisible_changed", function () { 257 | me.setVisible(); 258 | }), 259 | google.maps.event.addListener(this.marker_, "title_changed", function () { 260 | me.setTitle(); 261 | }), 262 | google.maps.event.addListener(this.marker_, "labelcontent_changed", function () { 263 | me.setContent(); 264 | }), 265 | google.maps.event.addListener(this.marker_, "labelanchor_changed", function () { 266 | me.setAnchor(); 267 | }), 268 | google.maps.event.addListener(this.marker_, "labelclass_changed", function () { 269 | me.setStyles(); 270 | }), 271 | google.maps.event.addListener(this.marker_, "labelstyle_changed", function () { 272 | me.setStyles(); 273 | }) 274 | ]; 275 | }; 276 | 277 | /** 278 | * Removes the DIV for the label from the DOM. It also removes all event handlers. 279 | * This method is called automatically when the marker's setMap(null) 280 | * method is called. 281 | * @private 282 | */ 283 | MarkerLabel_.prototype.onRemove = function () { 284 | var i; 285 | this.labelDiv_.parentNode.removeChild(this.labelDiv_); 286 | this.eventDiv_.parentNode.removeChild(this.eventDiv_); 287 | this.crossDiv_.parentNode.removeChild(this.crossDiv_); 288 | 289 | // Remove event listeners: 290 | for (i = 0; i < this.listeners_.length; i++) { 291 | google.maps.event.removeListener(this.listeners_[i]); 292 | } 293 | }; 294 | 295 | /** 296 | * Draws the label on the map. 297 | * @private 298 | */ 299 | MarkerLabel_.prototype.draw = function () { 300 | this.setContent(); 301 | this.setTitle(); 302 | this.setStyles(); 303 | }; 304 | 305 | /** 306 | * Sets the content of the label. 307 | * The content can be plain text or an HTML DOM node. 308 | * @private 309 | */ 310 | MarkerLabel_.prototype.setContent = function () { 311 | var content = this.marker_.get("labelContent"); 312 | if (typeof content.nodeType === "undefined") { 313 | this.labelDiv_.innerHTML = content; 314 | this.eventDiv_.innerHTML = this.labelDiv_.innerHTML; 315 | } else { 316 | this.labelDiv_.innerHTML = ""; // Remove current content 317 | this.labelDiv_.appendChild(content); 318 | content = content.cloneNode(true); 319 | this.eventDiv_.appendChild(content); 320 | } 321 | }; 322 | 323 | /** 324 | * Sets the content of the tool tip for the label. It is 325 | * always set to be the same as for the marker itself. 326 | * @private 327 | */ 328 | MarkerLabel_.prototype.setTitle = function () { 329 | this.eventDiv_.title = this.marker_.getTitle() || ""; 330 | }; 331 | 332 | /** 333 | * Sets the style of the label by setting the style sheet and applying 334 | * other specific styles requested. 335 | * @private 336 | */ 337 | MarkerLabel_.prototype.setStyles = function () { 338 | var i, labelStyle; 339 | 340 | // Apply style values from the style sheet defined in the labelClass parameter: 341 | this.labelDiv_.className = this.marker_.get("labelClass"); 342 | this.eventDiv_.className = this.labelDiv_.className; 343 | 344 | // Clear existing inline style values: 345 | this.labelDiv_.style.cssText = ""; 346 | this.eventDiv_.style.cssText = ""; 347 | // Apply style values defined in the labelStyle parameter: 348 | labelStyle = this.marker_.get("labelStyle"); 349 | for (i in labelStyle) { 350 | if (labelStyle.hasOwnProperty(i)) { 351 | this.labelDiv_.style[i] = labelStyle[i]; 352 | this.eventDiv_.style[i] = labelStyle[i]; 353 | } 354 | } 355 | this.setMandatoryStyles(); 356 | }; 357 | 358 | /** 359 | * Sets the mandatory styles to the DIV representing the label as well as to the 360 | * associated event DIV. This includes setting the DIV position, z-index, and visibility. 361 | * @private 362 | */ 363 | MarkerLabel_.prototype.setMandatoryStyles = function () { 364 | this.labelDiv_.style.position = "absolute"; 365 | this.labelDiv_.style.overflow = "hidden"; 366 | // Make sure the opacity setting causes the desired effect on MSIE: 367 | if (typeof this.labelDiv_.style.opacity !== "undefined" && this.labelDiv_.style.opacity !== "") { 368 | this.labelDiv_.style.filter = "alpha(opacity=" + (this.labelDiv_.style.opacity * 100) + ")"; 369 | } 370 | 371 | this.eventDiv_.style.position = this.labelDiv_.style.position; 372 | this.eventDiv_.style.overflow = this.labelDiv_.style.overflow; 373 | this.eventDiv_.style.opacity = 0.01; // Don't use 0; DIV won't be clickable on MSIE 374 | this.eventDiv_.style.filter = "alpha(opacity=1)"; // For MSIE 375 | 376 | this.setAnchor(); 377 | this.setPosition(); // This also updates z-index, if necessary. 378 | this.setVisible(); 379 | }; 380 | 381 | /** 382 | * Sets the anchor point of the label. 383 | * @private 384 | */ 385 | MarkerLabel_.prototype.setAnchor = function () { 386 | var anchor = this.marker_.get("labelAnchor"); 387 | this.labelDiv_.style.marginLeft = -anchor.x + "px"; 388 | this.labelDiv_.style.marginTop = -anchor.y + "px"; 389 | this.eventDiv_.style.marginLeft = -anchor.x + "px"; 390 | this.eventDiv_.style.marginTop = -anchor.y + "px"; 391 | }; 392 | 393 | /** 394 | * Sets the position of the label. The z-index is also updated, if necessary. 395 | * @private 396 | */ 397 | MarkerLabel_.prototype.setPosition = function (yOffset) { 398 | var position = this.getProjection().fromLatLngToDivPixel(this.marker_.getPosition()); 399 | if (typeof yOffset === "undefined") { 400 | yOffset = 0; 401 | } 402 | this.labelDiv_.style.left = position.x + "px"; 403 | this.labelDiv_.style.top = (position.y - yOffset) + "px"; 404 | this.eventDiv_.style.left = this.labelDiv_.style.left; 405 | this.eventDiv_.style.top = this.labelDiv_.style.top; 406 | 407 | this.setZIndex(); 408 | }; 409 | 410 | /** 411 | * Sets the z-index of the label. If the marker's z-index property has not been defined, the z-index 412 | * of the label is set to the vertical coordinate of the label. This is in keeping with the default 413 | * stacking order for Google Maps: markers to the south are in front of markers to the north. 414 | * @private 415 | */ 416 | MarkerLabel_.prototype.setZIndex = function () { 417 | var zAdjust = (this.marker_.get("labelInBackground") ? -1 : +1); 418 | if (typeof this.marker_.getZIndex() === "undefined") { 419 | this.labelDiv_.style.zIndex = parseInt(this.labelDiv_.style.top, 10) + zAdjust; 420 | this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex; 421 | } else { 422 | this.labelDiv_.style.zIndex = this.marker_.getZIndex() + zAdjust; 423 | this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex; 424 | } 425 | }; 426 | 427 | /** 428 | * Sets the visibility of the label. The label is visible only if the marker itself is 429 | * visible (i.e., its visible property is true) and the labelVisible property is true. 430 | * @private 431 | */ 432 | MarkerLabel_.prototype.setVisible = function () { 433 | if (this.marker_.get("labelVisible")) { 434 | this.labelDiv_.style.display = this.marker_.getVisible() ? "block" : "none"; 435 | } else { 436 | this.labelDiv_.style.display = "none"; 437 | } 438 | this.eventDiv_.style.display = this.labelDiv_.style.display; 439 | }; 440 | 441 | /** 442 | * @name MarkerWithLabelOptions 443 | * @class This class represents the optional parameter passed to the {@link MarkerWithLabel} constructor. 444 | * The properties available are the same as for google.maps.Marker with the addition 445 | * of the properties listed below. To change any of these additional properties after the labeled 446 | * marker has been created, call google.maps.Marker.set(propertyName, propertyValue). 447 | *

448 | * When any of these properties changes, a property changed event is fired. The names of these 449 | * events are derived from the name of the property and are of the form propertyname_changed. 450 | * For example, if the content of the label changes, a labelcontent_changed event 451 | * is fired. 452 | *

453 | * @property {string|Node} [labelContent] The content of the label (plain text or an HTML DOM node). 454 | * @property {Point} [labelAnchor] By default, a label is drawn with its anchor point at (0,0) so 455 | * that its top left corner is positioned at the anchor point of the associated marker. Use this 456 | * property to change the anchor point of the label. For example, to center a 50px-wide label 457 | * beneath a marker, specify a labelAnchor of google.maps.Point(25, 0). 458 | * (Note: x-values increase to the right and y-values increase to the top.) 459 | * @property {string} [labelClass] The name of the CSS class defining the styles for the label. 460 | * Note that style values for position, overflow, top, 461 | * left, zIndex, display, marginLeft, and 462 | * marginTop are ignored; these styles are for internal use only. 463 | * @property {Object} [labelStyle] An object literal whose properties define specific CSS 464 | * style values to be applied to the label. Style values defined here override those that may 465 | * be defined in the labelClass style sheet. If this property is changed after the 466 | * label has been created, all previously set styles (except those defined in the style sheet) 467 | * are removed from the label before the new style values are applied. 468 | * Note that style values for position, overflow, top, 469 | * left, zIndex, display, marginLeft, and 470 | * marginTop are ignored; these styles are for internal use only. 471 | * @property {boolean} [labelInBackground] A flag indicating whether a label that overlaps its 472 | * associated marker should appear in the background (i.e., in a plane below the marker). 473 | * The default is false, which causes the label to appear in the foreground. 474 | * @property {boolean} [labelVisible] A flag indicating whether the label is to be visible. 475 | * The default is true. Note that even if labelVisible is 476 | * true, the label will not be visible unless the associated marker is also 477 | * visible (i.e., unless the marker's visible property is true). 478 | * @property {boolean} [raiseOnDrag] A flag indicating whether the label and marker are to be 479 | * raised when the marker is dragged. The default is true. If a draggable marker is 480 | * being created and a version of Google Maps API earlier than V3.3 is being used, this property 481 | * must be set to false. 482 | */ 483 | /** 484 | * Creates a MarkerWithLabel with the options specified in {@link MarkerWithLabelOptions}. 485 | * @constructor 486 | * @param {MarkerWithLabelOptions} [opt_options] The optional parameters. 487 | */ 488 | function MarkerWithLabel(opt_options) { 489 | opt_options = opt_options || {}; 490 | opt_options.labelContent = opt_options.labelContent || ""; 491 | opt_options.labelAnchor = opt_options.labelAnchor || new google.maps.Point(0, 0); 492 | opt_options.labelClass = opt_options.labelClass || "markerLabels"; 493 | opt_options.labelStyle = opt_options.labelStyle || {}; 494 | opt_options.labelInBackground = opt_options.labelInBackground || false; 495 | // Workaround a bug in API V3.4: 496 | if (typeof opt_options.visible === "undefined") { 497 | opt_options.visible = true; 498 | } 499 | if (typeof opt_options.labelVisible === "undefined") { 500 | opt_options.labelVisible = true; 501 | } 502 | if (typeof opt_options.raiseOnDrag === "undefined") { 503 | opt_options.raiseOnDrag = true; 504 | } 505 | if (typeof opt_options.clickable === "undefined") { 506 | opt_options.clickable = true; 507 | } 508 | if (typeof opt_options.draggable === "undefined") { 509 | opt_options.draggable = false; 510 | } 511 | 512 | this.label = new MarkerLabel_(this); // Bind the label to the marker 513 | 514 | // Call the parent constructor. It calls Marker.setValues to initialize, so all 515 | // the new parameters are conveniently saved and can be accessed with get/set. 516 | // Marker.set triggers a property changed event (called "propertyname_changed") 517 | // that the marker label listens for in order to react to state changes. 518 | google.maps.Marker.apply(this, arguments); 519 | } 520 | 521 | // MarkerWithLabel inherits from Marker: 522 | MarkerWithLabel.prototype = new google.maps.Marker(); 523 | 524 | /** 525 | * Overrides the standard Marker setMap function. 526 | * @param {Map} marker The map to which the marker is to be added. 527 | * @private 528 | */ 529 | MarkerWithLabel.prototype.setMap = function (theMap) { 530 | 531 | // Call the inherited function... 532 | google.maps.Marker.prototype.setMap.apply(this, arguments); 533 | 534 | // ... then deal with the label: 535 | this.label.setMap(theMap); 536 | }; -------------------------------------------------------------------------------- /js/markerwithlabel_packed.js: -------------------------------------------------------------------------------- 1 | eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('8 u(a){2.3=a;2.7=R.1y("1X");2.7.4.S="T: 1h; 12: 1D;";2.q=R.1y("1X");2.q.4.S=2.7.4.S;2.q.25("2U","1S A;");2.q.25("2E","1S A;");2.w=R.1y("2u");2.w.4.S="T: 1h; z-2p: 2k; L: 13;";2.w.4.1b="-2g";2.w.4.1w="-35";2.w.32="1A://5.1Y.1V/1K/1R/1Q/2G.2D"}u.t=V 6.5.2t();u.t.2r=8(){s g=2;s m=A;s c=A;s f;s j,1f;s p;s d;s h;s o;s n=20;s i="2e(1A://5.1Y.1V/1K/1R/1Q/2d.34)";s k=8(e){9(e.24){e.24()}e.2Z=H;9(e.21){e.21()}};s l=8(){g.3.1G(2R)};2.1t().1U.W(2.7);2.1t().2M.W(2.q);2.1t().1U.W(2.w);2.1m=[6.5.r.K(2.q,"1P",8(e){9(g.3.O()||g.3.X()){2.4.17="1N";6.5.r.B(g.3,"1P",e)}}),6.5.r.K(2.q,"1M",8(e){9((g.3.O()||g.3.X())&&!c){2.4.17=g.3.2y();6.5.r.B(g.3,"1M",e)}}),6.5.r.K(2.q,"1W",8(e){c=A;9(g.3.O()){m=H;2.4.17=i}9(g.3.O()||g.3.X()){6.5.r.B(g.3,"1W",e);k(e)}}),6.5.r.K(R,"1g",8(a){s b;9(m){m=A;g.q.4.17="1N";6.5.r.B(g.3,"1g",a)}9(c){9(d){b=g.U().1x(g.3.M());b.y+=n;g.3.J(g.U().1H(b));2q{g.3.1G(6.5.2o.2n);2m(l,2l)}2j(e){}}g.w.4.L="13";g.3.Z(f);p=H;c=A;a.I=g.3.M();6.5.r.B(g.3,"1F",a)}}),6.5.r.v(g.3.1e(),"2i",8(a){s b;9(m){9(c){a.I=V 6.5.2h(a.I.1d()-j,a.I.1c()-1f);b=g.U().1x(a.I);9(d){g.w.4.15=b.x+"C";g.w.4.Q=b.y+"C";g.w.4.L="";b.y-=n}g.3.J(g.U().1H(b));9(d){g.q.4.Q=(b.y+n)+"C"}6.5.r.B(g.3,"1E",a)}Y{j=a.I.1d()-g.3.M().1d();1f=a.I.1c()-g.3.M().1c();f=g.3.1a();h=g.3.M();o=g.3.1e().2f();d=g.3.E("11");c=H;g.3.Z(1C);a.I=g.3.M();6.5.r.B(g.3,"1B",a)}}}),6.5.r.K(R,"2c",8(e){9(c){9(e.2b===27){d=A;g.3.J(h);g.3.1e().33(o);6.5.r.B(R,"1g",e)}}}),6.5.r.K(2.q,"29",8(e){9(g.3.O()||g.3.X()){9(p){p=A}Y{6.5.r.B(g.3,"29",e);k(e)}}}),6.5.r.K(2.q,"28",8(e){9(g.3.O()||g.3.X()){6.5.r.B(g.3,"28",e);k(e)}}),6.5.r.v(2.3,"1B",8(a){9(!c){d=2.E("11")}}),6.5.r.v(2.3,"1E",8(a){9(!c){9(d){g.J(n);g.7.4.N=1C+(2.E("18")?-1:+1)}}}),6.5.r.v(2.3,"1F",8(a){9(!c){9(d){g.J(0)}}}),6.5.r.v(2.3,"31",8(){g.J()}),6.5.r.v(2.3,"30",8(){g.Z()}),6.5.r.v(2.3,"2Y",8(){g.19()}),6.5.r.v(2.3,"2X",8(){g.19()}),6.5.r.v(2.3,"2W",8(){g.1i()}),6.5.r.v(2.3,"2V",8(){g.1v()}),6.5.r.v(2.3,"2T",8(){g.1l()}),6.5.r.v(2.3,"2S",8(){g.14()}),6.5.r.v(2.3,"2Q",8(){g.14()})]};u.t.2P=8(){s i;2.7.1z.1s(2.7);2.q.1z.1s(2.q);2.w.1z.1s(2.w);1T(i=0;i<2.1m.2O;i++){6.5.r.2N(2.1m[i])}};u.t.2L=8(){2.1v();2.1i();2.14()};u.t.1v=8(){s a=2.3.E("1r");9(G a.2K==="F"){2.7.16=a;2.q.16=2.7.16}Y{2.7.16="";2.7.W(a);a=a.2J(H);2.q.W(a)}};u.t.1i=8(){2.q.2H=2.3.2F()||""};u.t.14=8(){s i,D;2.7.1p=2.3.E("1o");2.q.1p=2.7.1p;2.7.4.S="";2.q.4.S="";D=2.3.E("D");1T(i 2C D){9(D.2I(i)){2.7.4[i]=D[i];2.q.4[i]=D[i]}}2.1O()};u.t.1O=8(){2.7.4.T="1h";2.7.4.12="1D";9(G 2.7.4.P!=="F"&&2.7.4.P!==""){2.7.4.2a="1Z(P="+(2.7.4.P*2B)+")"}2.q.4.T=2.7.4.T;2.q.4.12=2.7.4.12;2.q.4.P=0.2A;2.q.4.2a="1Z(P=1)";2.1l();2.J();2.19()};u.t.1l=8(){s a=2.3.E("1q");2.7.4.1b=-a.x+"C";2.7.4.1w=-a.y+"C";2.q.4.1b=-a.x+"C";2.q.4.1w=-a.y+"C"};u.t.J=8(a){s b=2.U().1x(2.3.M());9(G a==="F"){a=0}2.7.4.15=b.x+"C";2.7.4.Q=(b.y-a)+"C";2.q.4.15=2.7.4.15;2.q.4.Q=2.7.4.Q;2.Z()};u.t.Z=8(){s a=(2.3.E("18")?-1:+1);9(G 2.3.1a()==="F"){2.7.4.N=2z(2.7.4.Q,10)+a;2.q.4.N=2.7.4.N}Y{2.7.4.N=2.3.1a()+a;2.q.4.N=2.7.4.N}};u.t.19=8(){9(2.3.E("1n")){2.7.4.L=2.3.2x()?"2w":"13"}Y{2.7.4.L="13"}2.q.4.L=2.7.4.L};8 1j(a){a=a||{};a.1r=a.1r||"";a.1q=a.1q||V 6.5.2v(0,0);a.1o=a.1o||"2s";a.D=a.D||{};a.18=a.18||A;9(G a.26==="F"){a.26=H}9(G a.1n==="F"){a.1n=H}9(G a.11==="F"){a.11=H}9(G a.1L==="F"){a.1L=H}9(G a.22==="F"){a.22=A}2.1J=V u(2);6.5.1u.1I(2,23)}1j.t=V 6.5.1u();1j.t.1k=8(a){6.5.1u.t.1k.1I(2,23);2.1J.1k(a)};',62,192,'||this|marker_|style|maps|google|labelDiv_|function|if|||||||||||||||||eventDiv_|event|var|prototype|MarkerLabel_|addListener|crossDiv_||||false|trigger|px|labelStyle|get|undefined|typeof|true|latLng|setPosition|addDomListener|display|getPosition|zIndex|getDraggable|opacity|top|document|cssText|position|getProjection|new|appendChild|getClickable|else|setZIndex||raiseOnDrag|overflow|none|setStyles|left|innerHTML|cursor|labelInBackground|setVisible|getZIndex|marginLeft|lng|lat|getMap|cLngOffset|mouseup|absolute|setTitle|MarkerWithLabel|setMap|setAnchor|listeners_|labelVisible|labelClass|className|labelAnchor|labelContent|removeChild|getPanes|Marker|setContent|marginTop|fromLatLngToDivPixel|createElement|parentNode|http|dragstart|1000000|hidden|drag|dragend|setAnimation|fromDivPixelToLatLng|apply|label|intl|clickable|mouseout|pointer|setMandatoryStyles|mouseover|mapfiles|en_us|return|for|overlayImage|com|mousedown|div|gstatic|alpha||stopPropagation|draggable|arguments|preventDefault|setAttribute|visible||dblclick|click|filter|keyCode|keydown|closedhand_8_8|url|getCenter|8px|LatLng|mousemove|catch|1000002|1406|setTimeout|BOUNCE|Animation|index|try|onAdd|markerLabels|OverlayView|img|Point|block|getVisible|getCursor|parseInt|01|100|in|png|ondragstart|getTitle|drag_cross_67_16|title|hasOwnProperty|cloneNode|nodeType|draw|overlayMouseTarget|removeListener|length|onRemove|labelstyle_changed|null|labelclass_changed|labelanchor_changed|onselectstart|labelcontent_changed|title_changed|labelvisible_changed|visible_changed|cancelBubble|zindex_changed|position_changed|src|setCenter|cur|9px'.split('|'),0,{})) -------------------------------------------------------------------------------- /js/oms.min.js: -------------------------------------------------------------------------------- 1 | (function(){/* 2 | OverlappingMarkerSpiderfier 3 | https://github.com/jawj/OverlappingMarkerSpiderfier 4 | Copyright (c) 2011 - 2012 George MacKerron 5 | Released under the MIT licence: http://opensource.org/licenses/mit-license 6 | Note: The Google Maps API v3 must be included *before* this code 7 | */ 8 | var h=!0,u=null,v=!1; 9 | (function(){var A,B={}.hasOwnProperty,C=[].slice;if(((A=this.google)!=u?A.maps:void 0)!=u)this.OverlappingMarkerSpiderfier=function(){function w(b,d){var a,g,f,e,c=this;this.map=b;d==u&&(d={});for(a in d)B.call(d,a)&&(g=d[a],this[a]=g);this.e=new this.constructor.g(this.map);this.n();this.b={};e=["click","zoom_changed","maptypeid_changed"];g=0;for(f=e.length;gd)return this;g=this.j.splice(d,1)[0];f=0;for(e=g.length;fa||this.b[b].splice(a,1);return this};c.clearListeners=function(b){this.b[b]=[];return this};c.trigger=function(){var b,d,a,g,f,e;d=arguments[0];b=2<=arguments.length?C.call(arguments,1):[];d=(a=this.b[d])!=u?a:[];e=[];g=0;for(f=d.length;gb;a=0<=b?++e:--e)a=this.circleStartAngle+a*g,c.push(new s.Point(d.x+f*Math.cos(a),d.y+f*Math.sin(a)));return c};c.v=function(b,d){var a,g,f,e,c;f=this.spiralLengthStart;a=0;c=[];for(g=e=0;0<=b?eb;g=0<=b?++e:--e)a+=this.spiralFootSeparation/f+5E-4*g,g=new s.Point(d.x+f*Math.cos(a),d.y+f*Math.sin(a)),f+=y*this.spiralLengthFactor/a,c.push(g);return c};c.F=function(b,d){var a,g,f,e,c, 15 | m,l,x,n;e=b._omsData!=u;(!e||!this.keepSpiderfied)&&this.unspiderfy();if(e||this.map.getStreetView().getVisible()||"GoogleEarthAPI"===this.map.getMapTypeId())return this.trigger("click",b,d);e=[];c=[];a=this.nearbyDistance;m=a*a;f=this.c(b.position);n=this.a;l=0;for(x=n.length;l=this.circleSpiralSwitchover?this.v(q,a).reverse():this.u(q,a);a=function(){var a,d,k,q=this;k=[];a=0;for(d=e.length;a 27 | **/ 28 | ?> 29 | '; 33 | include('include/page_footer.php'); 34 | ?> 35 | -------------------------------------------------------------------------------- /zabbix-geolocation/README.md: -------------------------------------------------------------------------------- 1 | zabbix-geolocation 2 | ================== 3 | 4 | Plugin de geolocalização para Zabbix 5 | 6 | 7 | Implementing Geolocation in Zabbix 8 | Zabbix - Extras 9 | 10 | 09/08/2013 11 | Launch! 12 | Geolocation vrs0.3.2 (version Kariri ) 13 | International Day of Indigenous People - August 2013 14 | Download Tarball vrs0.3.2 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.2.tar.gz 15 | New feature: 16 | PostgreSQL support 17 | 18 | 19 | Geolocation vrs 0.3.1 (version Sapucaí ) 20 | Carnival - February 2013 21 | Download Tarball vrs0.3.1 - http://www.aristoteles.eti.br/zabbix/zabbix-geolocalizacao-v0.3.tar.gz 22 | 23 | contacts : 24 | Leandro Alves Machado - leandro.machado@sspds.ce.gov.br 25 | Aristotle Araújo - aristoteles.araujo@sspds.ce.gov.br 26 | 27 | 28 | This is the first version available for Zabbix community. 29 | Soon be integrated with this installation package Zabbix - Extras 30 | 31 | Advantages of using the plugin : 32 | 33 | a. Reduces the time to create a map, it is not necessary to put a background image and add / configure all hosts . 34 | b . The image is dynamic , allowing zoom and other features by Google Maps 35 | c . Select the host in the combobox and zoom the local of host 36 | 37 | 38 | 1. INSTALLATION AT GUIDE MONITORING 39 | 40 | 1.1 Create the extras directory and unpack the tarball at zabbix folder 41 | 42 | cd /var/www/html/zabbix 43 | mkdir extras 44 | cd extras 45 | cp //zabbix-geolocation-v0.3.2.tar.gz . 46 | tar zxvf zabbix-geolocation-v0.3.2.tar.gz 47 | cd zabbix-geolocalizacao-v0.3.2 48 | cp geolocation/misc/geolocation.php /var/www/html/zabbix 49 | 50 | Set the directory permissions with the same user/group from zabbix, for example 51 | 52 | cd ../.. 53 | chown -R apache.apache extras 54 | 55 | 56 | 1.2 Creating the menu item 57 | 58 | Edit the file ../zabbix/include/menu.inc.php 59 | 60 | vi ../include/menu.inc.php 61 | 62 | Locate the line: 'label' => _('IT services') contained in the excerpt of code below, at the Monitoring menu: 63 | 64 | array( 65 | 'url' => 'srv_status.php' 66 | 'label' => _(' IT services'), 67 | 'force_disable_all_nodes' => true, 68 | 'sub_pages' => array('report3.php','chart5.php') 69 | ), 70 | 71 | After the excerpt above includes the code below 72 | 73 | array( 74 | 'url' => 'geolocation.php', 75 | 'label' => _('Geolocation') 76 | ), 77 | 78 | Save the file . 79 | 80 | This change creates the link Geolocation at Monitoring menu. 81 | Click Monitoring - > Geolocation to access the interface. 82 | 83 | The Interface has two ComboBox , the first are the Groups and Hosts 84 | and the second List the Hosts belonging to the selected group. 85 | The items in red are the hosts that have an incident. 86 | 87 | 1.2 Configuring php.ini: 88 | 89 | Edit the php.ini file , usually /etc/php.ini and uncomment the option short_open_tag to leaving the flag On 90 | 91 | vi /etc/php.ini 92 | 93 | short_open_tag=On 94 | Save the file and restart apache 95 | 96 | 97 | 1.3 Defining Default Group 98 | 99 | To set the default host group, change the line group in file ../zabbix/extras/geolocation/geolocation.conf 100 | informing the id of the desired Group. 101 | 102 | group=1 103 | 104 | One way to know the id of the Group is to open the interface 105 | Geolocation and look at the number in front of the desired group. 106 | 107 | 108 | 2 . INSTALLATION AT THE SCREEN GUIDE, VIA URL 109 | 110 | Click Configuration -> Screens -> Create Screen 111 | 112 | Name: Geolocation 113 | 114 | Click Save. 115 | 116 | Now click in Geolocation in the list of screens. 117 | 118 | Click Change to include the URL of geolocation 119 | 120 | Resource: url 121 | Url: http://IP-ou-Hostname-Zabbix/zabbix/extras/geolocation/index.php 122 | Width : 1028 123 | Height: 760 124 | Horizontal align: Center 125 | Vertical align: Middle 126 | 127 | Click Save. 128 | 129 | Click Monitoring -> Screens 130 | In the combobox of Screens, select : Geolocation to access the interface . 131 | 132 | 133 | 134 | 3 . REGISTER/CHANGE HOSTS FOR GEOLOCATION 135 | 136 | For showing hosts in Geolocation Map is required informing the latitude and longitude thereof. 137 | 138 | For this click Configuration -> Hosts and select the host you want to monitor, click the Host Inventory tab. 139 | 140 | Click Manual, fill Location latitude and Location longitude, and click Save. 141 | 142 | Fill out the latitude and longitude data in decimal format. Example: -22.951916, -43.210438 143 | 144 | To know the coordinates, find the location on Google, click the right mouse button and select "What is there here?". In the search bar appears latitude and longitude. 145 | 146 | Now repeat the process for all other hosts and return to Geolocation menu. 147 | 148 | 4 . DEPENDENCIES 149 | 150 | 4.1 fping 151 | The fping must be installed. 152 | 153 | Tip of Daniel Schaeffer : 154 | How to install fping for anyone who uses CentOS or RedHat 155 | http://www.tecmint.com/install-fping-icmp-program-on-rhel-centos-6-5-4/ 156 | 157 | 158 | MySQL 4.2 or PostgreSQL 159 | The current version works with MySQL or PostgreSQL. 160 | 161 | 162 | Good job to all . 163 | 164 | 8 ^ ) 165 | 166 | Aristotle Rego de Araújo 167 | aristoteles.araujo @ sspds.ce.gov.br 168 | aristoteles.araujo @ gmail.com 169 | 170 | Translation: 171 | André Déo - Zabbix-Brasil 172 | 13/11/2013 173 | --------------------------------------------------------------------------------