• 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.

問題を作成する

Sendmailの統合

Sendmail 統合は、Sendmail メール転送エージェントのパフォーマンスを監視し、エージェントを迅速に計測および監視するのに役立ちます。

New Relic との統合を設定したら、すぐにこのようなダッシュボードでデータを確認できます。

インテグレーションをインストールするには、次の手順を実行します。

インフラストラクチャエージェントをインストールします

Sendmail インテグレーションを使用するには、まず同じホストにインフラストラクチャエージェントをインストールする必要があります。 インフラストラクチャエージェントはホスト自体を監視しますが、次の手順でインストールするインテグレーションは Sendmail 固有のデータを使用して監視を拡張します。

NRI-Flex を使用してメトリクスを取得する

Flex を使用すると、Apache Zookeeper メトリックをキャプチャできます。 これは、前の手順でインストールしたNew Relic Infrastructureにバンドルされています。

  1. /newrelic-infra/integrations.dパスにsendmail-flex-config.ymlという名前のファイルを作成します。

  2. 次の設定例を使用してsendmail-flex-config.ymlを更新します。

    FAILED_MESSAGES_FILE_NAME参照をファイル名に置き換えてください。 このファイル名を見つけるには、 /var/mail/に移動して、失敗したメッセージ用に作成されたファイルを確認します。

    ---
    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+(.*.)

Sendmail ログを New Relic に転送する

ログ転送機能を使用して、Sendmail ログを New Relic に転送できます。

次のスクリプトを/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

New Relic インフラストラクチャ エージェントを再起動します

データの読み取りを開始する前に、 インフラストラクチャ エージェントのドキュメント の手順に従ってインフラストラクチャ エージェントを再起動します。

bash
$
sudo systemctl restart newrelic-infra.service

数分以内に、アプリケーションはメトリクスをone.newrelic.comに送信します。

データを検索する

Sendmail という名前の事前に構築されたダッシュボード テンプレートを選択して、Sendmail アプリケーションのメトリクスを監視できます。事前に構築されたダッシュボード テンプレートを使用するには、次の手順に従います。

  1. one.newrelic.comから、

    + Add data

    ページに移動します。

  2. Dashboards

    をクリックします。

  3. 検索バーにsendmailと入力します。

  4. Sendmail ダッシュボードが表示されます。それをクリックしてインストールします。

    Sendmail ダッシュボードはカスタムダッシュボードとみなされ、Dashboards UIで確認できます。 ダッシュボードの使用と編集に関するドキュメントについては、ダッシュボードのドキュメントをご覧ください。

    最新のメッセージの送信ステータスを確認するための NRQL クエリは次のとおりです。

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

    Sendmail サービスのステータスを検索して表示するための NRQL クエリを次に示します。

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

次は何ですか?

NRQL クエリの作成とダッシュボードの生成の詳細については、次のドキュメントをご覧ください。

  • 基本的なクエリと高度なクエリを作成するためのクエリ ビルダーの概要

  • ダッシュボードをカスタマイズしてさまざまなアクションを実行するためのダッシュボードの概要

  • ダッシュボードを管理して

    表示モードを調整したり、ダッシュボードにコンテンツを追加したりできます。

Copyright © 2024 New Relic株式会社。

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