• EnglishEspañol日本語한국어Português
  • EntrarComeçar agora

Esta tradução de máquina é fornecida para sua comodidade.

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

Criar um problema

Sendmail integração

Nossa integração Sendmail monitora o desempenho do seu agente de transferência de e-mail Sendmail, ajudando você a instrumentar e monitor rapidamente seu agente.

Depois de configurar a integração com o New Relic, veja seus dados em painéis como estes, prontos para uso.

Conclua as etapas a seguir para instalar a integração:

Instalar o agente de infraestrutura

Para usar a integração do Sendmail, você precisa primeiro instalar o agente de infraestrutura no mesmo host. O agente de infraestrutura monitora o próprio host, enquanto a integração que você instalará na próxima etapa amplia seu monitoramento com dados específicos do Sendmail.

Use NRI-Flex para capturar métricas

Flex permite capturar métricas do Apache Zookeeper. Ele vem junto com o agente New Relic Infrastructure que você instalou na etapa anterior.

  1. Crie um arquivo chamado sendmail-flex-config.yml no caminho /newrelic-infra/integrations.d .

  2. Atualize sendmail-flex-config.yml com o exemplo de configuração a seguir.

    Certifique-se de substituir as referências FAILED_MESSAGES_FILE_NAME pelo nome do seu arquivo. Para encontrar esse nome de arquivo, vá para /var/mail/ e verifique se há mensagens com falha no arquivo que foi criado.

    ---
    integrations:
    - name: nri-flex
    config:
    name: sendmailFlex
    apis:
    #check if Sendmail service is up.
    - event_type: SendmailUp
    commands:
    - run: echo "value:$(systemctl status sendmail | grep 'Active':' active (running)' | wc -l)"
    split_by: ':'
    #check if Sendmail service is down.
    - event_type: SendmailDown
    commands:
    - run: echo "value:$(systemctl status sendmail | grep 'Active':' inactive (dead)' | wc -l)"
    split_by: ':'
    #Read the number of times SMTP service is unreachable.
    - event_type: SendmailSMTPserviceUnreachable
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep -E 'stat=Service unavailable' | wc -l)"
    split_by: ':'
    #Read the count of error message - host not found.
    - event_type: SendmailHostNotFound
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep -c 'host not found')"
    split_by: ':'
    #Read the count of error logged.
    - event_type: SendmailErrorCount
    commands:
    - run: echo "value:$(cat /var/log/mail.err | wc -l)"
    split_by: ':'
    #Read the number of messages accepted for delivery.
    - event_type: SendmailMessageAcceptedForDelivery
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep -c 'Message accepted for delivery')"
    split_by: ':'
    #Read the number of messages sent & deferred.
    - event_type: SendmailMessageStatus
    commands:
    - run: echo "sent:$(cat /var/log/mail.log | grep 'stat=Sent' | wc -l)"
    split_by: ':'
    - run: echo "deferred:$(cat /var/log/mail.log | grep 'stat=Deferred' | wc -l)"
    split_by: ':'
    #Read the number of messages held by user.
    #Go to the path "/var/mail/" and check the file that has been created for failed messages and accordingly update "FAILED_MESSAGES_FILE_NAME" in the below command.
    - event_type: SendmailHeldMessage
    commands:
    - run: echo "value:$(cat /var/mail/FAILED_MESSAGES_FILE_NAME | grep -c 'Subject:')"
    split_by: ':'
    #Read the number of connection timeout.
    - event_type: SendmailConnectionTimeOut
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep -c 'timeout')"
    split_by: ':'
    #Read the recipients with message count.
    - event_type: SendmailRecipientsbyMessageCount
    commands:
    - run: cat /var/log/mail.log | grep "to=<.*.>" | awk '{n=split($7,a,"to="); print a[1],a[2]}' | cut -d "<" -f2 |cut -d ">" -f1 | sort | uniq -c | sort -nr
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [msgCount.total, recipients.total]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)
    - run: cat /var/log/mail.log | grep "to=<.*.>" | grep "$(date +'%b %e')" | awk '{n=split($7,a,"to="); print a[1],a[2]}' | cut -d "<" -f2 |cut -d ">" -f1 | sort | uniq -c | sort -nr
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [msgCount.latest, recipients.latest]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)
    #Read the recipients host/domain.
    - event_type: SendmailRecipientsHostname
    commands:
    - run: cat /var/log/mail.log | grep "to=<.*.>" | awk '{print $7}' | grep -oE '[^@]+[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}' | sort | uniq -c
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [hostCount.total, hostname.total]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)
    - run: cat /var/log/mail.log | grep "to=<.*.>" | grep "$(date +'%b %e')" | awk '{print $7}' | grep -oE '[^@]+[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}' | sort | uniq -c
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [hostCount.latest, hostname.latest]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)
    #Read the senders with message count.
    - event_type: SendmailSendersbyMessageCount
    commands:
    - run: cat /var/log/mail.log | grep "from=<.*@.*>" | awk '{print $7}' | cut -d "<" -f2 |cut -d ">" -f1 | sort | uniq -c
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [msg.total, senders.total]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)
    - run: cat /var/log/mail.log | grep "from=<.*@.*>" | grep "$(date +'%b %e')" | awk '{print $7}' | cut -d "<" -f2 |cut -d ">" -f1 | sort | uniq -c
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [msg.latest, senders.latest]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)
    #Read the senders host/domain.
    - event_type: SendmailSendersHostname
    commands:
    - run: cat /var/log/mail.log | grep "from=<.*.>" | awk '{print $7}' | grep -oE '[^@]+[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}' | sort | uniq -c
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [hostCount.total, hostname.total]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)
    - run: cat /var/log/mail.log | grep "from=<.*.>" | grep "$(date +'%b %e')" | awk '{print $7}' | grep -oE '[^@]+[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}' | sort | uniq -c
    split: horizontal
    header_split_by: \s+(\d+)\s+(.*.)
    set_header: [hostCount.latest, hostname.latest]
    regex_match: true
    split_by: \s+(\d+)\s+(.*.)

Encaminhe seu log do Sendmail para New Relic

Você pode usar nosso recurso de encaminhamento de logs para encaminhar o log do Sendmail para New Relic.

Adicione o seguinte script a /etc/newrelic-infra/logging.d/logging.yml:

logs:
- name: mail.log
file: /var/log/mail.log
attributes:
logtype: sendmail_log
- name: mail.err
file: /var/log/mail.err
attributes:
logtype: sendmail_error

Reinicie o agente do New Relic Infrastructure

Antes de começar a ler seus dados, use as instruções em nossos documentos do agente de infraestrutura para reiniciar seu agente de infraestrutura.

bash
$
sudo systemctl restart newrelic-infra.service

Em alguns minutos, seu aplicativo enviará métricas para one.newrelic.com.

Encontre seus dados

Você pode escolher nosso modelo dashboard pré-construído chamado Sendmail para monitor sua métrica do aplicativo Sendmail. Siga estas etapas para usar nosso modelo dashboard pré-construído:

  1. De one.newrelic.com, vá para a página

    + Add data

    .

  2. Clique em

    Dashboards

    .

  3. Na barra de pesquisa, digite sendmail.

  4. O dashboard do Sendmail deve aparecer. Clique nele para instalá-lo.

    Seu dashboard do Sendmail é considerado um painel personalizado e pode ser encontrado na interface Dashboards. Para obter documentos sobre como usar e editar o painel, consulte nossos documentos dashboard .

    Aqui está uma consulta NRQL para encontrar o status de envio da sua última mensagem:

    SELECT latest(sent) as 'Sent', latest(deferred) as ‘Deferred’
    FROM SendmailMessageStatus

    Aqui está uma consulta NRQL para visualizar o status do serviço Sendmail:

    SELECT latest(value) as 'Service Up'
    FROM SendmailUp
    TIMESERIES AUTO

Qual é o próximo?

Para saber mais sobre como construir uma consulta NRQL e gerar um painel, confira estes documentos:

  • Introdução ao criador de consulta para criação de consultas básicas e avançadas.

  • Introdução aos dashboards para personalizar seu dashboard e realizar diversas ações.

  • Gerencie seu dashboard para ajustar o

    modo de exibição ou para adicionar mais conteúdo ao dashboard.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.