[Xymon] Turning Hostname into Hyperlink Changes Graph Titles

Galen Johnson Galen.Johnson at sas.com
Fri Jul 17 14:32:27 CEST 2015


Works great Jeremy...just missing the <html></html> tags.  The ssh piece could bite you for short hostnames (which I should stop putting in my host configs).


=G=


________________________________
From: Xymon <xymon-bounces at xymon.com> on behalf of Jeremy Laidman <jlaidman at rebel-it.com.au>
Sent: Friday, July 17, 2015 1:22 AM
To: Dan Oakes
Cc: xymon at xymon.com
Subject: Re: [Xymon] Turning Hostname into Hyperlink Changes Graph Titles

Dan

What I do is to leave the hostname alone, but create a "notes" file for each hostname I want to access.  These files go in XYMONNOTESDIR (defined in xymonserver.cfg), as standard HTML files.  For each of my servers I've an ssh:// link to the server and http:// to the iLO, plus a few direct links to useful things within Xymon.

To access notes, just click on the hostname.  If the notes file exists, it will be hotlinked.


Creating the notes files could be automated, but I don't have enough hosts to make it worthwhile, so I've just done it manually.  You can also specify a HOSTDOCURL in xymonserver.cfg that includes a script to run, and have the notes pages dynamically created based on the hostnames.

I've done a hybrid solution.  I have a generic host type notes file for a group of hosts, and I create symbolic links to each hostname that points to the generic file.  Within the notes file, I use some javascript-fu to dynamically generate the details on-the-fly.

For anyone interested in giving it a try, I'll append the HTML file below.

J

<HEAD>
<TITLE>Connecting to servername</TITLE>
<!--
   *** Clicking on a hostname shows this page, if named <hostname>.html ***
   This file is located in server/www/notes/
  -->

<!-- Styles for the Xymon body  -->
<link rel="stylesheet" type="text/css" href="/xymon/gifs/xymonbody.css">

<!-- Styles for the menu bar -->
<link rel="stylesheet" type="text/css" href="/xymon/menu/xymonmenu-blue.css">

<!-- The favicon image -->
<link rel="shortcut icon" href="/xymon/gifs/favicon-blue.ico">

</HEAD>
<BODY class="blue">

<div id="menue">
    <div class="outer">
      <span class="menutag">Views<span class="invis">: </span></span>
        <a class="inner-1" href="/xymon/xymon.html">Main view</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/nongreen.html">All non-green view</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/criticalview.sh">Critical systems</a>
    </div>
    <div class="outer">
      <span class="menutag">Reports<span class="invis">: </span></span>
        <a class="inner-1" href="/xymon-cgi/eventlog.sh">Event log Report</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/topchanges.sh">Top Changes</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/report.sh">Availability Report</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/snapshot.sh">Snapshot Report</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/confreport.sh">Config Report</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/confreport-critical.sh">Config Report (Critical)</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/hostgraphs.sh">Metrics Report</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/ghostlist.sh">Ghost Clients</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-cgi/notifications.sh">Notification Report</a>
        <a class="inner" href="/xymon/periodic/">Periodic Reports</a>
    </div>
    <div class="outer">
      <span class="menutag">Administration<span class="invis">: </span></span>
        <a class="inner-1" href="/xymon-cgi/findhost.sh">Find host</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-seccgi/acknowledge.sh">Acknowledge alert</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-seccgi/enadis.sh">Enable/disable</a><span class="invis"> | </span>
        <a class="inner" href="/xymon-seccgi/criticaleditor.sh">Edit critical systems</a>
    </div>
    <div class="outer">
      <span class="menutag">Help<span class="invis">: </span></span>
        <a class="inner-1" href="/xymon/help/about.html">About Xymon</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/install.html">Installing Xymon</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/xymon-config.html">Configuring Monitoring</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/xymon-alerts.html">Configuring Alerts</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/criticalsystems.html">Critical systems</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/known-issues.html">Known problems</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/xymon-tips.html">Tips and Tricks</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/howtograph.html">Custom graphs</a><span class="invis"> | </span>
        <a class="inner" href="/xymon/help/manpages/">Xymon man-pages</a>
        <a class="inner" href="/xymon/help/devmon.html">Devmon documentation</a>
    </div>
</div>

<TABLE SUMMARY="Topline" WIDTH="100%">
<TR><TD HEIGHT=16> </TD></TR>  <!-- For the menu bar -->
</TABLE>



<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!--
servername=location.href.match(/([^\/]+)\.html/)[1];
if (servername.match("-ilo")) {
        // a server name containing "-ilo" is an iLO
        iloname=servername;
} else if (servername.match("lx.*\.in\.")) {
        // a server name named "lx*.in.bla" has an iLO in
        // in the same domain called "X-ilo.in.bla"
        iloname=servername.replace(".in.","-ilo.in<http://ilo.in>.");
} else {
        iloname="";
}
document.title=document.title.replace("servername",servername);
xymurl=location.href.match(/^([^\/]*:\/\/[^\/]+)/)[0];

document.write('<H2>Server: '+servername+'</H2>');
if (iloname != servername) {
        document.write('Connect using SSH: <a href="ssh://'+servername+'">ssh://'+servername+'</a> (may not work in IE8)<BR>');
}

if (iloname.length > 0) {
        document.write('Connect to iLO: <a href="https://'+iloname+'" target="_blank">https://'+iloname+'</a> or <a href="ssh://'+iloname+'">ssh://'+iloname+'</a><BR>');
}

document.write('View <a href="'+xymurl+'/xymon-cgi/svcstatus.sh?HOST='+servername+'&SERVICE=info">Info</a><BR>');
document.write('View <a href="'+xymurl+'/xymon-cgi/svcstatus.sh?HOST='+servername+'&SERVICE=trends">Trends</a><BR>');

document.write('View <a href="'+xymurl+'/xymon-cgi/eventlog.sh?HOSTMATCH='+servername+
        '&MAXTIME=86400&MAXCOUNT=100&Send=View+log'+
        '">Event Log</a> for the last 24 hours<BR>');

d=new Date();
start_year=d.getFullYear();
start_mon=d.getMonth()+1;
start_day=d.getDate();
document.write('View <a href="'+xymurl+'/xymon-cgi/hostgraphs.sh'+
        '?start-mon='+start_mon+'&start-day='+start_day+'&start-yr='+start_year+
        '&end-mon='+start_mon+'&end-day='+start_day+'&end-yr='+start_year+
        '&hostname='+servername+
        '&testname=ALL'+
        '&DoReport=Generate+Report'+
        '">Metrics Report</a> for today (CPU/disk/memory/conn)<BR>');

document.write('<a href="'+xymurl+'/xymon-cgi/findhost.sh?HOST='+servername+'&jump">Find</a> this host in Xymon pages<BR>');
-->
</SCRIPT>
</BODY>



On 17 July 2015 at 04:00, Dan Oakes <oakesbz at gmail.com<mailto:oakesbz at gmail.com>> wrote:
Hi all,

I'm using the below to turn my hostnames into hyperlinks to login to each server (which works great):

10.10.10.10    Hostname    # NAME:"<a href=ssh://root@10.10.10.10<mailto:root@10.10.10.10>>Displayed Hostname</a>"

Problem is, it now uses this ugly html string as the hostname in the title of my graphs.  So it displays "<a href=ssh://root... > Disk Utilization", etc. as the title... which is obviously not pretty.  Any thoughts on how to fix this?

By the way, it also changes the displayed hostname in several other places which I managed to fix by changing the variable &XYMWEBHOST to &XMH_HOSTNAME in several of the $xymon/server/web/*_header files...

Thank you!
_______________________________________________
Xymon mailing list
Xymon at xymon.com<mailto:Xymon at xymon.com>
http://lists.xymon.com/mailman/listinfo/xymon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20150717/928b23d6/attachment.html>


More information about the Xymon mailing list