<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
@font-face
        {font-family:Consolas}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black}
span.e-mailformatvorlage17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
span.spelle
        {}
span.HTMLVorformatiertZchn
        {font-family:Consolas;
        color:black}
span.E-MailFormatvorlage21
        {font-family:"Calibri","sans-serif";
        color:#1F497D}
span.SpellE
        {}
.MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.WordSection1
        {}
-->
</style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple" style="">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hello David,</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">Bingo! Changing the URL code from
</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">my $link .= "http://$BBSERVERHOSTNAME$BBSERVERCGIURL/bb-hostsvc.sh?HOST=$BBHOSTNAME&SERVICE=$BBSVCNAME";</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">to</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">my $link .= "http://$BBSERVERWWWNAME$BBSERVERCGIURL/bb-hostsvc.sh?HOST=$BBHOSTNAME&SERVICE=$BBSVCNAME";</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">did the trick! (note: I changed the variable $BBSERVERHOSTNAME to $BBSERVERWWWNAME just next to the http:// keyword).</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">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 ;-)</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">So, at this point, let me say “THANK YOU” for your help!</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D">Regards</span></p>
<p class="MsoNormal"><span style="color:#1F497D">Christian</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<div>
<p class="MsoNormal" style="line-height:12.0pt"><b style=""><span style="font-size:10.0pt; font-family:"Arial","sans-serif"">CHRISTIAN BECKER</span></b></p>
<p class="MsoNormal" style="line-height:12.0pt"><span style="font-size:10.0pt; font-family:"Arial","sans-serif"">System Engineer</span></p>
<p class="MsoNormal" style="line-height:12.0pt"><span style="font-size:10.0pt; font-family:"Arial","sans-serif"">CSC</span></p>
<p class="MsoNormal" style="line-height:12.0pt"><span style="font-size:10.0pt; font-family:"Arial","sans-serif""> </span></p>
<p class="MsoNormal" style="line-height:12.0pt"><span style="font-size:10.0pt; font-family:"Arial","sans-serif"">August-Horch-Strasse 28, 56070 Koblenz, Germany</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Arial","sans-serif"">Global Outsourcing Services Central Region<span style=""> 
</span>|<span style="">  </span>p: +49.261.98468.45<span style="">  </span>|<span style=""> 
</span>f: +49.261.98468.75<span style="">  </span>|<span style="">   </span>cbecker4@csc.com<span style=""> 
</span>|<span style="">  </span>www.csc.com</span><span style="font-family:"Arial","sans-serif"; color:#1F497D"></span></p>
</div>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE" style="font-size:10.0pt; font-family:"Tahoma","sans-serif"; color:windowtext">Von:</span></b><span lang="DE" style="font-size:10.0pt; font-family:"Tahoma","sans-serif"; color:windowtext"> David Baldwin [mailto:david.baldwin@ausport.gov.au]
<br>
<b>Gesendet:</b> Mittwoch, 23. Mai 2012 03:48<br>
<b>An:</b> Becker Christian<br>
<b>Cc:</b> xymon@xymon.com<br>
<b>Betreff:</b> Re: [Xymon] html_mail1.2 is using simple hostname instead of FQDN in the link in the message</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="">Christian, </span></p>
<div>
<p class="MsoNormal">Hello out there,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Perhaps there’s anybody else using alerts:html_mail1.2 which is available from
<a href="http://xymonton.org/alerts:html_mail1.2"><span style="color:windowtext; text-decoration:none">http://xymonton.org/alerts:html_mail1.2</span></a></p>
<p class="MsoNormal"> </p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman","serif"">I do! I wrote the latest version, some updates still pending.<br style="">
<br style="">
</span></p>
<div>
<p class="MsoNormal">I’ve set it up and <span class="spelle">i’ve</span> done some changes to the way it sends the subject and the body. All of this is working fine.</p>
<p class="MsoNormal">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.</p>
<p class="MsoNormal">The body of the <span class="spelle">eMails</span> coming from the
<span class="spelle">perl</span> script contains a link to the affected host, for example:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><a href="http://XYMONHOST/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http"><span style="color:windowtext; text-decoration:none">http://XYMONHOST/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http</span></a></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">But I need to have the link as follows:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><a href="http://XYMONHOST.FULL-QUALIFIED-DOMAIN/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http"><span style="color:windowtext; text-decoration:none">http://XYMONHOST.FULL-QUALIFIED-DOMAIN/xymon-cgi/bb-hostsvc.sh?HOST=testhost&SERVICE=http</span></a></p>
<p class="MsoNormal"> </p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman","serif"">If you look at the perl code, these URLs are constructed using exactly what xymon has as in its config files.<br style="">
<br style="">
</span></p>
<div>
<p class="MsoNormal"> </p>
<p class="MsoNormal">This is due to the fact that we do monitoring for different customers having their
<span class="spelle">Xymon</span> servers with different domain names.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">For example, we have a <span class="spelle">Xymon</span> server xymonA.domainA.org and another one called xymonB.domainB.org.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Therefore I need the fully qualified hostname in the link.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">While reviewing the <span class="spelle">perl</span> code of the script I recognized a section “Retrieve the data from the environment variables”.</p>
<p class="MsoNormal">Within there I inserted a line</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">$BBSERVERHOSTNAME = $ENV{‘BBSERVERHOSTNAME’} || “”;</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">The syntax is the same as for the other variables. Then I changed the line containing the subject for the
<span class="spelle">eMail</span> to contain this variable instead of $BBSERVERWWWNAME.</p>
<p class="MsoNormal">As last step I changed the setting for the XYMONSERVERHOSTNAME (which is also set as BBSERVERHOSTNAME) in xymonserver.cfg.
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">After restarting the <span class="spelle">xymon</span> services and the
<span class="spelle">webserver</span> I’m still getting <span class="spelle">eMails</span> containing the link WITHOUT having the fully qualified hostname.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I’m NOT getting entries in /<span class="spelle">var</span>/log/<span class="spelle">xymon</span>/alert.log saying that the variable $BBSERVERHOSTNAME is uninitialized.</p>
<p class="MsoNormal">When commenting out the line</p>
<p class="MsoNormal">$BBSERVERHOSTNAME = $ENV{‘BBSERVERHOSTNAME’} || “”;</p>
<p class="MsoNormal">in the <span class="spelle">perl</span> script, then I get this message.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">For me this means, that I might have done the most things the right way; didn’t
<span class="spelle">i</span>? Anybody out there having an idea?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Sorry if my <span class="spelle">english</span> isn’t at 100%....</p>
<p class="MsoNormal"> </p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman","serif"">The $BBSERVERWWWNAME variable is what is used for the hostname in the URL section.<br>
<br>
If you have separate servers I suggest 2 options:<br>
1) change the BBSERVERWWWNAME variable in the server.cfg file on each server<br>
2) hack the perl code to hard-code the BBSERVERWWWNAME variable on each server.<br>
<br>
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.<br>
<br>
HOST=testhost SERVICE=testname<br>
    SCRIPT /path/to/html_mail.pl testalias COLOR=red<br>
<br>
Then send red status updates using the xymon command - e.g. (on the xymon server)<br>
<br>
xymon localhost "status testhost.testname red html_mail test"<br>
<br>
Send a green status to reset and then repeat to trigger the script again.<br>
This should not require restarting services at all.<br>
<br>
David.<br style="">
<br style="">
</span></p>
<pre>-- </pre>
<pre>David Baldwin - Senior Systems Administrator (Datacentres + Networks)</pre>
<pre>Information and Communication Technology Services</pre>
<pre>Australian Sports Commission<span style="">          </span><a href="http://ausport.gov.au">http://ausport.gov.au</a></pre>
<pre>Tel 02 62147830 Fax 02 62141830<span style="">       </span>PO Box 176 Belconnen ACT 2616</pre>
<pre><a href="mailto:david.baldwin@ausport.gov.au">david.baldwin@ausport.gov.au</a><span style="">          </span>Leverrier Street Bruce ACT 2617</pre>
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman","serif""> </span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt; font-family:"Times New Roman","serif"">
<hr size="2" width="100%" align="center">
</span></div>
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman","serif"">Keep up to date with what's happening in Australian sport visit
<a href="http://www.ausport.gov.au">www.ausport.gov.au</a> <br>
<br>
</span><span style="font-size:7.5pt; font-family:"Arial","sans-serif"">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.</span><span style="font-size:12.0pt; font-family:"Times New Roman","serif"">
</span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt; font-family:"Times New Roman","serif"">
<hr size="2" width="100%" align="center">
</span></div>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="2"><br>
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<br>
</font>
</body>
</html>