Your Mail Command
Andreas Ericsson
ae at op5.se
Wed Oct 13 15:56:13 CEST 2004
Josiah Ritchie wrote:
> Just out of dull curiosity and wondering if I can learn something or get
> some good ideas for improvement, I'm wondering if everyone wouldn't mind
> sharing the command they use to send email from nagios out to others.
>
We do it something like this:
notify -m "$CONTACTEMAIL$" -p "$CONTACTPAGER$" -u "$CONTACTNAME$" -t
"$NOTIFICATIONTYPE$" HOSTNAME="$HOSTNAME$" SERVICEDESC="$SERVICEDESC$"
and so on.
It's really quite nifty, because it lets us use skins to format the
email in a much prettier way than pasting an entire message body in the
configuration file. It would be simple to select a skin of a particular
language based on locale settings. The skin-file is selected based on
notification type and whether it's an email or pager notification (it
handles both in one go). Each user can also have their own message look
if they like, without specifying a load of different and annoyingly long
notification commands.
> I'll start:
> /usr/bin/printf "Subject: ** $NOTIFICATIONTYPE$ alert -
> $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n **\n %b" "***** Nagios
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
> $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" |
> /usr/sbin/ssmtp $CONTACTEMAIL$
>
> This is mostly the default modified so that I can use ssmtp, a simple ssmtp
> daemon allowing me to send email to others, but it does not receive
> anything. Configuration is also incredibly simple. I use it on a number of
> my Gentoo boxes so they can talk back to me. I moved the Subject line into
> the first line of the body of the message to be compatible with ssmtp.
>
> JSR/
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> 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
>
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Lead Developer
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
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