Email Notification

I was wondering if there was a way for Nagios to get ahold of an email from a device, then send out an alert based on whats inside that email? Im trying to figure out the best way to monitor like five servers raid cards, apc’s,etc and there all at remote locations…

Thanks,

SNMP or small nagios installs at remote locations which only send the data to your main nagios server are an option.
Parsing an email isn’t impossible but you’ll need to create the script by yourself, read the mail content and inject in the command file the right strings so nagios knows what to do.

Luca

Hello! I have a Nagios 3.0.6 on CentOS 5.3 and some monitoring linux servers via nrpe plugin.
I need your help with notification.
I attached returned mail:

“/var/spool/mail/nagios”: 1 message 1 new

N 1 MAILER-DAEMON@localh Wed Jun 17 15:24 79/2814 “Returned mail: see transcript for details”
& 1
Message 1:
From [email protected] Wed Jun 17 15:24:32 2009
Date: Wed, 17 Jun 2009 15:24:32 +0400
From: Mail Delivery Subsystem [email protected]
To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary=“n5HBOW8b028034.1245237872/localhost.localdomain”
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

–n5HBOW8b028034.1245237872/localhost.localdomain

The original message was received at Wed, 17 Jun 2009 15:24:32 +0400
from localhost.localdomain [127.0.0.1]

----- The following addresses had permanent fatal errors -----
[email protected]
(reason: 550 We do not accept mail from dynamic IPs (77.105.136.28). Please contact [email protected])

----- Transcript of session follows -----
… while talking to mxs.mail.ru.:

RCPT To:[email protected]
<<< 550 We do not accept mail from dynamic IPs (77.105.136.28). Please contact [email protected]
550 5.1.1 [email protected]… User unknown

–n5HBOW8b028034.1245237872/localhost.localdomain
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Received-From-MTA: DNS; localhost.localdomain
Arrival-Date: Wed, 17 Jun 2009 15:24:32 +0400

Final-Recipient: RFC822; [email protected]
Action: failed
Status: 5.1.1
Remote-MTA: DNS; mxs.mail.ru
Diagnostic-Code: SMTP; 550 We do not accept mail from dynamic IPs (77.105.136.28). Please contact [email protected]
Last-Attempt-Date: Wed, 17 Jun 2009 15:24:32 +0400

–n5HBOW8b028034.1245237872/localhost.localdomain
Content-Type: message/rfc822

Return-Path: [email protected]
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id n5HBOW8b028032
for [email protected]; Wed, 17 Jun 2009 15:24:32 +0400
Received: (from nagios@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id n5HBOW1n028031
for [email protected]; Wed, 17 Jun 2009 15:24:32 +0400
Date: Wed, 17 Jun 2009 15:24:32 +0400
From: [email protected]
Message-Id: [email protected]
To: [email protected]
Subject: ** PROBLEM Service Alert: Server_NAGIOS/Total Processes is WARNING **

***** Nagios *****

Notification Type: PROBLEM

Service: Total Processes
Host: Server_NAGIOS
Address: 10.0.10.94
State: WARNING

Date/Time: Wed Jun 17 15:24:32 MSD 2009

Additional Info:

PROCS WARNING: 158 processes

–n5HBOW8b028034.1245237872/localhost.localdomain–

:frowning:

Here is my configs:
the part from commands.cfg

‘notify-host-by-email’ command definition

define command{
command_name notify-host-by-email
command_line /usr/bin/printf “%b” “***** Nagios ***\n\nNotification
Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTA
DDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "
$
NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
}

‘notify-service-by-email’ command definition

define command{
command_name notify-service-by-email
command_line /usr/bin/printf “%b” “***** Nagios ***\n\nNotification
Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress:
$HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "
$NOTIFICATIONTYPE$ Service Alert:
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}

from contacts.cfg

define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user

    email                           [[email protected]](mailto:[email protected])         ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
    }

PLEASE HELP ME … :cry:
Thanks!

why didn’t you open a new thread? :frowning:

anyway your problem is here: (reason: 550 We do not accept mail from dynamic IPs (77.105.136.28). Please contact [email protected])
not much to help.

Thanks! It works with another mail server! :stuck_out_tongue:
www.mail.ru - Don’t work
www.gmail.com - work correctly, I have recieved many messages from nagios! :stuck_out_tongue: