external notification commands

Marc Powell marc at ena.com
Tue Jan 23 21:16:36 CET 2007



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Brian Loe
> Sent: Tuesday, January 23, 2007 1:52 PM
> To: Marc Powell
> Cc: Nagios Users mailinglist
> Subject: Re: [Nagios-users] external notification commands
> 
> On 1/23/07, Marc Powell <marc at ena.com> wrote:
> >
> > > Doing what you suggest I see that it IS running the notification,
> > > except that the quotation marks are lost (which my external app
> > > actually needs  - so maybe I can double them up?) and none of the
> >
> > I'm not sure what you mean. Post what you ended up with. Were they
lost
> > because I used double-quotes and you use double-quotes? If so,
change
> > mine to single-quotes.
> Check command:
> # 'notify-by-pager' command definition
> define command{
>        command_name    notify-by-pager
>        command_line    echo /usr/local/pager/client $CONTACTADDRESS1$
> ""Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress:
> $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate:
> $LONGDATETIME$ $NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is
> $SERVICESTATE$"" >> /tmp/nagios_notification.log
>        }

Shell Scripting 101: quoting as above is nulls your quotes. You open a "
then immediately close it leaving the rest to be interpreted as
arguments to the echo command. Plus, you want the echo to be the entire
command. What you want for this testing is --

# 'notify-by-pager' command definition
define command{
       command_name    notify-by-pager
       command_line    echo '/usr/local/pager/client $CONTACTADDRESS1$
"Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress:
$HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate:
$LONGDATETIME$ $NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is
$SERVICESTATE$"' >> /tmp/nagios_notification.log
       }

__
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





More information about the Users mailing list