Colors for tests

Exchange HTML report templates between users.
Post Reply
Laureline Champion
Posts: 3
Joined: Thu Aug 18, 2005 3:00 am

Colors for tests

Post by Laureline Champion »

I was wondering if I could put colors on tests in reports when the %AliveRatio goes under a limit value. Do I have to create a new status depending on the %AliveRatio? Is it possible?
Or do I have to change the HTML code of the reports generated?
Thanks a lot
Laureline :P
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Its not very easy. You should use Custom HTML report (http://www.ks-soft.net/hostmon.eng/mfra ... CustomHTML) and write some Java script that should check value of %AliveRatio% variable returning different colors (or styles) for different %AliveRatio% values...

Regards
Alex
Laureline Champion
Posts: 3
Joined: Thu Aug 18, 2005 3:00 am

Post by Laureline Champion »

I try to use Custom HTML reports, but I don't know where I can write some Java script.
Where is the file?

Regards,
Laureline
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

What file?
You may write script in "Header" section of the report template (see "HTML report template" dialog). Then you should call script for each item from "Test items" section of the report.

Regards
Alex
User avatar
gjones
Posts: 5
Joined: Fri Nov 18, 2005 7:11 pm
Location: Los Angeles, CA

Post by gjones »

This is exactly the question that I have been searching for an answer to...

Here's my situation: Out of over 2,000 desktop PCs, we have 40 that have to stay on 24/7 for scanned image processing. We have created 40 ping tests and a custom HTML report that shows current good or bad status, but what I really need is a third color to show when something has been down any time within the last 24 hours.

I think I understand what you are saying about the extra java code in the header section to specify a "less-than-100%" status, although a code example would be great. More importantly, do you have any suggestions on how I can limit %AliveRatio% to just the last 24 hours?
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

For example you may use following code:
Header:

Code: Select all

<html><head>
 <meta name="GENERATOR" content="KS-Soft HostMonitor">
 <META http-equiv="Content-Style-Type" content="text/css">
 <title>HostMonitor report</title>
 <STYLE TYPE="text/css"><!-- a:hover { color: "#00FFFF"; } --> </STYLE>
 <style type="text/css">
  input.Folder  { background: #000080; color: #FFFFFF; height:19px; width:55px; line-height:12px; }
  input.Good00  { background: #004040; color: #C4FFFF; height:19px; width:55px; line-height:12px; }
  input.Good90  { background: #00AA00; color: #C4FFFF; height:19px; width:55px; line-height:12px; }
  input.Bad00   { background: #880000; color: #000000; height:19px; width:55px; line-height:12px; }
  input.Bad10   { background: #FF0000; color: #000000; height:19px; width:55px; line-height:12px; }
  input.Unknown { background: #FFFF00; color: #000000; height:19px; width:55px; line-height:12px; }
  input.BadAck  { background: #FF8040; color: #000000; height:19px; width:55px; line-height:12px; }
  input.UnknAck { background: #FFFF40; color: #000000; height:19px; width:55px; line-height:12px; }
  input.WaitForMaster { background: #0000FF; color: #FFFF00; height:19px; width:55px; line-height:12px; }
  input.OutOfSchedule { background: #0080FF; color: #FFFF00; height:19px; width:55px; line-height:12px; }
  input.Disabled { background: #808080; color: #C0C0C0; height:19px; width:55px; line-height:12px; }
  input.NotTested { background: #8080FF; color: #91FFFF; height:19px; width:55px; line-height:12px; }
 </style>
</head>

<body bgcolor="#000080" text="#E9E9E9" link="#00FFFF" vlink="#00FFFF" alink="#00FFFF">
<p align="left"><u><strong><big><big>HostMonitor Report</big></big><br>
</strong></u><font face="Arial">Generated on %Date% at %Time%</font></p>

<script language="JavaScript"> <!--
function showinfo(info) { alert(info); }
--> </script>

<hr>
<form>
<table border=0>
Folder section

Code: Select all

<tr><td valign=top nowrap bgcolor="#000099"><b><font color="#FFFFFF">%Folder%</font></b></td><td>&nbsp;</td><td>
Test items "with Good status"

Code: Select all

<SCRIPT type="text/javascript">
  if (%PassedCnt%/%TotalTests%>0.9) document.write("<input type=button class=Good90 value='%Reply%'>"); 
  else document.write("<input type=button class=Good00 value='%Reply%'>");
--></script>
Test items "with Bad status"

Code: Select all

<SCRIPT type="text/javascript">
  if (%FailedCnt%/%TotalTests%>0.1) document.write("<input type=button class=Bad10 value='%Reply%'>"); 
  else document.write("<input type=button class=Bad00 value='%Reply%'>");
--></script>
and so on

With this code report will show
- light green color for "good" test items with Alive% ratio >90%
- dark green color for "good" test items with Alive% ratio <=90%
- dark red color for "bad" test items with Dead% ratio <= 10%
- light red color for "bad" test items with Dead% ratio > 10%

Regards
Alex[/code]
User avatar
gjones
Posts: 5
Joined: Fri Nov 18, 2005 7:11 pm
Location: Los Angeles, CA

Perfect!

Post by gjones »

Thanks for providing that very useful code. The report looks good. My last question is whether the statistics can be limited to a rolling 24 hour period. In other words, can we show a change in color for only the machines that have been offline for any amount of time in the last day?
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You may use "Reset statistisc daily" option located on Statistisc tab in the Folder Properties dialog
http://www.ks-soft.net/hostmon.eng/mfra ... FolderTree

Regards
Alex
User avatar
gjones
Posts: 5
Joined: Fri Nov 18, 2005 7:11 pm
Location: Los Angeles, CA

Post by gjones »

Thanks for pointing me there. I was struggling to find that setting. Even though it does not allow for a "rolling" 24 hour period, I can have it reset at 17:00, which should be just as good.
Post Reply