<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Christian,
    <blockquote
      cite="mid:E6B86B09BF9C1E43B3CB4A78CC1BA7B639CD6F57@w2k8-ex-mb-1"
      type="cite">
      <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}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
span.E-MailFormatvorlage17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
span.SpellE
        {}
.MsoChpDefault
        {}
@page WordSection1
        {margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.WordSection1
        {}
-->
</style>
      <div class="WordSection1">
        <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 moz-do-not-send="true"
            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>
    </blockquote>
    I do! I wrote the latest version, some updates still pending.<br>
    <blockquote
      cite="mid:E6B86B09BF9C1E43B3CB4A78CC1BA7B639CD6F57@w2k8-ex-mb-1"
      type="cite">
      <div class="WordSection1">
        <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 moz-do-not-send="true"
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 moz-do-not-send="true"
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>
    </blockquote>
    If you look at the perl code, these URLs are constructed using
    exactly what xymon has as in its config files.<br>
    <blockquote
      cite="mid:E6B86B09BF9C1E43B3CB4A78CC1BA7B639CD6F57@w2k8-ex-mb-1"
      type="cite">
      <div class="WordSection1">
        <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>
    </blockquote>
    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>
    <pre class="moz-signature" cols="72">-- 
David Baldwin - Senior Systems Administrator (Datacentres + Networks)
Information and Communication Technology Services
Australian Sports Commission          <a class="moz-txt-link-freetext" href="http://ausport.gov.au">http://ausport.gov.au</a>
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
<a class="moz-txt-link-abbreviated" href="mailto:david.baldwin@ausport.gov.au">david.baldwin@ausport.gov.au</a>          Leverrier Street Bruce ACT 2617
</pre>
  <br>
<hr>
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>
<font size="-2" face="arial">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.</font>
<hr>
</body>
</html>