not receiving the nagios notifications

Marc Powell marc at ena.com
Thu Jul 27 00:30:07 CEST 2006



> -----Original Message-----
> From: tocchetto at gmail.com [mailto:tocchetto at gmail.com] 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 <marc at ena.com>:
> > 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: tocchetto at gmail.com [mailto:tocchetto at gmail.com] 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" felipe at tocchetto.com
> > >
> > > 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 <marc at ena.com>:
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-
> users-
> > > > > bounces at lists.sourceforge.net] 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!"  felipe at tocchetto.com
> > > >
> > > >
> > > >
> > > > ------
> > > >
> > > > # '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 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
> > > >
> > >
> > >
> > > --
> > > 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 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