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

Becker Christian christian.becker at rhein-zeitung.net
Thu May 24 08:52:32 CEST 2012


Hello David,

Bingo! Changing the URL code from

my $link .= "http://$BBSERVERHOSTNAME$BBSERVERCGIURL/bb-hostsvc.sh?HOST=$BBHOSTNAME&SERVICE=$BBSVCNAME";

to

my $link .= "http://$BBSERVERWWWNAME$BBSERVERCGIURL/bb-hostsvc.sh?HOST=$BBHOSTNAME&SERVICE=$BBSVCNAME";

did the trick! (note: I changed the variable $BBSERVERHOSTNAME to $BBSERVERWWWNAME just next to the http:// keyword).

This really was an easy hack, and I think I just have overseen this possibility to change the variable at exactly this position. But this could be due to the fact that I’m not 100% in PERL and then you cannot see everything ;-)

So, at this point, let me say “THANK YOU” for your help!

Regards
Christian



CHRISTIAN BECKER
System Engineer
CSC

August-Horch-Strasse 28, 56070 Koblenz, Germany
Global Outsourcing Services Central Region  |  p: +49.261.98468.45  |  f: +49.261.98468.75  |   cbecker4 at csc.com  |  www.csc.com

Von: David Baldwin [mailto:david.baldwin at ausport.gov.au]
Gesendet: Mittwoch, 23. Mai 2012 03:48
An: Becker Christian
Cc: xymon at xymon.com
Betreff: Re: [Xymon] html_mail1.2 is using simple hostname instead of FQDN in the link in the message

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

But I need to have the link as follows:

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<mailto:david.baldwin at ausport.gov.au>          Leverrier Street Bruce ACT 2617

________________________________
Keep up to date with what's happening in Australian sport visit www.ausport.gov.au<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.
________________________________

________________________________

CSC • This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose • CSC Deutschland Services GmbH • Registered Office: Abraham-Lincoln-Park 1, 65189 Wiesbaden, Germany • Board of Directors: Gerhard Fercho (Chairman),Thomas Nebe, Peter Schmidt • Registered in Germany: HRB 7574, Wiesbaden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20120524/15d86316/attachment.html>


More information about the Xymon mailing list