Using macros in notification commands
Subhendu Ghosh
sghosh at sghosh.org
Thu Mar 13 21:51:09 CET 2003
On Thu, 13 Mar 2003, Colby, James wrote:
> Hello -
>
> I was wondering if it is possible to use macro's in a notification
> command. I am beginning in suspect that it is not after trying to set
> one up. What I am trying to do is to create a generic command that will
> send a winpop notification when a service/host is in trouble. I do not
> want to have to create a separate win popup notification command for
> each of my contacts, so I would like to be able to pass the machine name
> to my notification command. Here is what I have tried so far:
>
> Misccommands.cfg:
> define command{
> command_name host-notify-by-winpopup
> command_line /usr/bin/printf "%b" "Host '$HOSTALIAS$' is
> $HOSTSTATE$, Info: $OUTPUT$, Time: $DATETIME$" |
> /usr/local/samba/bin/smbclient -M $ARG1$
> }
>
> Contacts.cfg:
> define contact{
> contact_name jcolby
> alias jcolby
> service_notification_period 24x7
> host_notification_period 24x7
> service_notification_options w,u,c,r
> host_notification_options d,u,r
> service_notification_commands
> service-notify-by-email,service-notify-by-epager
> host_notification_commands
> host-notify-by-email, host-notify-by-winpopup!jcolby-xp
> email <jcolby at enterasys.com>
> }
>
> When I check my config with nagios -v nagios.cfg it reports an error
> that notification command host-notify-by-winpopup!jcolby-xp does not
> exist. I am assuming that means that I cannot use the macros in my
> misccomands.cfg file the same way that I can use them in the
> checkcommands.cfg file. Is that correct, or am I just doing something
> wrong.
>
> Thank you very much.
> James
>
You cannot specify an argument in the contact definition
ie "host-notify-by-winpopup!jcolby-xp" is treated as a command definition
not a command definition with an argument...
You can define the "host-notify-by-winpopup" to send the popoup to the
contactalias if you follow a convention of having the contact alias point
to the hostname they are logged onto.
Check "http://nagios.sourceforge.net/docs/1_0/macros.html" to see what
macro are available.
--
-sg
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
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