• EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

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.

문제 신고

후위 통합

Postfix 통합 통합 메일 서버 데이터를 하나의 보기로 통합하여 특정 기간 동안 전송, 반송 또는 지연된 이메일 수를 추적할 수 있습니다. Postfix 통합은 후방 감시 에이전트를 사용하며 이메일 전달 프로세스, 메일 대기열, 메시지 개요와 같은 가장 중요한 Postfix 지표가 포함된 사전 구축된 대시보드를 제공합니다.

Postfix 통합을 설정한 후 Postfix 메트릭에 대한 대시보드를 제공합니다.

Postfix 통합 설정

Postfix 통합을 설정하려면 다음 단계를 완료하세요.

인프라 에이전트 설치

Postfix 통합을 사용하려면 동일한 호스트에 인프라 에이전트도 설치 해야 합니다. 클라이언트 에이전트는 호스트 자체를 모니터링하는 반면, 다음 단계에서 설치하게 될 통합은 Postfix 관련 데이터로 모니터링을 확장합니다.

Postfix 데이터 내보내기

pflogsumm 으로 Postfix 지표를 내보냅니다. Postfix 에이전트는pflogsumm 로그 분석기로 사용하며, 이는 Postfix 활동에 대한 지표 데이터로 변환됩니다. 이를 통해 이메일 관리에 발생할 수 있는 잠재적인 사건을 예측할 수 있는 충분한 세부 정보를 얻을 수 있습니다.

pflogsumm사용하려면 다음 단계를 따르세요.

  1. 다음 명령을 실행하여 pflogsumm) 다운로드하고 추출합니다.

    bash
    $
    wget https://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz
    bash
    $
    tar xvf pflogsumm-1.1.3.tar.gz
  2. pflogsumm 폴더로 이동합니다.

    bash
    $
    cd pflogsumm-*.*.*
  3. pflogsumm.pl 파일을 /usr/local/bin/pflogsumm 경로에 복사합니다.

    bash
    $
    sudo cp pflogsumm.pl /usr/local/bin/pflogsumm
  4. Postfix 지표를 내보내려면 다음 pflogsumm 명령을 실행하세요.

    bash
    $
    cat /var/log/mail.log | pflogsumm
    $
    cat /var/log/mail.log | pflogsumm -d today

Postfix용 NRI-Flex 구성

우리의 설계에 구애받지 않는 모니터링 도구인 Flex는 뉴렐릭 인프라 에이전트와 함께 번들로 제공됩니다. Postfix 데이터에 대한 flex 설정 파일을 생성하려면 다음 단계를 따르세요.

  1. postfix-flex-config.yml 이라는 파일을 만듭니다.

    bash
    $
    touch /etc/newrelic-infra/integrations.d/postfix-flex-config.yml
  2. postfix-flex-config.yml 파일을 업데이트합니다. 아래의 설정 샘플을 사용하여 작업하는 것이 좋습니다.

    ---
    integrations:
    - name: nri-flex
    config:
    name: postfixFlex
    apis:
    #check if Postfix service is up.
    - event_type: PostfixUp
    commands:
    - run: echo "value:$(systemctl status postfix | grep 'Active':' active' | wc -l)"
    split_by: ':'
    #check if Postfix service is down.
    - event_type: PostfixDown
    commands:
    - run: echo "value:$(systemctl status postfix | grep 'Active':' active' | wc -l)"
    split_by: ':'
    #Read the grand totals messages by using the below script.
    - event_type: PostfixGrandTotals
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -A 21 'Grand Totals'
    split: horizontal
    set_header: [metricValue, message]
    regex_match: true
    split_by: \s+(\d+\w*)\s+(.*)
    #Read the number of messages delivered & received in bytes.
    - event_type: PostfixMessageBytes
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -A 1 'bytes received'
    split: horizontal
    set_header: [metricValue, messageBytes]
    regex_match: true
    split_by: \s+(\d+\w*)\s+(.*)
    #Read the number of messages held by the user.
    - event_type: PostfixHeldMessage
    commands:
    - run: echo "value:$(cat /var/mail/<USER> | grep -c 'Subject:')"
    split_by: ':'
    #Read the count of SASL authentication failure notifications.
    - event_type: PostfixSASLauthFailed
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep 'status=deferred (SASL authentication failed' | wc -l)"
    split_by: ':'
    #Read the count of bounced non-delivery notifications.
    - event_type: PostfixBounceNondeliveryNotification
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep 'postfix/bounce' | wc -l)"
    split_by: ':'
    #Read the number of messages passed through the email delivery process.
    - event_type: PostfixEmailDeliveryProcess
    commands:
    - run: echo "PICKUPvalue:$(cat /var/log/mail.log | grep 'pickup' | wc -l)"
    split_by: ':'
    - run: echo "CLEANUPvalue:$(cat /var/log/mail.log | grep 'cleanup' | wc -l)"
    split_by: ':'
    #Read the number of message inserted in mail queue.
    - event_type: PostfixMessageInsertedinMailQ
    commands:
    - run: echo "Ivalue:$(cat /var/log/mail.log | grep 'queue active'| wc -l)"
    split_by: ':'
    #Read the number of message handled by SMTP process.
    - event_type: PostfixMessageHandledBySMTP
    commands:
    - run: echo "SENTmsg:$(cat /var/log/mail.log | grep 'status=sent' | grep "postfix/smtp" | wc -l)"
    split_by: ':'
    - run: echo "BOUNCEDmsg:$(cat /var/log/mail.log | grep 'status=bounced' | grep "postfix/smtp" | wc -l)"
    split_by: ':'
    - run: echo "DEFERREDmsg:$(cat /var/log/mail.log | grep 'status=deferred' | grep "postfix/smtp" | wc -l)"
    split_by: ':'
    #Read the number of message removed from mail queue.
    - event_type: PostfixMessageRemovedFromMailQ
    commands:
    - run: echo "Rvalue:$(cat /var/log/mail.log | grep 'removed'| wc -l)"
    split_by: ':'
    #Read the number of SMTPD connection.
    - event_type: PostfixSMTPDconnection
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep ' connect from' | wc -l)"
    split_by: ':'
    #Read the number of SMTPD disconnection.
    - event_type: PostfixSMTPDdisconnection
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep 'disconnect from' | wc -l)"
    split_by: ':'
    #Read the number of SMTP connection.
    - event_type: PostfixSMTPconnection
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep ' connect to' | wc -l)"
    split_by: ':'
    #Read the number of SMTP disconnection.
    - event_type: PostfixSMTPdisconnection
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep 'disconnect to' | wc -l)"
    split_by: ':'
    #Read the number of connection timed out.
    - event_type: PostfixSMTPDtimedOut
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep 'timeout after CONNECT' | wc -l)"
    split_by: ':'
    #Read the number of connection lost.
    - event_type: PostfixSMTPDconnectionLost
    commands:
    - run: echo "value:$(cat /var/log/mail.log | grep 'lost connection' | wc -l)"
    split_by: ':'
    #Read the per-hour traffic report.
    - event_type: PostfixMessagePerHourReport
    commands:
    - run: cat /var/log/mail.log | pflogsumm -d today | grep -i 'Per-Hour Traffic Summary' -A 27
    split: horizontal
    header_split_by: \s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(.*)
    set_header:
    [
    time,
    received.perhour,
    delivered.perhour,
    deferred.perhour,
    bounced.perhour,
    rejected.perhour,
    ]
    regex_match: true
    split_by: \s+(\d+-\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)
    #Read the per-day traffic summary.
    - event_type: PostfixMessageTrafficPerDay
    commands:
    - run: cat /var/log/mail.log | pflogsumm --zero_fill | grep -C 12 'Per-Day Traffic Summary' -B 0 -A 8 | sed '/Per-Hour Traffic Daily Average/q'
    split: horizontal
    header_split_by: \s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(.*)
    set_header:
    [date, received, delivered, deferred, bounced, rejected]
    regex_match: true
    split_by: \s+(\w+\s+\d+\s+\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)
    #Read the host/domain summary: message delivery & received.
    - event_type: PostfixHostSummary
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -i 'Host/Domain Summary':' Message Delivery' -A 8 | sed -n '2,9p'
    split: horizontal
    header_split_by: \s+(\w+\s+\w+)\s+(\w+)\s+(\w+)\s+(\w+\s+\w+)\s+(\w+\s+\w+)\s+(.*.)
    set_header:
    [sentCount, bytesDelivered, defers, avgDaily, maxDaily, host]
    regex_match: true
    split_by: \s+(\d+)\s+(\d+\w*)\s+(\d+)\s+(\d+.\d+\s+\w)\s+(\d+.\d+\s+\w)\s+(.*)
    - run: cat /var/log/mail.log | pflogsumm | grep -A 15 'Host/Domain Summary':' Messages Received' | sed '/Senders by message count/q'
    split: horizontal
    header_split_by: \s+(\w+\s+\w+)\s+(\w+)\s+(.*.)
    set_header: [msgCount, bytesReceived, hostDetail]
    regex_match: true
    split_by: \s+(\d+)\s+(\d+\w*)\s+(.*)
    #Read the senders & recipients with message count.
    - event_type: PostfixSenderRecipientMessageCount
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -C 11 'Senders by message count' -B 1 -A 9 | sed '/Recipients by message count/q'
    split: horizontal
    header_split_by: (.*.)
    set_header: [sender.msgCount, senders]
    regex_match: true
    split_by: \s+(\d+)\s+(.*)
    - run: cat /var/log/mail.log | pflogsumm | grep -C 11 'Recipients by message count' -B 1 -A 9 | sed '/Senders by message size/q'
    split: horizontal
    header_split_by: (.*.)
    set_header: [recipient.msgCount, recipients]
    regex_match: true
    split_by: \s+(\d+)\s+(.*)
    #Read the daemon message details.
    - event_type: PostfixDaemonMessage
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -A 10 'Master daemon messages'
    split: horizontal
    set_header: [daemon.msgCount, daemonMessage]
    regex_match: true
    split_by: \s*(\d+)\s+(\w+.*.)
    #Read the message deferral details.
    - event_type: PostfixDeferralMessage
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -A 15 'message deferral detail' | sed '/message bounce detail (by relay)/q'
    split: horizontal
    header_split_by: (\s+\w+\s+.*)
    set_header: [deferral.msgCount, deferralMessage]
    regex_match: true
    split_by: \s*(\d+)\s+(\w+.*.)
    #Read the warning message details.
    - event_type: PostfixWarningMessage
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -v 'mail_queue_enter' | grep -C 100 'Warnings' -B 1 -A 10 | sed '/Fatal Errors/q'
    split: horizontal
    header_split_by: \s+(\w+)\s+(.*)
    set_header: [Warning.msgCount, warningMessage]
    regex_match: true
    split_by: \s*(\d+)\s\s\s(.*.)
    #Read the error message details.
    - event_type: PostfixErrorMessage
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -C 15 'Fatal Errors' -B 1 -A 10 | sed '/Panics/q'
    split: horizontal
    header_split_by: \s+(\w+)\s+(.*)
    set_header: [Fatal.msgCount, fatalMessage]
    regex_match: true
    split_by: \s*(\d+)\s\s\s(.*.)
    #Read the message bounce details.
    - event_type: PostfixBounceMessage
    commands:
    - run: cat /var/log/mail.log | pflogsumm | grep -A 10 'message bounce detail (by relay)' | sed '/message reject detail/q'
    split: horizontal
    header_split_by: \s+(\w+)\s+(.*)
    set_header: [Bounce.msgCount, bounceMessage]
    regex_match: true
    split_by: \s*(\d+)\s\s\s(.*.)

    자신만의 파일을 만들고 싶다면 yaml 파일이 위의 패턴을 따르는지 확인하세요. 필요에 따라 다음 속성을 편집합니다.

  • EVENT_TYPE: NRQL 이용하여 쿼리할 수 있는 뉴켈릭 데이터베이스 테이블입니다.
  • COMMAND: 터미널에서 메트릭을 인쇄하는 데 사용되는 명령입니다.

Postfix 로그를 New Relic으로 전달

Postfix 로그를 뉴렐릭으로 전달하려면 다음 단계를 따르세요.

  1. 인프라 에이전트 디렉터리에 logging.yml 이라는 파일을 만듭니다.

    bash
    $
    touch /etc/newrelic-infra/logging.d/logging.yml
  2. logging.yml 파일에 다음 스니펫을 추가합니다.

    logs:
    - name: mail.log
    file: /var/log/mail.log
    attributes:
    logtype: postfix_maillog

인프라 에이전트 다시 시작

인프라 에이전트 문서 의 지침을 사용하여 인프라 에이전트를 다시 시작하세요. 이것은 대부분의 사람들에게 작동하는 기본 명령입니다.

bash
$
sudo systemctl restart newrelic-infra.service

데이터 찾기 및 사용

사전 구축된 대시보드 템플릿을 사용하여 Postfix 데이터를 쉽게 보려면 다음 단계를 따르세요.

  1. one.newrelic.com

    으로 이동하여

    + Add data

    를) 클릭합니다.

  2. Dashboards

    탭을 클릭합니다.

  3. 검색 상자에 Postfix입력합니다.

  4. 미리 빌드된 대시보드가 표시되면 클릭하여 계정에 설치하십시오.

    귀하의 Postfix 대시보드는 맞춤형 대시보드입니다. Dashboards UI에서 액세스하세요. 대시보드 사용 및 편집에 대한 문서는 대시보드 문서 를 참조하세요.

    데이터를 찾고 사용하는 방법에 대한 자세한 내용은 통합 데이터 이해를 참조하세요. 다음은 Postfix 데이터에 대한 몇 가지 NRQL 쿼리 예입니다.

다음은 뭐지?

NRQL 쿼리 작성 및 대시보드 생성에 대해 자세히 알아보려면 다음 문서를 확인하세요.

  • 기본 및 고급 쿼리를 생성 하기 위한 쿼리 빌더 소개

  • 대시보드를 사용자 지정하고 다양한 작업을 수행하기 위한 대시보드 소개

  • 대시보드를 관리하여

    디스플레이 모드를 조정하거나 대시보드에 더 많은 콘텐츠를 추가하세요.

Copyright © 2024 New Relic Inc.

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