Nagios Notifications

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Fri Jan 30 06:00:59 CET 2004


On Thu, Jan 29, 2004 at 08:11:38PM -0800, nagios-users-request at lists.sourceforge.net wrote:
> 
> Message: 4
> From: Ron Huff <rwhuff at ucdavis.edu>
> Organization: UCD NOC
> Date: Thu, 29 Jan 2004 10:24:09 -0800
> 
> I need help just setting up a simple notification command to use sendmail.
> I have sendmail functioning at the most basic level (I can send myself mail).
>

Unless the Nagios host lacks the ability to forward messages or directly 
deliver them to your recipients there is no need for any sendmail 
changes whatsover.

OTOH, if that is _not_ the case, then in my view you will have to 
seriously consider learning more about your MTA (which may be sendmail).
 
> Would someone send me a simple, 'command_line' for the checkcommands.cfg
> file that uses sendmail...the sample configs just invoke 'printf' ...I just 
> need a little boost over this hurdle, rather than spending days digging thru 
> sendmail docs...

# 'notify-by-email' command definition
define command{
        command_name    notify-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios 1.2
*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: 
$SERVICEDESC$\nHost: $HOSTNAME$\n
Address: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: 
$DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /usr/bin/mail -s "** 
$NOTIFICATIONTYPE$ alert - $
HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

1 Printf is simply used to format the notification message

You can change the format and the content of by varying its arguments

2 Mail is actually sent with a 'Mail User Agent', in this case 
/usr/bin/mail.

If you have a Linux/Unix box you have a CLI mailer like mail or mailx.

Locate mail or whereis mail will find it.

Printf sends its message through a pipe '|' to the MUA. The MUA in turn 
hands it to the MTA (sendmail, postfix, exchange and so on) for 
delivery.


> - Ron Huff / UCD NOC
> 

Yours sincerely.
-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list