Nuestra integración Sendmail monitorea el rendimiento de su agente de transferencia de correo Sendmail, ayudándolo a instrumentar y monitor rápidamente su agente.

Después de configurar la integración con New Relic, vea sus datos en un dashboard como este, listo para usar.
Complete los siguientes pasos para instalar la integración:
Instalar el agente de infraestructura
Para emplear la integración de Sendmail, primero debe instalar el agente de infraestructura en el mismo host. El agente de infraestructura monitorea el host en sí, mientras que la integración que instalará en el siguiente paso extiende su monitoreo con datos específicos de Sendmail.
Utilice NRI-Flex para capturar métricas
Flex le permite capturar la métrica de Apache Zookeeper . Viene incluido con el agente de infraestructura New Relic que instalaste en el paso anterior.
Cree un archivo llamado
sendmail-flex-config.yml
en la ruta/newrelic-infra/integrations.d
.Actualice
sendmail-flex-config.yml
con el siguiente ejemplo de configuración.Cerciorar de reemplazar las referencias
FAILED_MESSAGES_FILE_NAME
con el nombre de su archivo. Para encontrar este nombre de archivo, vaya a/var/mail/
y verifique el archivo que se creó en busca de mensajes fallidos.---integrations:- name: nri-flexconfig:name: sendmailFlexapis:#check if Sendmail service is up.- event_type: SendmailUpcommands:- run: echo "value:$(systemctl status sendmail | grep 'Active':' active (running)' | wc -l)"split_by: ':'#check if Sendmail service is down.- event_type: SendmailDowncommands:- 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: SendmailSMTPserviceUnreachablecommands:- 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: SendmailHostNotFoundcommands:- run: echo "value:$(cat /var/log/mail.log | grep -c 'host not found')"split_by: ':'#Read the count of error logged.- event_type: SendmailErrorCountcommands:- run: echo "value:$(cat /var/log/mail.err | wc -l)"split_by: ':'#Read the number of messages accepted for delivery.- event_type: SendmailMessageAcceptedForDeliverycommands:- 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: SendmailMessageStatuscommands:- 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: SendmailHeldMessagecommands:- run: echo "value:$(cat /var/mail/FAILED_MESSAGES_FILE_NAME | grep -c 'Subject:')"split_by: ':'#Read the number of connection timeout.- event_type: SendmailConnectionTimeOutcommands:- run: echo "value:$(cat /var/log/mail.log | grep -c 'timeout')"split_by: ':'#Read the recipients with message count.- event_type: SendmailRecipientsbyMessageCountcommands:- 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 -nrsplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [msgCount.total, recipients.total]regex_match: truesplit_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 -nrsplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [msgCount.latest, recipients.latest]regex_match: truesplit_by: \s+(\d+)\s+(.*.)#Read the recipients host/domain.- event_type: SendmailRecipientsHostnamecommands:- run: cat /var/log/mail.log | grep "to=<.*.>" | awk '{print $7}' | grep -oE '[^@]+[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}' | sort | uniq -csplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [hostCount.total, hostname.total]regex_match: truesplit_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 -csplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [hostCount.latest, hostname.latest]regex_match: truesplit_by: \s+(\d+)\s+(.*.)#Read the senders with message count.- event_type: SendmailSendersbyMessageCountcommands:- run: cat /var/log/mail.log | grep "from=<.*@.*>" | awk '{print $7}' | cut -d "<" -f2 |cut -d ">" -f1 | sort | uniq -csplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [msg.total, senders.total]regex_match: truesplit_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 -csplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [msg.latest, senders.latest]regex_match: truesplit_by: \s+(\d+)\s+(.*.)#Read the senders host/domain.- event_type: SendmailSendersHostnamecommands:- run: cat /var/log/mail.log | grep "from=<.*.>" | awk '{print $7}' | grep -oE '[^@]+[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}' | sort | uniq -csplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [hostCount.total, hostname.total]regex_match: truesplit_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 -csplit: horizontalheader_split_by: \s+(\d+)\s+(.*.)set_header: [hostCount.latest, hostname.latest]regex_match: truesplit_by: \s+(\d+)\s+(.*.)
Reenvía tu registro de Sendmail a New Relic
Puede emplear nuestra capacidad de reenvío de logs para reenviar logs de Sendmail a New Relic.
Agrega el siguiente 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 el agente New Relic Infrastructure
Antes de que pueda comenzar a leer sus datos, utilice las instrucciones de nuestros documentos del agente de infraestructura para reiniciar su agente de infraestructura.
$sudo systemctl restart newrelic-infra.service
En un par de minutos, tu aplicación se enviará métrica a one.newrelic.com.
Encuentra tus datos
Puede elegir nuestra plantilla dashboard prediseñadas llamada Sendmail
para monitor su aplicación métrica Sendmail. Siga estos pasos para utilizar nuestra plantilla dashboard prediseñadas:
Desde one.newrelic.com, vaya a la página + Integrations & Agents .
Haga clic en Dashboards.
En la barra de búsqueda, escriba
sendmail
.Debería aparecer el dashboard de Sendmail. Haga clic en él para instalarlo.
Su dashboard de Sendmail se considera un dashboard personalizado y se puede encontrar en la UI Dashboards. Para obtener documentos sobre el uso y edición del dashboard, consulte nuestros documentos dashboard .
Aquí hay una consulta NRQL para encontrar el estado de envío de su último mensaje:
SELECT latest(sent) AS 'Sent', latest(deferred) AS 'Deferred'FROM SendmailMessageStatusAquí hay una consulta NRQL para ver el estado del servicio Sendmail:
SELECT latest(value) AS 'Service Up'FROM SendmailUpTIMESERIES AUTO
¿Que sigue?
Para obtener más información sobre cómo crear una consulta NRQL y generar un dashboard, consulte estos documentos:
- Introducción al generador de consultas para crear consultas básicas y avanzadas.
- Introducción al dashboard para personalizar tu dashboard y realizar diferentes acciones.
- Administre su dashboard para ajustar su modo de visualización o para agregar más contenido a su dashboard.