On Dec 29, 2009, at 9:01 AM, Jorge Gil wrote:
> # '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$" | /usr/bin/mail -s "**
> $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$
> **" $CONTACTEMAIL$
>
> }
This looks typical.
> i wasnt getting emails.
Emails for what and how were they being instigated? Did you have a service
failure and not receive a notification? Does nagios.log show NOTIFICATION
entries? Does /var/log/maillog show an attempt to send?
> Now a simplified version of the command:
>
>
> # 'notify-service-by-email' command definition
>
> define command{
>
> command_name notify-service-by-email
>
> command_line printf "%b" "$HOSTADDRESS$" | /usr/bin/mail -s Subject_of_email
> my_email_address
>
> }
>
> does send me emails, but it doesnt translate the hostaddress, i get just a
> dollar sign in the body of the email.
A '$' in the body means that you either have a typo in the $MACRONAME$ or the
macro isn't valid for the type of notification you are trying to send.
$HOSTADDRESS$ is valid for all notification types so you should verify you
don't have a typo in the macro name.
http://nagios.sourceforge.net/docs/3_0/macrolist.html
An alternative is that you aren't actually calling these as notification
commands but as event_handlers. Using a notification command as an
event_handler is not proper. It should be listed in the appropriate contact{}
definition as host/service_notification_command (off the top of my head).
--
Marc
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Nagios-users mailing list
[email protected]
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