Forem

Beatriz Oliveira for WoMakersCode

Posted on

Como monitorar o Apache com o Metricbeat

O que é o Apache?

O Apache é um servidor web livre da Apache Software Foundation. Ele é um servidor do tipo HTTPD ( Hypertext Transfer Protocol Daemon). 

Segundo o site do Apache:

"O objetivo deste projeto é fornecer um servidor seguro, eficiente e extensível que forneça serviços HTTP em sincronia com os padrões HTTP atuais.

O Apache HTTP Server ("httpd") foi lançado em 1995 e tem sido o servidor da web mais popular na Internet desde abril de 1996. Ele comemorou seu 25º aniversário em fevereiro de 2020."

Como monitorar o Apache utilizando o Metricbeat?

Para começar esse lab, você precisará ter um ambiente com o Apache de preferência com a versão >= 2.2.31 e outro ambiente com o Elasticsearch e com o Kibana configurados.

Assim que você tiver esses pré requisitos, poderá começar a seguir os passos abaixo para configurar o Metricbeat para coletar os dados do Apache.

Para instalar o Metricbeat no host do Apache, siga os passos descritos abaixo.

  • Faça o download do Metricbeat nesse link.

  • Instale o Metricbeat:
    Windows: PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-metricbeat.ps1
    Linux: sudo rpm -vi metricbeat-7.10.1-x86_64.rpm

  • Acesse o arquivo de configuração do Metricbeat:
    Windows: C:\Program Files\Metricbeat\metricbeat.yml
    Linux: /etc/metricbeat/metricbeat.yml

  • Insira nele as informações de conexão com o Elasticsearch e com o Kibana:

output.elasticsearch:
  hosts: ["url_do_elasticsearch:9200"]
setup.kibana:
  host: ["url_do_kibana:5601"]
Enter fullscreen mode Exit fullscreen mode

Se você estiver usando o Metricbeat OSS insira as seguintes configurações no fim do arquivo metricbeat.yml:

setup.ilm.enabled: false
setup.pack.security.enabled: false
setup.xpack.graph.enabled: false
setup.xpack.watcher.enabled: false
setup.xpack.monitoring.enabled: false
setup.xpack.reporting.enabled: false
Enter fullscreen mode Exit fullscreen mode
  • Habilite e configure o módulo do Apache:

Windows: .\metricbeat.exe modules enable apache
Linux: sudo metricbeat modules enable apache

  • Para modificar as configurações do módulo, altere o arquivo apache.yml:

Windows: modules.d/apache.yml
Linux: /etc/metricbeat/modules.d/apache.yml

Por padrão, o arquivo vem com as seguintes informações:
metricbeat.modules:

- module: apache
  metricsets: ["status"]
  period: 10s
  enabled: true

  # Apache hosts
  hosts: ["http://127.0.0.1"]

  # Path to server status. Default server-status
  #server_status_path: "server-status"

  # Username of hosts.  Empty by default
  #username: username

  # Password of hosts. Empty by default
  #password: password
Enter fullscreen mode Exit fullscreen mode
  • Carregue os dashboards do módulo:

Windows: .\metricbeat.exe setup
Linux: sudo metricbeat setup

  • Inicie o serviço do Metricbeat:

Windows: Start-Service metricbeat
Linux: sudo service metricbeat start

Depois disso, você conseguirá ver os logs do seu ambiente no discover, além de ter dashboards com informações e métricas do estado do seu Apache.

Alt Text

Para obter mais informações, acesse a documentação oficial do módulo do Apache no site da Elastic.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay