$HOSTNAME$
Stanley Hopcroft
Stanley.Hopcroft at IPAustralia.Gov.AU
Fri May 16 11:25:59 CEST 2003
Dear Sir,
I am writing to thank you for your letter and sauggest that your report
is consistent (as you say) with the macro not being replaced in the
command line handed to /bin/sh
On Fri, May 16, 2003 at 10:21:13AM +0200, Fred Albrecht wrote:
> Hi
>
> Is this a bug? I don't get the host associated with the service when I try to use $HOSTNAME$ as a macro when sending service notifications. Instead I get my local shell environment variable $HOSTNAME. In other words, if I run nagios on box X, monitoring a service A on box Z, then I get X as my $HOSTNAME$ instead of Z. Should I be defining my commands differently perhaps?
>
> my notify-by-email command has changed to this:
> define command {
> command_name host-notify-by-email
> command_line /usr/local/nagios/libexec/host-notify-by-email.pl "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTALIAS$" "$OUTPUT$" "$DATETIME$" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
> }
>
You could try
. inserting a space between 'NAME$' and '!' (in case the Nag lexer is
looking for white space or end of string)
. if pain persists, then run up a Test Nag built with --enable-DEBUG4
and run it with check_dummy (reporting critical on a stripped
config). The interesting stuff will be visible when you run it in
foreground.
This is a straightforward procedure. All you need do is
. feed configure your options + debug + a new prefix (so it doesn't
use your prod config
. install it into the test (--prefix) path
. strip your config and make it notify you often
. run it in foreground (no -d)
This should make the case plane for a Nag bug.
> where I wrote my own script to form my email (/usr/local/nagios/libexec/host-notify-by-email.pl).
>
>
(if /bin/sh can run it, it'll work).
Yours sincerely.
--
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------
'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'
from Meditation 17, J Donne.
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
_______________________________________________
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