Hi Marc

I changed the command in the misccomands.cfg to the one you suggest,
it creates the file, and here is the output.

I supress some of my host and IP information.

bash-3.00# more /tmp/host-notify

/usr/bin/printf "%b" "***** Nagios *****

Notification Type: PROBLEM
Host: host.xx-xx.xx.x
State: DOWN
Address: 200.000.00.00
Info: CRITICAL - Plugin timed out after 10 seconds

Date/Time: Fri Jul 28 10:27:14 BRT 2006
" | /usr/bin/mail -s "Host DOWN alert for host.xx-xx.xx.x!" [EMAIL PROTECTED]

Information about my OS:

SunOS 5.10 Generic_118844-26 i86pc i386 i86pc

I notice somethig:

bash-3.00# printf TEST123 | mail -s "test mail to felipe" [EMAIL PROTECTED]

Without the "!" in the end of the subject it was sent with no problems

bash-3.00# printf TEST123 | mail -s "test mail to felipe!" [EMAIL PROTECTED]
bash: !": event not found

and now with the "!" in the end of the -s parameter. It wasnt send to me...

I will try to change the command

2006/7/26, Marc Powell <[EMAIL PROTECTED]>:
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Felipe
> > Tocchetto
> > Sent: Wednesday, July 26, 2006 2:54 PM
> > To: Marc Powell
> > Cc: Nagios Users Mailinglist
> > Subject: Re: [Nagios-users] not receiving the nagios notifications
> >
> > Hi Marc
> >
> > Thaks for your effort in help me.
> >
> > Here is the commands outputs
> >
> > bash-3.00$ /bin/echo '/usr/bin/printf "%b" "***** Nagios
> > *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost:
> > $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:
> > $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "Host
> > $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$' >> /tmp/host-notify
> >
>
> I meant for you to replace your current command_line in your 
> host-notify-by-email command{} definition and trigger a failure again. After 
> a notification attempt had been made by nagios, look at the contents of 
> /tmp/host-notify for the command that nagios would have attempted to execute. 
> I am attempting to discern _exactly_ what it is nagios is trying to do when 
> it sends the notification and whether that actually works when you try it 
> manually. There just might be different behavior when the macros get filled 
> with appropriate data that we're missing. It's a stretch but I'm running out 
> of ideas myself.
>
> It's good that you did this though as I can see that on whatever OS you are 
> running the default behavior of echo is to interpret backslash-escaped 
> characters (\n). You must determine from the echo man page (man echo) the 
> command line switch to disable that and add it after '/bin/echo' in the 
> command_line definition. It's probably -E so you would use "/bin/echo -E 
> '/usr/bin/printf..."
>
> --
> Marc
>
> >
> > 2006/7/26, Marc Powell <[EMAIL PROTECTED]>:
> > > I'm running out of ideas. Try changing your notify command_line to be --
> > >
> > >        command_line    /bin/echo '/usr/bin/printf "%b" "***** Nagios
> > *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
> > $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
> > $LONGDATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for
> > $HOSTNAME$!" $CONTACTEMAIL$' >> /tmp/host-notify
> > >
> > > Make sure it's all one line. After a notification attempt, the file
> > /tmp/host-notify will contain the command line that nagios would have
> > executed. Try running that as the nagios user.
> > >
> > > --
> > > Marc
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
> > Felipe
> > > > Tocchetto
> > > > Sent: Tuesday, July 25, 2006 4:31 PM
> > > > To: Marc Powell
> > > > Cc: Nagios Users Mailinglist
> > > > Subject: Re: [Nagios-users] not receiving the nagios notifications
> > > >
> > > > Hi Marc
> > > >
> > > > Here some tests
> > > >
> > > > The command:
> > > >
> > > > id;/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: Host
> > > > Notification\nHost: teste.xxx.xxxx.br\nState: CRITICAL\nAddress:
> > > > 200.xxx.xx.xx\nInfo: CRITICAL - Plugin timed out after 10
> > > > seconds\n\nDate//Time: 24/07/2006 11:11:11\n" | /usr/bin/mail -s
> > > > "alert" [EMAIL PROTECTED]
> > > >
> > > > just 1 line!
> > > >
> > > > The output for the command:
> > > >
> > > > uid=100(nagios) gid=1(other)
> > > >
> > > > And I receive the email:
> > > >
> > > > ***** Nagios *****
> > > >
> > > > Notification Type: Host
> > > > Notification
> > > > Host: teste.xxx.xxxx.br
> > > > State: CRITICAL
> > > > Address:
> > > > 200.xxx.xx.xx
> > > > Info: CRITICAL - Plugin timed out after 10
> > > > seconds
> > > >
> > > > Date/Time: 24/07/2006 11:11:11
> > > >
> > > > All commands are in just 1 line...
> > > >
> > > > I am using the default commands from the nagios instalation, I didnĀ“t
> > > > change anything.
> > > >
> > > >
> > > >
> > > > 2006/7/24, Marc Powell <[EMAIL PROTECTED]>:
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: [EMAIL PROTECTED] [mailto:nagios-
> > users-
> > > > > > [EMAIL PROTECTED] On Behalf Of Felipe Tocchetto
> > > > > > Sent: Monday, July 24, 2006 3:34 PM
> > > > > > To: Nagios Users Mailinglist
> > > > > > Subject: Re: [Nagios-users] not receiving the nagios notifications
> > > > > >
> > > > > > I am using the default command.
> > > > > >
> > > > > > Manually it works, without the vars.
> > > > > > Thanks a lot.
> > > > > >
> > > > > > I really dont know how to fix it.
> > > > >
> > > > >
> > > > > I see a couple more things that I originally attributed to my mail
> > > > > client formatting of your original message. They may actually be
> > > > > problems with your config.
> > > > >
> > > > > # 'host-notify-by-email' command definition
> > > > > define command{
> > > > >        command_name    host-notify-by-email
> > > > >        command_line    /usr/bin/printf "%b" "***** Nagios
> > > > > *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\
> > > > > nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:
> > > > > $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s
> > "Host
> > > > > $HOS
> > > > > TSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
> > > > >        }
> > > > >
> > > > > In the above definition I see a carriage returns between
> > "$HOSTNAME\"
> > > > > and "nState:" as well as between "Host $HOS" and "TSTATE$". Do they
> > > > > really exist in your config file? They should not. If no, can you
> > send
> > > > > the output of the following command when run as the nagios user?
> > > > >
> > > > > id;/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type:
> > Host
> > > > > Notification\nHost: teste.xxx.xxxx.br\nState: CRITICAL\nAddress:
> > > > > 200.xxx.xx.xx\nInfo: CRITICAL - Plugin timed out after 10
> > > > > seconds\n\nDate/Time: 24/07/2006 11:11:11\n" | /usr/bin/mail -s
> > "Host
> > > > > CRITICAL alert for Test Machine!"  [EMAIL PROTECTED]
> > > > >
> > > > >
> > > > >
> > > > > ------
> > > > >
> > > > > # 'notify-by-email' command definition
> > > > > define command{
> > > > >        command_name    notify-by-email
> > > > >        command_line    /usr/bin/printf "%b" "***** Nagios
> > > > > *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVI
> > > > > CEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
> > > > > $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\
> > > > > n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert -
> > > > > $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTE
> > > > > MAIL$
> > > > >        }
> > > > >
> > > > > In the above command I see a carriage returns between "$SERIV" and
> > > > > "CEDESC$" as well as between "$CONTACTE" and "MAIL$". Do they really
> > > > > exist in your config file? They should not.
> > > > >
> > > > > --
> > > > > Marc
> > > > >
> > > > > --------------------------------------------------------------------
> > ----
> > > > -
> > > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > > Join SourceForge.net's Techsay panel and you'll get the chance to
> > share
> > > > your
> > > > > opinions on IT & business topics through brief surveys -- and earn
> > cash
> > > > >
> > > >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > > _______________________________________________
> > > > > Nagios-users mailing list
> > > > > Nagios-users@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
> > > > >
> > > >
> > > >
> > > > --
> > > > Felipe L. Tocchetto
> > > > http://felipe.tocchetto.com
> > >
> >
> >
> > --
> > Felipe L. Tocchetto
> > http://felipe.tocchetto.com
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Nagios-users mailing list
> Nagios-users@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
>


-- 
Felipe L. Tocchetto
http://felipe.tocchetto.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nagios-users mailing list
Nagios-users@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

Reply via email to