SempreUPdate
Notícias sobre Ubuntu, Debian, Fedora, Linux, Android, Tecnologia, LibreOffice e muito mais!

Como instalar o Sensu Monitoring Tool no CentOS 7

Afinal o que é Sensu Monitoring Tool?

Sensu é uma ferramenta de monitoramento escalável e de código aberto escrita em Ruby. É uma plataforma dinâmica e efêmera de monitoramento e implantação de infraestrutura e de aplicações utilizadas para monitorar e enviar alertas e notificações de novos eventos. O Sensu usa RabbitMQ para corretagem de mensagens e Redis para data storing (armazenamento de dados).

O que ele faz exatamente?

Sensu monitora os serviços de aplicativos e sistemas, detecta aqueles em estado insalubre e notifica via email, PagerDuty, Slack, HipChat, IRC, etc. O Sensu oferece API Documentada, Registro de Cliente Dinâmico, Monitoramento de Autoatendimento, Conectividade Segura, Plugins Sensu e Built-in e Roteamento de contatos. 

Neste Tutorial veremos como instalar no CentOS 7.

Procedimentos de instalação do Sensu Monitoring

Para iniciarmos o procedimento baixe o RPM Earling, usando o comando wget da seguinte forma e com o link abaixo.

root@bishop~# wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm

Após isso retornará uma tela com as seguintes informações (ou algo similar):

--2017-11-06 10:35:05-- http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
Resolving packages.erlang-solutions.com (packages.erlang-solutions.com)... 31.172.186.53
Connecting to packages.erlang-solutions.com (packages.erlang-solutions.com)|31.172.186.53|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1932 (1.9K) [application/x-redhat-package-manager]
Saving to: ‘erlang-solutions-1.0-1.noarch.rpm.1’

100%[======================================>] 1,932 --.-K/s in 0s

2017-11-06 10:35:43 (86.9 MB/s) - ‘erlang-solutions-1.0-1.noarch.rpm.1’ saved [1932/1932]

O pacote RPM Erlang foi baixado. Em seguida, instale o RPM Erlang executando o seguinte comando.

root@bishop~]# rpm -Uvh erlang-solutions-1.0-1.noarch.rpm

Seguindo o passo acima, será mostrada uma tela com as seguintes informações (ou algo similar):

Preparing... ################################# [100%]
Updating / installing...
 1:erlang-solutions-1.0-1 ################################# [100%]
--2017-11-06 10:18:02-- http://packages.erlang-solutions.com/rpm/centos/erlang_solutions.repo
Resolving packages.erlang-solutions.com (packages.erlang-solutions.com)... 31.172.186.53
Connecting to packages.erlang-solutions.com (packages.erlang-solutions.com)|31.172.186.53|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 245
Saving to: ‘erlang_solutions.repo’

100%[======================================>] 245 --.-K/s in 0s

2017-11-06 10:18:03 (21.0 MB/s) - ‘erlang_solutions.repo’ saved [245/245]

O RPM Earling foi instalado com exito no sistema, agora instalaremos o aplicativo Earling executando o seguinte comando:

root@bishop~# yum install erlang

Fazendo isso será apresentado uma tela com as seguintes informações (ou algo similar):

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.snu.edu.in
 * epel: mirror.ehost.vn
 * extras: centos.mirror.snu.edu.in
 * updates: centos.mirror.snu.edu.in
Resolving Dependencies
--> Running transaction check
---> Package erlang.x86_64 0:20.1-1.el7.centos will be installed
--> Processing Dependency: erlang-inets(x86-64) = 20.1-1.el7.centos for package: erlang-20.1-1.el7.centos.x86_64
.
.
.
.
erlang-wx.x86_64 0:20.1-1.el7.centos 
 erlang-xmerl.x86_64 0:20.1-1.el7.centos 
 mesa-libGLU.x86_64 0:9.0.0-4.el7 
 unixODBC.x86_64 0:2.3.1-11.el7 
 wxBase.x86_64 0:2.8.12-20.el7 
 wxGTK.x86_64 0:2.8.12-20.el7 
 wxGTK-gl.x86_64 0:2.8.12-20.el7

Complete!

Agora iremos baixar o RabbitMQ RPM, usando o comando wget da seguinte forma e com o link abaixo.

root@bishop ~# wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm
--2017-11-06 10:58:49--  https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm
Resolving www.rabbitmq.com (www.rabbitmq.com)... 104.20.63.197, 104.20.62.197, 2400:cb00:2048:1::6814:3ec5, ...
Connecting to www.rabbitmq.com (www.rabbitmq.com)|104.20.63.197|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5088884 (4.9M) [application/x-redhat-package-manager]
Saving to: ‘rabbitmq-server-3.6.1-1.noarch.rpm’

100%[======================================>] 5,088,884   1.10MB/s   in 4.5s   

2017-11-06 10:58:54 (1.09 MB/s) - ‘rabbitmq-server-3.6.1-1.noarch.rpm’ saved [5088884/5088884]

Execute o RPM para RabbitMQ by rodando o seguinte comando:

# rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc

Instale o aplicativo RabbitMQ executando o comando yum install.

root@bishop~# yum install rabbitmq-server-3.6.1-1.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining rabbitmq-server-3.6.1-1.noarch.rpm: rabbitmq-server-3.6.1-1.noarch
Marking rabbitmq-server-3.6.1-1.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rabbitmq-server.noarch 0:3.6.1-1 will be installed
--> Finished Dependency Resolution
.
.
.
.
Transaction test succeeded
Running transaction
  Installing : rabbitmq-server-3.6.1-1.noarch                               1/1 
  Verifying  : rabbitmq-server-3.6.1-1.noarch                               1/1 

Installed:
  rabbitmq-server.noarch 0:3.6.1-1                                              

Complete!

  Pós Instalação

Comece ativando o seu RabbitMQ executando o seguinte comando:

root@bishop ~# systemctl enable rabbitmq-server
rabbitmq-server.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig rabbitmq-server on
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

Inicie o serviço

root@bishop ~# systemctl start rabbitmq-server

Instalação do Redis

Próxima instalação é o aplicativo Redis, que executaremos com o comando yum install.

root@bishop ~# yum install redis
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.snu.edu.in
 * epel: epel.scopesky.iq
 * extras: centos.mirror.snu.edu.in
 * updates: centos.mirror.snu.edu.in
Resolving Dependencies
--> Running transaction check
---> Package redis.x86_64 0:3.2.10-2.el7 will be installed
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: redis-3.2.10-2.el7.x86_64
.
.
.
Running transaction
  Installing : jemalloc-3.6.0-1.el7.x86_64                                  1/2 
  Installing : redis-3.2.10-2.el7.x86_64                                    2/2 
  Verifying  : redis-3.2.10-2.el7.x86_64                                    1/2 
  Verifying  : jemalloc-3.6.0-1.el7.x86_64                                  2/2 

Installed:
  redis.x86_64 0:3.2.10-2.el7                                                   

Dependency Installed:
  jemalloc.x86_64 0:3.6.0-1.el7 

Adicione o repositório necessário antes de instalar a ferramenta Sensu criando um arquivo de reimportação chamado Sensu e insira o seguinte conteúdo no arquivo. Salve e saia do arquivo.

root@bishop~# vim /etc/yum.repos.d/sensu.repo

[sensu]
name=sensu-main
baseurl=http://repositories.sensuapp.org/yum/el/7/x86_64/
gpgcheck=0
enabled=1

O arquivo repo foi criado com sucesso! Em seguida, instale a ferramenta Sensu executando o seguinte comando e pressione “y” para continuar com o processo de instalação.

root@bishop~# yum install sensu uchiwa -y
Loaded plugins: fastestmirror, langpacks
sensu                                                    | 2.5 kB     00:00     
sensu/primary_db                                           |  43 kB   00:00     
Loading mirror speeds from cached hostfile
 * base: centos.mirror.snu.edu.in
 * epel: mirror.ehost.vn
 * extras: centos.mirror.snu.edu.in
 * updates: centos.mirror.snu.edu.in
Resolving Dependencies
.
.
.
Installing : 1:sensu-0.26.5-2.x86_64                                      1/2 
  Installing : 1:uchiwa-0.22.0-1.x86_64                                     2/2 
  Verifying  : 1:uchiwa-0.22.0-1.x86_64                                     1/2 
  Verifying  : 1:sensu-0.26.5-2.x86_64                                      2/2 

Installed:
  sensu.x86_64 1:0.26.5-2                uchiwa.x86_64 1:0.22.0-1               

Complete!

Inicie e habilite o serviço Redis.

root@bishop~# systemctl start redis
root@bishop~# systemctl enable redis
ln -s '/usr/lib/systemd/system/redis.service' '/etc/systemd/system/multi-user.target.wants/redis.service'

Copie o arquivo .json para o seguinte local.

root@bishop~# cp /etc/sensu/config.json.example /etc/sensu/config.json

Inicie e habilite as seguintes listas de serviços:

root@bishop~# systemctl start sensu-server
root@bishop~# systemctl start sensu-client
root@bishop~# systemctl start sensu-api
root@bishop~# systemctl start uchiwa


root@bishop~# systemctl enable sensu-server
sensu-server.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sensu-server on
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).


root@bishop~# systemctl enable sensu-client
sensu-client.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sensu-client on
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

root@bishop~# systemctl enable sensu-api
sensu-api.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sensu-api on
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

root@bishop~# systemctl enable uchiwa
uchiwa.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig uchiwa on
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

Defina a configuração do Firewall executando o seguinte conjunto de comandos.

root@bishop~# firewall-cmd --add-port=3000/tcp
Success

root@bishop~# firewall-cmd --add-port=80/tcp
Success

root@bishop~# firewall-cmd --add-port=443/tcp
Success

root@bishop ~# firewall-cmd --reload
success

Pronto, você concluiu a instalação do Sensu Monitoring Tool no CentOS 7

Sensu
Figura 1 – Dashboard do Sensu Monitoring Tool

Caso queira conhecer um pouco mais sobre a ferramenta, segue o link do site clique aqui.

That’s All Folks!!

O que você achou do Sensu? Gostou? Já utilizou? Deixe nos comentários a sua experiência. Tem dúvidas ou quer compartilhar algo conosco, entre no nosso Telegram, estamos te esperando.

Comentários