Using $ARGn$ in notify command

Tim Daley Tim.Daley at ccci.org
Tue Dec 5 15:07:41 CET 2006


That syntax is not obvious from
http://monitor.mygcx.org/nagios/docs/xodtemplate.html#contact where it
says:

service_notification_commands: This directive is used to define a list
of the short names of the commands used to notify the contact of a
service problem or recovery. Multiple notification commands should be
separated by commas. All notification commands are executed when the
contact needs to be notified. The maximum amount of time that a
notification command can run is controlled by the notification_timeout
option.

This says it's a list of the "short names of the commands".

However, I find the behavior reasonable given the syntax you employ.


Tim Daley
Campus Crusade for Christ
100 Lake Hart Dr. MC 2900
Orlando, Fl 32832-0100
(407)826-2911

-----Original Message-----
From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Marc
Powell
Sent: Tuesday, December 05, 2006 8:57 AM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Using $ARGn$ in notify command



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-

> bounces at lists.sourceforge.net] On Behalf Of Tim Daley
> Sent: Monday, December 04, 2006 4:05 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Using $ARGn$ in notify command
> 
> I'm attempting to use $ARG1$ in a notify command:
> 
> 
> define service{
>         use                             GCX-website
>         host_name                       staff2.ccci.org
>         service_description             LOGIN-officedepot
>         check_command
>
check_web_login_officedepot!https://staff2.ccci.org/ss/officedepotlogin!
> XXXXX!XXXXX
>         }
> 
> define command{
>         command_name                    check_web_login_officedepot
>         command_line                    $USER1$/check_website -N -s
> $USER10$/check_web_login_officedepot.scr -D HOST=$HOSTNAME$ -D 
> URL=$ARG1$ -D USERNAME=$ARG2$ -D PASSWORD=$ARG3$
>         }
> 
> define command{
>         command_name    notify-by-email-test        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$\n\\nDUMP:\n\
> \nADMINEMAIL: $ADMINEMAIL$ \nADMINPAGER: $ADMINPAGER$ \nARG1: $ARG1$
> \nARG2: $ARG2$ \nARG3: $ARG3$ \nARG4: $ARG4$ \nARG5: $ARG5$ \nARG6:
> $ARG6$ \nARG7: $ARG7$ \nARG8: $ARG8$ \nARG9: $ARG9$ \nARG10: $ARG10$
> \nUSER1: $USER1$ \nUSER2: $USER2$ \nUSER3: $USER3$ \nUSER4: $USER4$
> \nUSER5: $USER5$ \nUSER6: $USER6$ \nUSER7: $USER7$ \nUSER8: $USER8$
> \nUSER9: $USER9$ \nUSER10: $USER10$ " | /bin/mail -s 
> "$HOSTALIAS$/$SERVICEDESC$ $NOTIFICAT IONTYPE$ state is $SERVICESTATE$

> **" $CONTACTEMAIL$
>         }

[snip]

> It looks like the USERn macros are getting through but the ARGn macros

> aren't. What am I doing wrong?

I expect it's an invalid assumption. The notification command really has
no relationship with service check_command in this regard. $USERn$
macros are global and static, $ARGn$ macros are variable and highly
specific to the command being called. I would expect that for every
command executed that the $ARGn$ macros are reset to prevent accidental
intermingling of values. They're set specifically for the service check
to the ones you pass in the check_command for the service and reset
again to nothing when the notification command is called since you
(likely) don't use any in your contact's service_notification_commands.
Another way to look at it by example --

define contact{
   contact_name	marc
	...
	service_notification_commands notify-by-email-test!foo!bar }

In the case above I would expect for the notification that $ARG1$ is foo
and $ARG2$ is bar. I wouldn't want those replaced by the values in the
service check_command.

--
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=DEVDE
V
_______________________________________________
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

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