Receive Error "Unterminated string constant" on Re

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
sadek76
Posts: 71
Joined: Tue Apr 27, 2004 3:28 pm
Location: New Jersey

Receive Error "Unterminated string constant" on Re

Post by sadek76 »

I created a report that contains all of the test results. The report is using Custom html, Here is the code for the line that's giving me problems: <tr><td><font color=#00FF00> Tests with "Good" status</font></td><td><font color=#00FF00>%GoodTests%</font></td></tr>
This code works for http, url, ping but not Trace. The code that was created looks like: <input type=button class=Good value="London-Proxy Trace: 165.168.184.232" onclick="showinfo('Test name: \tLondon-Proxy Trace: 165.168.184.232\nStatus: \tOk\nRecurrences: \t12730\nReply: \t147.107.53.200

As you can see ')" is missing from the end of the line. I'm using version 4.42 on a Windows 2000 server.[/img]
KS-Soft
Posts: 12887
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

#1
Here is the code for the line that's giving me problems: <tr><td><font color=#00FF00> Tests with "Good" status</font></td><td><font color=#00FF00>%GoodTests%</font></td></tr>
#2
This code works for http, url, ping but not Trace. The code that was created looks like: <input type=button class=Good value="London-Proxy Trace: 165.168.184.232" onclick="showinfo('Test name: \tLondon-Proxy Trace: 165.168.184.232\nStatus: \tOk\nRecurrences: \t12730\nReply: \t147.107.53.200
I do not understand. Line #1 (from the code) cannot produce line #2 (result). Probably you are talking about 2 different problems? Could you provide code that produces line #2?

Regards
Alex
sadek76
Posts: 71
Joined: Tue Apr 27, 2004 3:28 pm
Location: New Jersey

Post by sadek76 »

Here is the code from each of the custom html tabs:
Header:
<html><head>
<meta name="Author" content="Jim Stewart">
<META http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="REFRESH" content ="60">
<title>All Tests Report</title>
<STYLE TYPE="text/css"><!-- a:hover { color: "#00FFFF"; } --> </STYLE>
<style type="text/css">
input.Folder { background: #000000; color: #00FFFF; height:20px; width:200px; line-height:12px; }
input.Good { background: #000000; color: #00FF00; height:20px; width:200px; line-height:12px; }
input.Bad { background: #000000; color: #FF0000; height:20px; width:200px; line-height:12px; }
input.Unknown { background: #000000; color: #FFFF00; height:20px; width:200px; line-height:12px; }
input.WaitForMaster { background: #000000; color: #FFFF00; height:20px; width:200px; line-height:12px; }
input.OutOfSchedule { background: #000000; color: #FFFF00; height:20px; width:200px; line-height:12px; }
input.Disabled { background: #000000; color: #C0C0C0; height:20px; width:200px; line-height:12px; }
input.NotTested { background: #000000; color: #91FFFF; height:20px; width:200px; line-height:12px; }
</style>
</head>

<body bgcolor="#000000" text="#00FFFF" link="#00FFFF" vlink="#00FFFF" alink="#00FFFF">
<p align="left"><strong><big><big>whdhostmonprod2 - All Tests Report</big></big><br>
</strong><font face="Arial" size="1">Page Last Updated %Date% at %Time%</font></p>

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

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

Folder Title:

<tr><td valign=top align=right nowrap bgcolor="#000000"><b><font color="#00FFFF"> %Folder%</font></b></td><td> </td><td>

Test Items:

with "Good" status:


<input type=button class=Good value="%TestName%" onclick="showinfo('Test name: \t%TestName%\nStatus: \t%Status%\nRecurrences: \t%Recurrences%\nReply: \t%Reply%')">

with "Bad" status:

<input type=button class=Bad value="%TestName%" onclick="showinfo('Test name: \t%TestName%\nStatus: \t%Status%\nRecurrences: \t%Recurrences%\nReply: \t%Reply%')">

with "Unknown" status:
<input type=button class=Unknown value="%TestName%" onclick="showinfo('Test name: \t%TestName%\nStatus: \t%Status%\nRecurrences: \t%Recurrences%\nReply: \t%Reply%')">


Wait for Master:

<input type=button class=WaitForMaster value="%TestName%" onclick="showinfo('Test name: \t%TestName%\nStatus: \t%Status%\nRecurrences: \t%Recurrences%')">

Footer:

</table>
</form>
<hr>
<br>
<table border=0>
<tr><td><font color=#00FF00> Tests with "Good" status</font></td><td><font color=#00FF00>%GoodTests%</font></td></tr>
<tr><td><font color=#FF0000> Tests with "Bad" status</font></td><td><font color=#FF0000>%BadTests%</font></td></tr>
<tr><td><font color=#FFFF00> Tests with "Unknown" status  </font></td><td><font color=#FFFF00>%UnknownTests%</font></td></tr>
<tr><td><font color=#FFFF00> Tests with "Waiting for Master" status  </font></td><td><font color=#FFFF00>%WaitForMasterTests%</font></td></tr>
</table><br>

<p><font face="Arial" size="1">Report Created by the EMS Group</font></p>
</body>
</html>

The test is set to include Hosts Good, Bad, Unknown and Out of Schedule.
Include ALL types and a few field s to report.
KS-Soft
Posts: 12887
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

<input type=button class=Good value="%TestName%" onclick="showinfo('Test name: \t%TestName%\nStatus: \t%Status%\nRecurrences: \t%Recurrences%\nReply: \t%Reply%')">
Now I see code you are using.
Problem - Reply field for Trace test may contain more than 1 line, in this case script showinfo('Test name: \t%TestName%\nStatus: \t%Status%\nRecurrences: \t%Recurrences%\nReply: \t%Reply%') fails

Solution?
H'm.. don't see nice solution. Probably complicate script by adding check for test method (using %TestMethod% macro variable)....
Or probably we can add some new macro variable that will represent Reply field, use '\r\n' string instead of CR CL characters
...

Regards
Alex
sadek76
Posts: 71
Joined: Tue Apr 27, 2004 3:28 pm
Location: New Jersey

Post by sadek76 »

Where would I add the check for TestMethod? What language should it be written in JavaScript, Perl, VB?
KS-Soft
Posts: 12887
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I have added new macro variable %Reply_CStyle%, so now you don't need to write any script.
Just download upgrade www.ks-soft.net/download/hm446.zip and modify your report profile (change %Reply% to %Reply_Cstyle%)

Also this new version supports new SNMP Trap test method. If you want to try this method, I would recommend to copy your existent Advanced Host Monitor into another directory (or another computer), unzip new modules, and setup SNMP Trap tests for testing purpose only!

Regards
Alex
sadek76
Posts: 71
Joined: Tue Apr 27, 2004 3:28 pm
Location: New Jersey

Post by sadek76 »

Alex - Your the greatest! Works fine. :lol:
Post Reply