[Xymon] html_mail1.2 is using simple hostname instead of FQDN in the link in the message

David Baldwin david.baldwin at ausport.gov.au
Wed May 23 03:47:40 CEST 2012


Christian,
>
> Hello out there,
>
>  
>
> Perhaps there’s anybody else using alerts:html_mail1.2 which is
> available from http://xymonton.org/alerts:html_mail1.2
>
>  
>
I do! I wrote the latest version, some updates still pending.
>
> I’ve set it up and i’ve done some changes to the way it sends the
> subject and the body. All of this is working fine.
>
> There’s one thing that makes me wonder and I’ve tried a bit for me,
> but I’m concerned why I cannot get this to work.
>
> The body of the eMails coming from the perl script contains a link to
> the affected host, for example:
>
>  
>
> http://XYMONHOST/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http
> <http://XYMONHOST/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http>
>
>  
>
> But I need to have the link as follows:
>
>  
>
> http://XYMONHOST.FULL-QUALIFIED-DOMAIN/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http
> <http://XYMONHOST.FULL-QUALIFIED-DOMAIN/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http>
>
>  
>
If you look at the perl code, these URLs are constructed using exactly
what xymon has as in its config files.
>
>  
>
> This is due to the fact that we do monitoring for different customers
> having their Xymon servers with different domain names.
>
>  
>
> For example, we have a Xymon server xymonA.domainA.org and another one
> called xymonB.domainB.org.
>
>  
>
> Therefore I need the fully qualified hostname in the link.
>
>  
>
> While reviewing the perl code of the script I recognized a section
> “Retrieve the data from the environment variables”.
>
> Within there I inserted a line
>
>  
>
> $BBSERVERHOSTNAME = $ENV{‘BBSERVERHOSTNAME’} || “”;
>
>  
>
> The syntax is the same as for the other variables. Then I changed the
> line containing the subject for the eMail to contain this variable
> instead of $BBSERVERWWWNAME.
>
> As last step I changed the setting for the XYMONSERVERHOSTNAME (which
> is also set as BBSERVERHOSTNAME) in xymonserver.cfg.
>
>  
>
> After restarting the xymon services and the webserver I’m still
> getting eMails containing the link WITHOUT having the fully qualified
> hostname.
>
>  
>
> I’m NOT getting entries in /var/log/xymon/alert.log saying that the
> variable $BBSERVERHOSTNAME is uninitialized.
>
> When commenting out the line
>
> $BBSERVERHOSTNAME = $ENV{‘BBSERVERHOSTNAME’} || “”;
>
> in the perl script, then I get this message.
>
>  
>
> For me this means, that I might have done the most things the right
> way; didn’t i? Anybody out there having an idea?
>
>  
>
> Sorry if my english isn’t at 100%....
>
>  
>
The $BBSERVERWWWNAME variable is what is used for the hostname in the
URL section.

If you have separate servers I suggest 2 options:
1) change the BBSERVERWWWNAME variable in the server.cfg file on each server
2) hack the perl code to hard-code the BBSERVERWWWNAME variable on each
server.

The easiest way to test the script is to set up a special alert rule for
a testing host/service combination in alerts.cfg - e.g.

HOST=testhost SERVICE=testname
    SCRIPT /path/to/html_mail.pl testalias COLOR=red

Then send red status updates using the xymon command - e.g. (on the
xymon server)

xymon localhost "status testhost.testname red html_mail test"

Send a green status to reset and then repeat to trigger the script again.
This should not require restarting services at all.

David.

-- 
David Baldwin - Senior Systems Administrator (Datacentres + Networks)
Information and Communication Technology Services
Australian Sports Commission          http://ausport.gov.au
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
david.baldwin at ausport.gov.au          Leverrier Street Bruce ACT 2617


-------------------------------------------------------------------------------------
Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au

This message is intended for the addressee named and may contain confidential and privileged information. If you are not the intended recipient please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you receive this message in error, please delete it and notify the sender.
-------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20120523/f511fb8d/attachment.html>


More information about the Xymon mailing list