<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Arquivos postgres - Remontti</title>
	<atom:link href="https://blog.remontti.com.br/tag/postgres/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.remontti.com.br/tag/postgres</link>
	<description>rudimar@remontti</description>
	<lastBuildDate>Mon, 29 Aug 2022 15:17:04 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.remontti.com.br/wp-content/uploads/2024/09/icone-rr-80x80.png</url>
	<title>Arquivos postgres - Remontti</title>
	<link>https://blog.remontti.com.br/tag/postgres</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Instalação do Zabbix 5 LTS + Grafana 7/8 + NGINX + PostgreSQL + Notificação Telegram com Debian 10/11</title>
		<link>https://blog.remontti.com.br/5517</link>
					<comments>https://blog.remontti.com.br/5517#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Fri, 16 Apr 2021 20:08:16 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Bullseye]]></category>
		<category><![CDATA[buster]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian 11]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[telegram]]></category>
		<category><![CDATA[zabbix]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5517</guid>

					<description><![CDATA[<p>O Zabbix é uma solução de nível enterprise, de código aberto. O Zabbix é um software que monitora vários parâmetros da rede, dos servidores e da saúde dos serviços. Utiliza-se de um mecanismo flexível&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5517">Instalação do Zabbix 5 LTS + Grafana 7/8 + NGINX + PostgreSQL + Notificação Telegram com Debian 10/11</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL.png" alt="" width="720" height="340" class="alignnone size-full wp-image-5530" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL.png 720w, https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/CAPA-ZABBIX-GRAFANA-POSTGRESQL-520x245.png 520w" sizes="(max-width: 720px) 100vw, 720px" /><br />
O <strong>Zabbix</strong> é uma solução de nível enterprise, de código aberto. O Zabbix é um software que monitora vários parâmetros da rede, dos servidores e da saúde dos serviços. Utiliza-se de um mecanismo flexível de notificação que permite configurar alertas por e-mail entre outros como Telegram, para praticamente qualquer evento. As notificações permitem que se reaja rapidamente à problemas no ambiente. O Zabbix oferece excelentes recursos de relatórios e visualização de dados armazenados. Isso faz com que o Zabbix seja a ferramenta ideal para planejamento de capacidade.<br />
O <strong>Grafana</strong> é um software livre que permite a visualização de formato de dados métricos. Ele permite criar painéis e gráficos a partir de várias fontes, mas aqui iremos vamos aprender a integra-lo com o Zabbix.</p>
<h4>Requisitos se Debian 10 Buster</h4>
<p>&#8211; <a href="https://blog.remontti.com.br/2966" rel="noopener noreferrer" target="_blank">* Debian 10 instalação limpa</a><br />
&#8211; <a href="https://blog.remontti.com.br/5487" rel="noopener" target="_blank">* Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt</a> (Opcional phpPgAdmin + Letsencrypt)</p>
<h4>Requisitos se Debian 11 Bullseye </h4>
<p>&#8211; <a href="https://blog.remontti.com.br/5792" rel="noopener" target="_blank">Instalação do Debian 11 Bullseye limpa passo-a-passo</a><br />
&#8211; <a href="https://blog.remontti.com.br/5915" rel="noopener" target="_blank">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 11 Bullseye (LNPP)</a></p>
<h1>Instalação do Zabbix</h1>
<p>Para instalação do Zabbix vamos incluir o repositório do oficial do Zabbix.</p>
<pre class="remontti-code"># su -
# cd /tmp
# apt install wget</pre>
<p><strong>Repositório Debian 10</strong></p>
<pre class="remontti-code"># wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb
# dpkg -i zabbix-release_5.0-1+buster_all.deb</pre>
<p><strong>Repositório  Debian 11</strong></p>
<pre class="remontti-code"># wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-2+debian11_all.deb
# dpkg -i zabbix-release_5.0-2+debian11_all.deb</pre>
<p>Atualize o repositório e realize a instalação </p>
<pre class="remontti-code"># apt update ; apt upgrade
# apt install zabbix-server-pgsql zabbix-frontend-php zabbix-nginx-conf zabbix-agent</pre>
<p>Vamos criar uma base de dados chamada <strong>zabbix</strong> e um usuário também chamado de zabbix no PostgreSQL.<br />
Não esqueça de alterar a senha: Use o gerador de senha: <a href="https://senhasegura.remontti.com.br/" rel="noopener noreferrer" target="_blank">https://senhasegura.remontti.com.br/</a></p>
<pre class="remontti-code"># su - postgres
$ createuser --pwprompt zabbix
Digite a senha para a nova role:  &lt;SENHA ZABBIX&gt;
Digite-a novamente: &lt;SENHA ZABBIX&gt;
Senha: &lt;SENHA POSTGRES CASO TENHA DEFINIDO NA INSTALAÇÃO DO MESMO&gt;

$ createdb -O zabbix zabbix
Senha: &lt;SENHA POSTGRES&gt;</pre>
<p>Importe o esquema inicial e os dados. Você será solicitado a inserir a senha que foi criada anteriormente.</p>
<pre class="remontti-code">$ zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | psql -U zabbix -d zabbix &amp;&gt;/dev/null
Senha para usuário zabbix: : &lt;SENHA ZABBIX&gt;
$ exit</pre>
<p>Edite o arquivo zabbix_server.conf para informar os dados para conexão com do PostgreSQL.</p>
<pre class="remontti-code"># vim /etc/zabbix/zabbix_server.conf</pre>
<p>Procure por <strong># DBPassword=</strong> descomente e sete sua senha.</p>
<pre class="remontti-code">#...
DBPassword=&lt;SENHA ZABBIX&gt;
#...</pre>
<p>Ajuste o arquivo /etc/zabbix/php-fpm.conf, descomente e defina o fuso horário correto. <a href="https://secure.php.net/manual/pt_BR/timezones.america.php" rel="noopener noreferrer" target="_blank">timezone</a> Sua região</a>.</p>
<pre class="remontti-code"># vim /etc/zabbix/php-fpm.conf</pre>
<p>Exemplo:</p>
<pre class="remontti-code">; php_value[date.timezone] = Europe/Riga
php_value[date.timezone] = America/Sao_Paulo</pre>
<p>Este é modelo padrão, altere então para sua região, também irei alterar alguns valores padrões se quiser pode remover as conf do mod_php5.c </p>
<p>Ajuste as configurações do nginx.</p>
<pre class="remontti-code"># vim /etc/nginx/conf.d/zabbix.conf </pre>
<p>Deixei algumas linhas comentadas como exemplo, faça de acordo com sua necessidade.</p>
<pre class="remontti-code">server {
        listen 80;
        listen [::]:80;
        server_name    zabbix.remontti.com.br localhost;
        #server_name   OU_SEU_IP;

        # Metodo simples para quem quer rodar em uma determinada porta
        #listen 8181;
        #listen [::]:8181;
        #server_name     _;

        root    /usr/share/zabbix;
        index   index.php;

        # Desmomente para deixar restringido apenas para determinados prefixos
        #allow  192.168.87.0/24;
        #allow  127.0.0.1;
        #allow  2001:0db8::/32;
        #allow  ::1;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;
 
        location = /favicon.ico {
                log_not_found   off;
        }

        location / {
                try_files       $uri $uri/ =404;
        }

        location /assets {
                access_log      off;
                expires         10d;
        }

        location ~ /\.ht {
                deny            all;
        }

        location ~ /(api\/|conf[^\.]|include|locale) {
                deny            all;
                return          404;
        }

        location ~ [^/]\.php(/|$) {
                fastcgi_pass    unix:/var/run/php/zabbix.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index   index.php;

                fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;
                fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
                fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;

                include fastcgi_params;
                fastcgi_param   QUERY_STRING    $query_string;
                fastcgi_param   REQUEST_METHOD  $request_method;
                fastcgi_param   CONTENT_TYPE    $content_type;
                fastcgi_param   CONTENT_LENGTH  $content_length;

                fastcgi_intercept_errors        on;
                fastcgi_ignore_client_abort     off;
                fastcgi_connect_timeout         60;
                fastcgi_send_timeout            180;
                fastcgi_read_timeout            180;
                fastcgi_buffer_size             128k;
                fastcgi_buffers                 4 256k;
                fastcgi_busy_buffers_size       256k;
                fastcgi_temp_file_write_size    256k;
        }
}
</pre>
<p>Inicie o servidor Zabbix e os processos do agente e configure-os para que sejam iniciados durante o boot do sistema.</p>
<pre class="remontti-code"># systemctl enable zabbix-server zabbix-agent</pre>
<p><strong>Debian 10</strong></p>
<pre class="remontti-code"># systemctl restart zabbix-server zabbix-agent nginx php7.3-fpm</pre>
<p><strong>Debian 11</strong></p>
<pre class="remontti-code"># systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm</pre>
<p>Acesse em seu navegador <strong>http://seu_ip:porta</strong> ou <strong>http://zabbix.seudominio.com.br</strong></p>
<p><strong>Next Step</strong><br />
<img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/1.png" alt="" width="1325" height="698" class="alignnone size-full wp-image-5519" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/1.png 1325w, https://blog.remontti.com.br/wp-content/uploads/2021/04/1-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/1-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/1-768x405.png 768w" sizes="(max-width: 1325px) 100vw, 1325px" /></p>
<p>Se tudo estiver ok: <strong>Next step</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2.png" alt="" width="1213" height="1224" class="aligncenter size-full wp-image-4359" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2.png 1213w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-297x300.png 297w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-1015x1024.png 1015w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-150x150.png 150w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-768x775.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-2-80x80.png 80w" sizes="(max-width: 1213px) 100vw, 1213px" /></a></p>
<p>Selecione <strong>PostgreSQL</strong> e informe a <strong>senha do usuário zabbix </strong>criada anteriormente, clique em <strong>Next step</strong>.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/3.png" alt="" width="1325" height="698" class="alignnone size-full wp-image-5520" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/3.png 1325w, https://blog.remontti.com.br/wp-content/uploads/2021/04/3-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/3-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/3-768x405.png 768w" sizes="auto, (max-width: 1325px) 100vw, 1325px" /></p>
<p><strong>Next step</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4.png" alt="" width="1220" height="685" class="aligncenter size-full wp-image-4361" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4.png 1220w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4-300x168.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4-1024x575.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-4-768x431.png 768w" sizes="auto, (max-width: 1220px) 100vw, 1220px" /></a></p>
<p><strong>Next step</strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/5.png" alt="" width="1325" height="698" class="alignnone size-full wp-image-5521" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/5.png 1325w, https://blog.remontti.com.br/wp-content/uploads/2021/04/5-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/5-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/5-768x405.png 768w" sizes="auto, (max-width: 1325px) 100vw, 1325px" /></p>
<p><strong>Finish</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6.png" alt="" width="1220" height="685" class="aligncenter size-full wp-image-4363" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6.png 1220w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6-300x168.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6-1024x575.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-6-768x431.png 768w" sizes="auto, (max-width: 1220px) 100vw, 1220px" /></a></p>
<p>Entre com Usuário <strong>Admin</strong> e senha <strong>zabbix</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7.png" alt="" width="1220" height="685" class="aligncenter size-full wp-image-4364" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7.png 1220w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7-300x168.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7-1024x575.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-7-768x431.png 768w" sizes="auto, (max-width: 1220px) 100vw, 1220px" /></a></p>
<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8.png" alt="" width="1401" height="1137" class="aligncenter size-full wp-image-4365" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8.png 1401w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8-300x243.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8-1024x831.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zb5-8-768x623.png 768w" sizes="auto, (max-width: 1401px) 100vw, 1401px" /></a></p>
<p>Para dexa-lo em Português / Tema escuro:<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4388" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/zabbix-black-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<hr>
<p><strong><font color="red">Possível bug na instalação</font></strong><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX.jpg" alt="" width="1264" height="446" class="alignnone size-full wp-image-5704" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX.jpg 1264w, https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX-300x106.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX-1024x361.jpg 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/BUG_ZABBIX-768x271.jpg 768w" sizes="auto, (max-width: 1264px) 100vw, 1264px" /><br />
Caso se deparar com essa tela não se assuste, faça o seguinte:</p>
<pre class="remontti-code"># touch /etc/zabbix/web/zabbix.conf.php
# chown www-data. /etc/zabbix/web/zabbix.conf.php</pre>
<p>De um [Back]  depois [Next] q é sucesso!</p>
<hr>
<h1>Alertas no Telegram</h1>
<p>No Zabbix 5 temos o Telegram/Webhook, então bora aprender mexer nisso! Mas antes de mais nada será necessário criarmos um bot no Telegram.</p>
<p><strong>Criando Bot no telegram</strong></p>
<p>Abra o Telegram e procure por <a href="https://t.me/BotFather" rel="noopener noreferrer" target="_blank"><strong>@BotFather</strong></a>.<br />
Inicie a conversa com ele.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2823" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram1.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2826" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram2.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2827" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram3.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p>&#8211; Digite o comando <strong>/newbot</strong> para iniciar a criação de um novo bot.<br />
&#8211; Após o comando você vai dar um nome para seu bot. Ex.: <em>&#8220;Bot Legal RR&#8221;</em>.<br />
&#8211; Em seguida é necessário digitar o nome de usuário para o bot, sendo obrigatório terminar com <strong>bot</strong>. Ex.: <em>&#8220;legallrr_bot&#8221;</em>.<br />
&#8211; Ao finalizar você receber informações com seu TOKEN, que vamos utilizar em seguida.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2830" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram4.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2833" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram5.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2835" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram6.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p>Neste exemplo nosso token para acessar a API HTTP ficou:<br />
<strong>757396508:AAHpaoyVN-95maOCax1vDPDQBnSaZd9P5r0</strong></p>
<p>Agora que o token abra o menu <strong>Administração</strong> &#8211;> <strong>Tipos de mídias</strong></p>
<p>Localize o Telegram e clique nele<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1.png" alt="" width="1680" height="968" class="aligncenter size-full wp-image-4386" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-300x173.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-1024x590.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-768x443.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-1-1536x885.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Edite o ParseMode para HTML e Token para o token q você acabou de criar. Marque Process tags.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2.png" alt="" width="1680" height="885" class="aligncenter size-full wp-image-4387" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-1024x539.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-768x405.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-2-1536x809.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Neste momento que escrevo na própria descrição da mídia telegram ele recomenda você add o bot @myidbot para descobrir o seu ID, mas parace que este bot está &#8220;dormindo&#8221;. Vamos ao metodos tradicional. Você pode receber notificações direta do seu bot ou então adiciono-lo em um grupo. </p>
<p>Procure pelo seu bot e comece uma conversa com ele e envie uma mensagem de teste para o mesmo, pois vamos precisar descobrir o ID do seu usuário, para que ele possa lhe enviar as mensagens.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2837" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram7.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2838" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram8.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p>Abra em seu seu navegador a seguinte URL <em>https://api.telegram.org/bot<strong>TOKEN</strong>/getUpdates</em> para descobrir o ID do usuário que enviou a mensagem ou de um grupo.<br />
Ex.: <font size="2"><em>https://api.telegram.org/bot<strong><font color="red">757396508:AAHpaoyVN-95maOCax1vDPDQBnSaZd9P5r0</font></strong>/getUpdates</em></font></p>
<p><strong>:: Chat privado ::</strong></p>
<pre class="remontti-code">{&quot;ok&quot;:true,&quot;result&quot;:[{
	&quot;update_id&quot;:649208620,&quot;message&quot;:{
		&quot;message_id&quot;:2,&quot;from&quot;:{&quot;id&quot;:221122111,&quot;is_bot&quot;:false,&quot;first_name&quot;:&quot;Rudimar&quot;,&quot;last_name&quot;:&quot;Remontti&quot;,&quot;username&quot;:&quot;remontti&quot;,&quot;language_code&quot;:&quot;pt-br&quot;},
		&quot;chat&quot;:{&quot;id&quot;:999999999,&quot;first_name&quot;:&quot;Rudimar&quot;,&quot;last_name&quot;:&quot;Remontti&quot;,&quot;username&quot;:&quot;remontti&quot;,&quot;type&quot;:&quot;private&quot;},
		&quot;date&quot;:1541210279,&quot;text&quot;:&quot;Testando&quot;
	}
}]}</pre>
<p>ID do chat privado: <strong>999999999</strong></p>
<p>Se desejar criar um grupo também, basta adicionar seu bot a ele, após adiciona-lo envia uma mensagem como <strong>/teste</strong> para que possamos coletar o ID do grupo.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2843" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram9.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a> <a href="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10.jpg" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10-169x300.jpg" alt="" width="169" height="300" class="alignnone size-medium wp-image-2844" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10-169x300.jpg 169w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10-576x1024.jpg 576w, https://blog.remontti.com.br/wp-content/uploads/2018/11/zabbix_bot_telegram10.jpg 720w" sizes="auto, (max-width: 169px) 100vw, 169px" /></a></p>
<p><strong>:: Chat em Grupo ::</strong></p>
<pre class="remontti-code">{&quot;ok&quot;:true,&quot;result&quot;:[{
	&quot;update_id&quot;:649208622,&quot;message&quot;:{&quot;message_id&quot;:4,&quot;from&quot;:{
		&quot;id&quot;:221122111,&quot;is_bot&quot;:false,&quot;first_name&quot;:&quot;Rudimar&quot;,&quot;last_name&quot;:&quot;Remontti&quot;,&quot;username&quot;:&quot;remontti&quot;,&quot;language_code&quot;:&quot;pt-br&quot;},
		&quot;chat&quot;:{&quot;id&quot;:-88888888888,&quot;title&quot;:&quot;Grupo Legal&quot;,&quot;type&quot;:&quot;group&quot;,&quot;all_members_are_administrators&quot;:true
	},&quot;date&quot;:1541210975,&quot;text&quot;:&quot;/teste&quot;,&quot;entities&quot;:[{&quot;offset&quot;:0,&quot;length&quot;:6,&quot;type&quot;:&quot;bot_command&quot;}
}]}</pre>
<p>ID do chat grupo: <strong>-88888888888</strong></p>
<p>Atenção para os <strong>grupos</strong> que sempre tem um sinal &#8220;-&#8221; na frente do ID.</p>
<p>Com o ID do grupo/usuário precisamos vincular ao usuário do Zabbix (Neste caso Admin)<br />
<strong>Administração</strong> ⇒ <strong>Usuários</strong> Clique no usuário <strong>Admin</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3.png" alt="" width="1680" height="541" class="aligncenter size-full wp-image-4389" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-300x97.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-1024x330.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-768x247.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-3-1536x495.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Com as opções do usuário aberto clique na aba <strong>Mídia</strong> em seguita clique no <strong>Adicionar</strong>, selecione o Tipo Telegram e insira o em Enviar para o ID.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5.png" alt="" width="1680" height="624" class="aligncenter size-full wp-image-4390" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-300x111.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-1024x380.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-768x285.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-5-1536x571.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a> </p>
<p>Atualize<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6.png" alt="" width="1680" height="269" class="aligncenter size-full wp-image-4391" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-300x48.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-1024x164.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-768x123.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-6-1536x246.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Agora vamos criar a ação que fará o envios dos alertas.<br />
<strong>Configurações</strong> ⇒ <strong>Ações</strong> ⇒ <strong>Criar ação</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7.png" alt="" width="1680" height="495" class="aligncenter size-full wp-image-4392" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-300x88.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-1024x302.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-768x226.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-7-1536x453.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>De um nome para sua ação<br />
Em Condição clique em adicionar: Selecione <strong>Incidente suprimido</strong> e marque <strong>Não</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8.png" alt="" width="1680" height="527" class="aligncenter size-full wp-image-4393" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-300x94.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-1024x321.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-768x241.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-8-1536x482.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Na aba <strong>Operações</strong> primeiro item <strong>Operações</strong> clique em <strong>adicionar</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9.png" alt="" width="1680" height="470" class="aligncenter size-full wp-image-4394" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-300x84.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-1024x286.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-768x215.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-9-1536x430.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p><strong>Enviar para usuário</strong>: Selecione o <strong>Admin</strong><br />
Enviar apenas para: <strong>Telegram</strong><br />
Marque <strong>Custom message</strong>, preencha com:<br />
<strong>Assunto</strong>:</p>
<pre class="remontti-code"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Problema: &lt;b&gt;{HOST.NAME}&lt;/b&gt;</pre>
<p><strong>Mensagem</strong></p>
<pre class="remontti-code">&lt;code&gt;{EVENT.NAME}&lt;/code&gt;
&lt;b&gt;{ITEM.NAME1}&lt;/b&gt; &lt;i&gt;{ITEM.VALUE1}&lt;/i&gt;

Tempo do evento: {EVENT.AGE} 
&lt;a href=&quot;{HOST.IP}&quot;&gt;{HOST.IP}&lt;/a&gt;
&lt;i&gt;{EVENT.SEVERITY}&lt;/i&gt;</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4395" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-10-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>No item <strong>Operações de recuperação</strong> faremos praticamente o mesmo:</p>
<p><strong>Assunto</strong>:</p>
<pre class="remontti-code"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Resolvido: &lt;b&gt;{HOST.NAME}&lt;/b&gt;</pre>
<p><strong>Mensagem padrão</strong></p>
<pre class="remontti-code">&lt;code&gt;{EVENT.NAME}&lt;/code&gt;
&lt;b&gt;{ITEM.NAME1}&lt;/b&gt; &lt;i&gt;{ITEM.VALUE1}&lt;/i&gt;

Tempo do evento: {EVENT.AGE} 
&lt;a href=&quot;{HOST.IP}&quot;&gt;{HOST.IP}&lt;/a&gt;
&lt;i&gt;{EVENT.SEVERITY}&lt;/i&gt;
ID&#039;s: {ITEM.ID}/{EVENT.ID}</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4396" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-11-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>No item <strong>Operações de atualização</strong><br />
<strong>Assunto</strong>:</p>
<pre class="remontti-code">Problema atualizado: {EVENT.NAME}</pre>
<p><strong>Mensagem padrão</strong></p>
<pre class="remontti-code">{USER.FULLNAME} {EVENT.UPDATE.ACTION} problema em {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}
O status atual do problema é {EVENT.STATUS}, reconhecido: {EVENT.ACK.STATUS}.</pre>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12.png" alt="" width="1680" height="836" class="aligncenter size-full wp-image-4397" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-300x149.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-1024x510.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-768x382.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-12-1536x764.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Operações configurada, clique em atualizar.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13.png" alt="" width="1680" height="544" class="aligncenter size-full wp-image-4398" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-300x97.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-1024x332.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-768x249.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/tele-13-1536x497.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a></p>
<p>Pronto! Agora precisamos gerar um incidente para ver se nosso alerta será enviado para o Telegram.</p>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-3080" srcset="https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14-576x1024.png 576w, https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14-169x300.png 169w, https://blog.remontti.com.br/wp-content/uploads/2019/07/zabbix-4.2-debian-10-buster-telegram-bot-14.png 720w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>O sistema de envio de mensagem está concluído! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h1>Grafana v7/v8</h1>
<p><a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana.png" alt="" width="1680" height="1050" class="aligncenter size-full wp-image-4367" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana.png 1680w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-300x188.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1024x640.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-768x480.png 768w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1536x960.png 1536w" sizes="auto, (max-width: 1680px) 100vw, 1680px" /></a><br />
Pacotes necessários:</p>
<pre class="remontti-code"># apt install gnupg2 apt-transport-https software-properties-common wget</pre>
<p><strong>Para versão 7.5.x:</strong> (Não recomendado)</p>
<pre class="remontti-code"># cd /tmp/
# wget https://dl.grafana.com/oss/release/grafana_7.5.11_amd64.deb
# apt install ./grafana_7.5.11_amd64.deb
# grafana-cli plugins update-all
# systemctl restart grafana-server</pre>
<p><strong>Para versão 8.2.x:</strong> (Não recomendado)</p>
<pre class="remontti-code"># cd /tmp/
# wget https://dl.grafana.com/oss/release/grafana_8.2.7_amd64.deb
# apt install ./grafana_8.2.7_amd64.deb
# grafana-cli plugins update-all
# systemctl restart grafana-server</pre>
<p>Outras versões consulte <a href="https://grafana.com/grafana/download?edition=oss" rel="noopener" target="_blank">https://grafana.com/grafana/download?edition=oss</a></p>
<p><strong>Para Ultima versão v8.X:</strong> (Recomendado)<br />
Vamos baixar a key do repositório e adiciona-lo </p>
<pre class="remontti-code"># wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
# echo &quot;deb https://packages.grafana.com/oss/deb stable main&quot; | tee -a /etc/apt/sources.list.d/grafana.list</pre>
<p>Atualize o repositório e instale o grafana</p>
<pre class="remontti-code"># apt update
# apt install grafana</pre>
<p>Antes de iniciar o grafana, se deseja alterar a porta padrão <strong>3000</strong> (recomendo) edite:</p>
<pre class="remontti-code"># vim /etc/grafana/grafana.ini</pre>
<p>Localize <strong>http_port</strong> e defina a porta de sua escolha.</p>
<pre class="remontti-code"># The http port  to use
;http_port = 3000</pre>
<p>Exemplo:</p>
<pre class="remontti-code">http_port = 53000</pre>
<p>Instale o <strong>Plugin Zabbix</strong></p>
<pre class="remontti-code"># grafana-cli plugins install alexanderzobnin-zabbix-app</pre>
<p>É recomendado que mensalmente você faça atualizações dos plugins instalados, com o comando:</p>
<pre class="remontti-code"># grafana-cli plugins update-all</pre>
<p>Agora sim colocamos o Grafana para iniciar junto com a inicialização, ativamos e inicializamos o serviço:</p>
<pre class="remontti-code"># systemctl daemon-reload
# systemctl enable grafana-server
# systemctl start grafana-server</pre>
<p>Acesse em seu navegador <strong>http://IP_URL:3000</strong> ou pela porta que você alterou. O nome de usuário padrão é admin e a senha padrão é admin.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1.png" alt="" width="1370" height="781" class="aligncenter size-full wp-image-4368" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1-300x171.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1-1024x584.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-1-768x438.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Ao fazer login pela primeira vez, você será solicitado a alterar sua senha.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2.png" alt="" width="1370" height="732" class="aligncenter size-full wp-image-4369" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2-300x160.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2-1024x547.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-2-768x410.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Uhull <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3.png" alt="" width="1370" height="720" class="aligncenter size-full wp-image-4370" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3-300x158.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3-1024x538.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-3-768x404.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<h4>Integração do grafana com o Zabbix</h4>
<p>Acesse o Configuration &#8211;> Plugins:<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7.png" alt="" width="1366" height="633" class="aligncenter size-full wp-image-4374" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7.png 1366w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7-300x139.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7-1024x475.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-7-768x356.png 768w" sizes="auto, (max-width: 1366px) 100vw, 1366px" /></a></p>
<p>Localize o Zabbix e clique no mesmo<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5.png" alt="" width="1370" height="688" class="aligncenter size-full wp-image-4372" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5-300x151.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5-1024x514.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-5-768x386.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Agora ative clicando em <strong>Enable</strong>.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6.png" alt="" width="1370" height="688" class="aligncenter size-full wp-image-4373" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6-300x151.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6-1024x514.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-6-768x386.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Volte em Configuration &#8211;> Data Sources<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8.png" alt="" width="1366" height="633" class="aligncenter size-full wp-image-4375" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8.png 1366w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8-300x139.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8-1024x475.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-8-768x356.png 768w" sizes="auto, (max-width: 1366px) 100vw, 1366px" /></a></p>
<p>Clique em <strong>Add data source</strong>.<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9.png" alt="" width="1370" height="639" class="aligncenter size-full wp-image-4376" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9-300x140.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9-1024x478.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-9-768x358.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Uma nova tela com varias fontes, localize Zabbix e clique em <strong>Select</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10.png" data-rel="lightbox-gallery-0VKCb6Z4" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10.png" alt="" width="1370" height="639" class="aligncenter size-full wp-image-4377" srcset="https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10.png 1370w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10-300x140.png 300w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10-1024x478.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2020/05/grafana-10-768x358.png 768w" sizes="auto, (max-width: 1370px) 100vw, 1370px" /></a></p>
<p>Nas opções <strong>HTTP</strong> em <strong>URL</strong> informe o endereço do seu servidor Zabbix <strong>http://IP_URL/api_jsonrpc.php</strong>. Em <strong>Access</strong> selecione <strong>Browser</strong>. Em <strong>Zabbix API details</strong> informe seu usuário e senha do Zabbix e selecione a versão correspondente.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a.png" alt="" width="1043" height="1384" class="alignnone size-full wp-image-5524" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a.png 1043w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a-226x300.png 226w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a-772x1024.png 772w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-a-768x1019.png 768w" sizes="auto, (max-width: 1043px) 100vw, 1043px" /></p>
<p>Role até o final e e clique em <strong>Save &#038; Test</strong> Se tudo ocorreu bem uma altera positivo com<strong>&#8220;Zabbix API version: 5.x.x&#8221;</strong> aparecerá.</p>
<p>Você pode também pode fazer uma conexão PostgreSQL com o banco de dados do zabbix, para tornar as coisas mais rápidas. Para isso basta &#8220;Add data source&#8221; pesquisar por PostgreSQL, então basta informa nome do banco, usuário e senha.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b.png" alt="" width="1043" height="1320" class="alignnone size-full wp-image-5525" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b.png 1043w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b-237x300.png 237w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b-809x1024.png 809w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-b-768x972.png 768w" sizes="auto, (max-width: 1043px) 100vw, 1043px" /></p>
<p>Vá para as configurações do data source do zabbix, localize <strong>Direct DB Connection</strong>, ative-o e selecione <strong>PostgreSQL</strong>.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c.png" alt="" width="1040" height="501" class="alignnone size-full wp-image-5526" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c.png 1040w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c-300x145.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c-1024x493.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/graf-c-768x370.png 768w" sizes="auto, (max-width: 1040px) 100vw, 1040px" /></p>
<p>Agora vem a parte mais &#8220;chata/legal&#8221; que é você montar seus gráficos, como isso é algo bem peculiar de cada um, o intuito aqui era ensinar instalar. Recomendo a leitura de <a href="https://alexanderzobnin.github.io/grafana-zabbix/guides/gettingstarted/" rel="noopener noreferrer" target="_blank">Introdução ao Grafana-Zabbix</a> do autor do plugin.</p>
<h3>Bônus &#8211; Proxy Nginx grafana</h3>
<pre class="remontti-code"># vim /etc/nginx/sites-available/grafana.conf</pre>
<p>Adicione:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    server_name grafana.remontti.com.br;
  
    location / {
        proxy_pass http://localhost:53000;
        proxy_set_header   Host $host;
    }
}</pre>
<p>Cria o link para sites-enabled em seguida verifique as configurações e reinicie o serviço.</p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/grafana.conf /etc/nginx/sites-enabled/
# nginx -t
# systemctl restart nginx</pre>
<p>Simples né? Gostou e quer me ajudar? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Abraço!</p>
<p>Fontes:<br />
https://www.zabbix.com/download<br />
https://www.zabbix.com/documentation/<br />
https://grafana.com/docs/grafana/latest/installation/debian/<br />
https://grafana.com/grafana/plugins/alexanderzobnin-zabbix-app<br />
https://alexanderzobnin.github.io/grafana-zabbix/configuration/<br />
https://core.telegram.org/bots</p>
<p>O post <a href="https://blog.remontti.com.br/5517">Instalação do Zabbix 5 LTS + Grafana 7/8 + NGINX + PostgreSQL + Notificação Telegram com Debian 10/11</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5517/feed</wfw:commentRss>
			<slash:comments>28</slash:comments>
		
		
			</item>
		<item>
		<title>Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 10 Buster (LNPP)</title>
		<link>https://blog.remontti.com.br/5487</link>
					<comments>https://blog.remontti.com.br/5487#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Wed, 07 Apr 2021 20:56:22 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[buster]]></category>
		<category><![CDATA[certificado]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debian 10]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[letsencrypt]]></category>
		<category><![CDATA[LNMP]]></category>
		<category><![CDATA[lnpp]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[pgadmin]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[phpMyAdmin]]></category>
		<category><![CDATA[phppgadmin]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[postgresql]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=5487</guid>

					<description><![CDATA[<p>Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/5487">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 10 Buster (LNPP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP.png" alt="" width="720" height="340" class="alignnone size-full wp-image-5514" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP.png 720w, https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP-300x142.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/NGINX-LNNP-520x245.png 520w" sizes="auto, (max-width: 720px) 100vw, 720px" /><br />
Neste tutorial vamos configurar um servidor web com NGINX (lê-se “engine x”), o concorrente do Apache. NGINX é um servidor web (HTTP e IMAP/POP3/Proxy) rápido, leve e com inúmeras possibilidades de configuração para melhor performance. O Apache, sem dúvidas, é o servidor web mais popular. No entanto, o NGINX a cada ano ganha mais popularidade e está sendo a preferência dos novos projetos. Também estarei instalando o banco de dados PostgreSQL e phpPgAdmin como gerenciador web. </p>
<p>Distribuição utilizada: <strong><a href="https://blog.remontti.com.br/2966" rel="noopener noreferrer" target="_blank">Debian 10 Stretch / Instalação Limpa</a></strong></p>
<h3>NGINX</h3>
<p><a href="https://www.nginx.com" rel="noopener" target="_blank">https://www.nginx.com</a></p>
<pre class="remontti-code"># apt install nginx</pre>
<p>Acesse agora em seu navegador http://IP-SERVIDOR/<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png" alt="" width="1100" height="310" class="alignnone size-full wp-image-5467" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1.png 1100w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-300x85.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-1024x289.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx1-768x216.png 768w" sizes="auto, (max-width: 1100px) 100vw, 1100px" /><br />
Se você acessar um diretório que não existe um erro dizendo que não existe, e junto informações que não é legal aparecer.<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png" alt="" width="1036" height="296" class="alignnone size-full wp-image-5468" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2.png 1036w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-300x86.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-1024x293.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx2-768x219.png 768w" sizes="auto, (max-width: 1036px) 100vw, 1036px" /><br />
Vamos remover assinatura do nginx onde ele exibe a versão do mesmo. Ninguém precisa saber! Correto?</p>
<pre class="remontti-code"># sed -i &#039;s/# server_tokens/server_tokens/&#039; /etc/nginx/nginx.conf
# systemctl restart nginx</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png" alt="" width="712" height="157" class="alignnone size-full wp-image-5469" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3.png 712w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx3-300x66.png 300w" sizes="auto, (max-width: 712px) 100vw, 712px" /></p>
<p>Pronto nosso NGINX está rodando! </p>
<h3>PostgreSQL</h3>
<pre class="remontti-code"># apt install postgresql postgresql-contrib</pre>
<p>Torne-se o usuário postgres, para poder criar o banco de dados.</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Execute para entrar no terminal de comandos do banco.</p>
<pre class="remontti-code">$ psql</pre>
<p>Para definir a senha do usuário postgres e instalar o adminpack.</p>
<pre class="remontti-code">postgres=# \password postgres
Digite nova senha para postgres: 
Digite-a novamente:
postgres=# CREATE EXTENSION adminpack;
CREATE EXTENSION
postgres=# \q 
$ exit</pre>
<p>Ajustes no pg_hba.conf, assim toda alteração será necessaria validação do postgres com a senha que acabou de definir.</p>
<pre class="remontti-code"># vim /etc/postgresql/11/main/pg_hba.conf</pre>
<p>Altere as seguintes linhas: </p>
<pre class="remontti-code">local   all             postgres                                peer
local   all             all                                     peer</pre>
<p>Para:</p>
<pre class="remontti-code">local   all             postgres                                md5
local   all             all                                     md5</pre>
<p><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png" alt="" width="1010" height="268" class="alignnone size-full wp-image-5501" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres.png 1010w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-300x80.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres-768x204.png 768w" sizes="auto, (max-width: 1010px) 100vw, 1010px" /><br />
Reinicie o postgres</p>
<pre class="remontti-code"># systemctl restart postgresql</pre>
<p>Volte para o postgres</p>
<pre class="remontti-code"># su - postgres</pre>
<p>Agora para toda ação será necessário autenticar.</p>
<pre class="remontti-code">$ psql 
Senha para usuário postgres: !!SUA_SENHA!!
psql (11.11 (Debian 11.11-0+deb10u1))
Digite &quot;help&quot; para ajuda.
postgres-# \q</pre>
<p>Para demonstração irei criar um banco/usuário teste, não esqueça de alterar a senha.</p>
<pre class="remontti-code">$ createuser --pwprompt teste
Digite a senha para a nova role: &lt;&lt; NOVA SENHA PARA O USUÁRIO TESTE
Digite-a novamente: &lt;&lt; REPITA
Senha: &lt;&lt; SENHA DO QUE SETOU ANTES  NO COMANDO &quot;\password postgres&quot;</pre>
<p>Agora crie o  banco e vincule ao usuário.</p>
<pre class="remontti-code">$ createdb -O teste meubd
Senha: &lt;&lt;&lt; SENHA DO POSTGRES </pre>
<p>Verifique se o mesmo foi criado.</p>
<pre class="remontti-code">$ psql -l 
Senha para usuário postgres: 
                               Lista dos bancos de dados
   Nome    |   Dono   | Codificação |   Collate   |    Ctype    | Privilégios de acesso 
-----------+----------+-------------+-------------+-------------+-----------------------
 meubd     | teste    | UTF8        | pt_BR.UTF-8 | pt_BR.UTF-8 | 
....
....</pre>
<p>Acessamos agora o bd teste.</p>
<pre class="remontti-code">$ psql -U teste -d meubd
Senha para usuário postgres: 
psql (11.11 (Debian 11.11-0+deb10u1))
Digite &quot;help&quot; para ajuda.

meubd=&gt;</pre>
<p>Vamos fazer uma "brincadeira" só para testar, criaremos uma tabela e inseriremos dados nela.</p>
<pre class="remontti-code">meubd=&gt; CREATE TABLE doacao ( id int,nome text, valor text );
meubd=&gt; INSERT INTO doacao (id,nome,valor) values (1,&#039;Rudimar Remontti&#039;,&#039;R$ 5,00&#039;); 
meubd=&gt; SELECT * FROM doacao;

 id |       nome       |  valor  
----+------------------+---------
  1 | Rudimar Remontti | R$ 5,00

meubd=&gt; \q</pre>
<p>Se deseja remover o banco/usuário teste.</p>
<pre class="remontti-code">$ dropdb meubd
$ dropuser teste</pre>
<p>Volte para root</p>
<pre class="remontti-code">$ exit</pre>
<h3>PHP7</h3>
<p>Incluirei algumas extensões do PHP que são normalmente utilizada também na instalação.</p>
<pre class="remontti-code"># apt install php php-{fpm,cli,mysql,pear,gd,gmp,bcmath,mbstring,curl,xml,zip,json,pgsql}</pre>
<p>Agora vamos fazer a "integração" do PHP com o NGINX. Moveremos o arquivo defaul.</p>
<pre class="remontti-code"># mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original</pre>
<p>Crie um novo:</p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Ajuste:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<p>Teste a configuração se não tem nada errado e restart os serviços:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx php7.3-fpm</pre>
<p>Vamos criar um arquivo em PHP para testa se nosso NGINX está interpretando o PHP.</p>
<pre class="remontti-code"># echo &#039;&lt;?php phpinfo();&#039; &gt;&gt; /var/www/html/teste.php</pre>
<p>Acesse em seu navegador http://IP-SERVIDOR/teste.php<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7.png" alt="" width="1173" height="899" class="alignnone size-full wp-image-5473" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7.png 1173w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-300x230.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-1024x785.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/nginx-php7-768x589.png 768w" sizes="auto, (max-width: 1173px) 100vw, 1173px" /><br />
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Nosso servidor WEB com PHP está funcionando! </p>
<p>Exemplo para multiplos domínios/subdomínios </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub1.conf</pre>
<p>Neste ex: vou representar o <em>sub1.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub1;
    index index.php index.html index.htm;

    server_name sub1.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<pre class="remontti-code"># vim /etc/nginx/sites-available/sub2e3.conf</pre>
<p>Neste ex: vou representar o <em>sub2.remontti.com.br</em> e <em>sub3.remontti.com.br</em></p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/sub2e3;
    index index.php index.html index.htm;

    server_name sub2.remontti.com.br sub3.remontti.com.br;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}</pre>
<p>Link os arquivos no diretório "/etc/nginx/sites-available"  que será carregado as novas configurações </p>
<pre class="remontti-code"># ln -s /etc/nginx/sites-available/sub1.conf /etc/nginx/sites-enabled/
# ln -s /etc/nginx/sites-available/sub2e3.conf /etc/nginx/sites-enabled/</pre>
<p>Crie os diretórios referente a cada <strong>server_name</strong>.</p>
<pre class="remontti-code"># mkdir /var/www/sub1
# mkdir /var/www/sub2e3
# echo &#039;&lt;?php echo &quot;Olá mundo do sub1!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub1/index.php
# echo &#039;&lt;?php echo &quot;Olá mundo do sub2e3!&quot;; ?&gt;&#039; &gt;&gt; /var/www/sub2e3/index.php
</pre>
<p>Verifique se não tem nenhum erro e reinicie o serviço:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<h3>phpPgAdmin</h3>
<p>O phppgadmin até pode ser instalado via apt, porém seu empacotamento esta na versão 5, vou baixar a versão mais recente direta do <a href="https://github.com/phppgadmin/phppgadmin/releases" rel="noopener" target="_blank">https://github.com/phppgadmin/phppgadmin/releases</a> hoje (abril 2021) na versão 7.13.0</p>
<pre class="remontti-code"># apt install wget 
# cd /tmp/
# wget https://github.com/phppgadmin/phppgadmin/releases/download/REL_7-13-0/phpPgAdmin-7.13.0.tar.gz
# tar vxf phpPgAdmin-7.13.0.tar.gz
# mv /tmp/phpPgAdmin-7.13.0 /usr/share/phppgadmin</pre>
<p>Ajustes no config.inc.php</p>
<pre class="remontti-code"># vim /usr/share/phppgadmin/conf/config.inc.php</pre>
<p>Localize as linhas e ajuste:</p>
<pre class="remontti-code">$conf[&#039;servers&#039;][0][&#039;host&#039;] = &#039;localhost&#039;;
$conf[&#039;extra_login_security&#039;] = false;
$conf[&#039;owned_only&#039;] = true;</pre>
<p>Para torna-lo acessível altere o arquivo de configuração do seu NGINX, no exemplo vou colocar no arquivo default, mas você poderia estar configurando em seus domínios. </p>
<pre class="remontti-code"># vim /etc/nginx/sites-available/default</pre>
<p>Adicione as linhas destacadas:</p>
<pre class="remontti-code">server {
    listen 80;
    listen [::]:80;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }

    location ^~ /phppgadmin {
        root /usr/share;
        try_files $uri $uri/ =404;

        #allow  192.168.87.0/24;
        #allow  2001:0db8::/32;
        #deny   all;
        #error_page  403   http://www.remontti.com.br;

        location ~ .php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        }

    }

}</pre>
<p>Se deseja tonar o phppgadmin acessível apenas de alguns endereços IPs (RECOMENDO) basta descomentar as linhas, e incluir seus prefixos. O error_page é para que quando a o acessante levar um proibido seja direcionado para um site.</p>
<pre class="remontti-code">allow  192.168.87.0/24;
allow  2001:0db8::/32;
deny   all;
error_page  403   http://www.remontti.com.br;</pre>
<p>Verifique se não tem nenhum erro e reinicie o serviço:</p>
<pre class="remontti-code"># nginx -t
# systemctl restart nginx</pre>
<p>Basta acessar http://IP-SERVIDOR/phppgadmin<br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7.png" alt="" width="1033" height="340" class="alignnone size-full wp-image-5495" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7.png 1033w, https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7-300x99.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7-1024x337.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/phppgadmin7-768x253.png 768w" sizes="auto, (max-width: 1033px) 100vw, 1033px" /><br />
<img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2.png" alt="" width="1401" height="576" class="alignnone size-full wp-image-5511" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2.png 1401w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2-300x123.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2-1024x421.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/04/postgres2-768x316.png 768w" sizes="auto, (max-width: 1401px) 100vw, 1401px" /></p>
<h3>LETSENCRYPT</h3>
<p>Criando certificado valido para nossos domínios.</p>
<pre class="remontti-code"># apt install letsencrypt python-certbot-nginx</pre>
<p>Tenha seu(s) domínio(s) configurado em /etc/nginx/sites-enabled/</p>
<pre class="remontti-code"># letsencrypt</pre>
<p>Retorno do questionário:</p>
<pre class="remontti-code">Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter &#039;c&#039; to
cancel): dev@null.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let&#039;s Encrypt project and the non-profit
organization that develops Certbot? We&#039;d like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: sub1.remontti.com.br
2: sub2.remontti.com.br   &lt;&lt; CASO VOCÊ TENHA MAIS DE UM SUB CONFIGURADO
3: sub3.remontti.com.br    &lt;&lt; IRÁ APARECER AQUI 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter &#039;c&#039; to cancel): 1 &lt;&lt; ESCOLHA QUAIS VC DESEJA
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for sub1.remontti.com.br
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/sub1.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you&#039;re confident your site works on HTTPS. You can undo this
change by editing your web server&#039;s configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press &#039;c&#039; to cancel): 2 &lt;&lt; SE QUISER FORCAR SEMPRE HTTPS
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/sub1.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled
https://sub1.remontti.com.br

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=sub1.remontti.com.br
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/sub1.remontti.com.br/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/sub1.remontti.com.br/privkey.pem
   Your cert will expire on 2021-07-05. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the &quot;certonly&quot; option. To non-interactively renew *all* of
   your certificates, run &quot;certbot renew&quot;
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let&#039;s Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le
</pre>
<p>Você pode também criar o certificado diretamente para um domínio. </p>
<pre class="remontti-code"># letsencrypt --authenticator standalone --installer nginx -d sub1.remontti.com.br</pre>
<p>Dica, se desejar desativar o TLS1.0 e TLS1.1 após criar um certificado um arquivo é criado /etc/letsencrypt/options-ssl-apache.conf, então edite e inclua no SSLProtocol TLSv1 -TLSv1.1</p>
<pre class="remontti-code"># vim /etc/letsencrypt/options-ssl-apache.conf</pre>
<p>Ficando</p>
<pre class="remontti-code">#SSLProtocol            all -SSLv2 -SSLv3
SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1</pre>
<p>Reinicie o Apache:</p>
<pre class="remontti-code"># systemctl restart apache2</pre>
<p>Para testar acesse: <a href="https://www.cdn77.com/tls-test/" rel="noopener" target="_blank">https://www.cdn77.com/tls-test/</a><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png" data-rel="lightbox-gallery-dDDPY67q" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png" alt="" width="300" height="182" class="alignnone size-medium wp-image-6158" srcset="https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-300x182.png 300w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-1024x620.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste-768x465.png 768w, https://blog.remontti.com.br/wp-content/uploads/2021/10/tls_teste.png 1099w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Não esqueça de colocar no seu cron para ele renovar o certificado, pois a cada 90 ele expira. Neste exemplo todo dia primeiro tento renovar.</p>
<pre class="remontti-code"># echo &#039;00 00   1 * *   root    /usr/bin/certbot -q renew&#039; &gt;&gt; /etc/crontab
# systemctl restart cron</pre>
<p>Caso não renovar apenas rode o comando letsencrypt novamente. </p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong><br />
<a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a><br />
Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p><strong>Fontes:</strong> <a href="https://docs.nginx.com/" rel="noopener" target="_blank">https://docs.nginx.com/</a><br />
<a href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/" rel="noopener" target="_blank">https://docs.nginx.com/nginx/admin-guide/web-server/web-server/</a></p>
<p>O post <a href="https://blog.remontti.com.br/5487">Servidor WEB NGINX + PHP + PostgreSQL + phpPgAdmin + Letsencrypt no Debian 10 Buster (LNPP)</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/5487/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
