Re: [Nagios-users] external notification commands

2007-01-24 Thread Brian Loe
On 1/24/07, Marc Powell <[EMAIL PROTECTED]> wrote:

> > Okay, did that, it created the file but didn't put anything in it.
> >
>
> Well, then the script is being called but doesn't output anything. Is
> that normal? It's looking more and more to me that you need to get more
> verbose output from the 'client' program. Everything we've done so far
> indicates that nagios is doing exactly what it's supposed to.
>
> --
> Marc

The client app, once a message has been sent, responds with a message
saying its been cued. Along the lines of, "Message accepted - Entry
queued for delivery" so I would have expected the log file to contain
that at least.

-
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


Re: [Nagios-users] external notification commands

2007-01-24 Thread Marc Powell


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:nagios-users-
> [EMAIL PROTECTED] On Behalf Of Brian Loe
> Sent: Wednesday, January 24, 2007 11:21 AM
> To: Marc Powell
> Cc: Nagios Users mailinglist
> Subject: Re: [Nagios-users] external notification commands
> 
> On 1/24/07, Marc Powell <[EMAIL PROTECTED]> wrote:
> 
> >
> > Try this to see if the program is reporting any errors --
> >
> > # 'notify-by-pager' command definition
> > define command{
> >command_namenotify-by-pager
> >command_line/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 2>&1
> >
> 
> Okay, did that, it created the file but didn't put anything in it.
> 

Well, then the script is being called but doesn't output anything. Is
that normal? It's looking more and more to me that you need to get more
verbose output from the 'client' program. Everything we've done so far
indicates that nagios is doing exactly what it's supposed to.

--
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


Re: [Nagios-users] external notification commands

2007-01-24 Thread Brian Loe
On 1/24/07, Marc Powell <[EMAIL PROTECTED]> wrote:

>
> Try this to see if the program is reporting any errors --
>
> # 'notify-by-pager' command definition
> define command{
>command_namenotify-by-pager
>command_line/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 2>&1
>

Okay, did that, it created the file but didn't put anything in it.

-
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


Re: [Nagios-users] external notification commands

2007-01-24 Thread Marc Powell


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:nagios-users-
> [EMAIL PROTECTED] On Behalf Of Brian Loe
> Sent: Wednesday, January 24, 2007 8:21 AM
> To: Nagios Users mailinglist
> Subject: Re: [Nagios-users] external notification commands
> 
> On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
> > > > Well, I really don't get this. That worked. If I just copy and
paste
> > > > that output (from echo) to the command line it works fine...
> > > >

[chop]

> 
> So, any other thoughts on this? Running it in echo I see that the
> command line is correct for this application, and I know that it is
> configured to run correctly but it still doesn't get ran.

Well, it should be working. Stepping through the process --
1) nagios is running the notification command as necessary
2) the notification command is properly formatted (seen by echo
output)
3) the notification command succeeds when run as the nagios user
from the command line

That really should be sufficient. The only other issue I can think of is
that your pager program relies on some program, path, environment
variable or library that is available when in a login shell but
unavailable to forked processes. Do you set any special variables,
aliases or anything in your login scripts? Can the people that wrote it
provide any insight or add debugging code to the program?

Try this to see if the program is reporting any errors --

# 'notify-by-pager' command definition
define command{
   command_namenotify-by-pager
   command_line/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 2>&1

--
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


Re: [Nagios-users] external notification commands

2007-01-24 Thread Brian Loe
On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
> > > Well, I really don't get this. That worked. If I just copy and paste
> > > that output (from echo) to the command line it works fine...
> > >
> > What permissions would that application need to have for Nagios to run
> it?
> > drwxr-xr-x   /usr/local/pager
> > -rwxrwxrwx client
>
> These look fine (probably). Is 'client' a script or program that you
> wrote or have visibility into? What does it do exactly.
>

So, any other thoughts on this? Running it in echo I see that the
command line is correct for this application, and I know that it is
configured to run correctly but it still doesn't get ran.

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Brian Loe
On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
>
> These look fine (probably). Is 'client' a script or program that you
> wrote or have visibility into? What does it do exactly.

It is an application written in-house in C, I don't have any
visibility into it but it basically just sends a message to its server
component that then dials out to the paging company and sends the
message.

I've ran it as myself, nagios and root - they all work.

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Marc Powell


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:nagios-users-
> [EMAIL PROTECTED] On Behalf Of Brian Loe
> Sent: Tuesday, January 23, 2007 3:01 PM
> To: Marc Powell
> Cc: Nagios Users mailinglist
> Subject: Re: [Nagios-users] external notification commands
> 
> On 1/23/07, Brian Loe <[EMAIL PROTECTED]> wrote:
> > On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
> >
> > > # 'notify-by-pager' command definition
> > > define command{
> > >command_namenotify-by-pager
> > >command_lineecho '/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
> > >}
> >
> > Well, I really don't get this. That worked. If I just copy and paste
> > that output (from echo) to the command line it works fine...
> >
> What permissions would that application need to have for Nagios to run
it?
> drwxr-xr-x   /usr/local/pager
> -rwxrwxrwx client

These look fine (probably). Is 'client' a script or program that you
wrote or have visibility into? What does it do exactly.

--
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Marc Powell


> -Original Message-
> From: Brian Loe [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 23, 2007 2:58 PM
> To: Marc Powell
> Cc: Nagios Users mailinglist
> Subject: Re: [Nagios-users] external notification commands
> 
> On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
> 
> > # 'notify-by-pager' command definition
> > define command{
> >command_namenotify-by-pager
> >command_lineecho '/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
> >}
> 
> Well, I really don't get this. That worked. If I just copy and paste
> that output (from echo) to the command line it works fine...

That's a good start. Did you run your test as the nagios user? Perhaps
your client script accesses some script/program/device that only root
has permissions to use.

--
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Brian Loe
On 1/23/07, Brian Loe <[EMAIL PROTECTED]> wrote:
> On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
>
> > # 'notify-by-pager' command definition
> > define command{
> >command_namenotify-by-pager
> >command_lineecho '/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
> >}
>
> Well, I really don't get this. That worked. If I just copy and paste
> that output (from echo) to the command line it works fine...
>
What permissions would that application need to have for Nagios to run it?
drwxr-xr-x   /usr/local/pager
-rwxrwxrwx client

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Brian Loe
On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:

> # 'notify-by-pager' command definition
> define command{
>command_namenotify-by-pager
>command_lineecho '/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
>}

Well, I really don't get this. That worked. If I just copy and paste
that output (from echo) to the command line it works fine...

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Marc Powell


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:nagios-users-
> [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> 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_namenotify-by-pager
>command_lineecho /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_namenotify-by-pager
   command_lineecho '/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@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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Brian Loe
On 1/23/07, Josh Yost <[EMAIL PROTECTED]> wrote:
> Hi,
>
> You should be able to backslash the quotes you need it to print:
> $ echo "\"hi\""
>
> I'm not sure where above you would want them, maybe something like
> \"$SOMEMACRO$\" \"$SOMEOTHERMACRO$\" ?
>
> - Josh
>

The app I'm using takes two variables:

/client  ""

Contact name I have defined in contacts.cfg as address1. The message
has to be quoted when handed to the app. I would think this would work
- as it does for sendmail which has the same requirements...I thought.

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Brian Loe
On 1/23/07, Marc Powell <[EMAIL PROTECTED]> 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_namenotify-by-pager
   command_lineecho /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
   }


Result:
/usr/local/pager/client networktech Service: NSLookupnHost:
dns2nAddress: xx.xxx.xx.xxxnState: CRITICALnInfo: DNS CRITICAL -
expected xx.xxx.xx.yyy but got xx.xxx.xx.zzznDate: Tue Jan 23 13:32:48
CST 2007 PROBLEM: dns2/NSLookup is CRITICAL

So I was wrong a bit, it's filling in the IPs and hostnames...

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Josh Yost
Brian Loe wrote:
> On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
>> If the notification is being called but you don't see what you expect in
>> your notification script, echo the command that nagios is running to a
>> file to see if it's what you think it's supposed to be --
>>
>> define command {
>> command_name   my_special_notification
>> command_line   echo "$USER1$/my-notification-script
>> $SOMEMACRO$ $SOMEOTHERMACRO$" >> /tmp/nagios-runs-me
>> }
>>
>> After nagios calls 'my_special_notification', the file
>> /tmp/nagios-runs-me will contain the full command line that nagios
>> _would_ have executed if it had really run the command.
>>
> 
> 
> 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
> variables have been filled in within the quotes that are there
> (perhaps because it was an echo, and the echo command wiill take
> anything with quotes as strings?).

Hi,

You should be able to backslash the quotes you need it to print:
$ echo "\"hi\""

I'm not sure where above you would want them, maybe something like
\"$SOMEMACRO$\" \"$SOMEOTHERMACRO$\" ?

- Josh

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Marc Powell


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:nagios-users-
> [EMAIL PROTECTED] On Behalf Of Brian Loe
> Sent: Tuesday, January 23, 2007 1:29 PM
> To: Marc Powell
> Cc: Nagios Users mailinglist
> Subject: Re: [Nagios-users] external notification commands
> 
> On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
> >
> > If the notification is being called but you don't see what you
expect in
> > your notification script, echo the command that nagios is running to
a
> > file to see if it's what you think it's supposed to be --
> >
> > define command {
> > command_name   my_special_notification
> > command_line   echo
"$USER1$/my-notification-script
> > $SOMEMACRO$ $SOMEOTHERMACRO$" >> /tmp/nagios-runs-me
> > }
> >
> > After nagios calls 'my_special_notification', the file
> > /tmp/nagios-runs-me will contain the full command line that nagios
> > _would_ have executed if it had really run the command.
> >
> 
> 
> 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.

> variables have been filled in within the quotes that are there
> (perhaps because it was an echo, and the echo command wiill take
> anything with quotes as strings?).

Nope. If you're using valid nagios $MACROS$ then nagios will do the all
the substitutions before the echo is even called so you should see the
actual full command line exactly as it is run.

--
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Brian Loe
On 1/23/07, Marc Powell <[EMAIL PROTECTED]> wrote:
>
> If the notification is being called but you don't see what you expect in
> your notification script, echo the command that nagios is running to a
> file to see if it's what you think it's supposed to be --
>
> define command {
> command_name   my_special_notification
> command_line   echo "$USER1$/my-notification-script
> $SOMEMACRO$ $SOMEOTHERMACRO$" >> /tmp/nagios-runs-me
> }
>
> After nagios calls 'my_special_notification', the file
> /tmp/nagios-runs-me will contain the full command line that nagios
> _would_ have executed if it had really run the command.
>


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
variables have been filled in within the quotes that are there
(perhaps because it was an echo, and the echo command wiill take
anything with quotes as strings?).

-
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


Re: [Nagios-users] external notification commands

2007-01-23 Thread Marc Powell


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:nagios-users-
> [EMAIL PROTECTED] On Behalf Of Brian Loe
> Sent: Tuesday, January 23, 2007 12:45 PM
> To: Nagios Users mailinglist
> Subject: [Nagios-users] external notification commands
> 
> I have a notification configured to run an app and pass it Nagios
> parameters. For what ever reason I can watch the log and see a device
> go critical, but it never runs the notification command, or, if it
> does, it doesn't work.
> 
> Any way to see deeper into this process?

Make sure you have log_notifications=1 in nagios.cfg. Then you'll be
able to see in nagios.log whether your notification is being called. If
it is not then it's a simple configuration issue (notifications not
enabled globally, not enabled specifically for that host or service or
for that specific contact).

If the notification is being called but you don't see what you expect in
your notification script, echo the command that nagios is running to a
file to see if it's what you think it's supposed to be --

define command {
command_name   my_special_notification
command_line   echo "$USER1$/my-notification-script
$SOMEMACRO$ $SOMEOTHERMACRO$" >> /tmp/nagios-runs-me
}

After nagios calls 'my_special_notification', the file
/tmp/nagios-runs-me will contain the full command line that nagios
_would_ have executed if it had really run the command.

If the notification is being called, modify your notification script to
output interesting information to a log file. In all my event handlers
the first thing it does is log the parameters it was called with ala --

LOGFILE=/usr/local/nagios/var/eventhandler.log; export LOGFILE

echo -n `date` . " " >> $LOGFILE 2>&1
echo "winbind service check ($1) ($2) ($3) ($4)... " >> $LOGFILE 2>&1

Whenever there's something interesting happening, I log that --

echo -n `date` . " " >> $LOGFILE 2>&1
echo -n "Restarting winbind service (2nd soft critical state) on $4... "
>> $LOGFILE 2>&1
# Call the init script to restart the winbind server
/usr/bin/ssh $4 'sudo /etc/init.d/winbind restart' >>$LOGFILE 2>&1

I also log if I don't do anything. I log errors from the scripts that I
call from my event handler or anything else that might be interesting. I
presume there's no reason you couldn't do this in your expanded
notification script and you have no real limitations on how verbose you
make the process.

--
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


[Nagios-users] external notification commands

2007-01-23 Thread Brian Loe
I have a notification configured to run an app and pass it Nagios
parameters. For what ever reason I can watch the log and see a device
go critical, but it never runs the notification command, or, if it
does, it doesn't work.

Any way to see deeper into this process?

-
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