I’d like to link to WebReports from an external webapp, and pass a computer name or IP address (IP preferred) and bring up that computer’s properties, especially relevant fixlets.
Is that possible, and how would I go about it? The default Computer Properties report looks like it would work, except it seems to require the “Computer ID” field in combination with the Computer Name.
No, I haven’t thought about SOAP. I was hoping to just have a quick link to a webreport that is already there, or easily created that I could pass the computer name or ip address to, not setup a SOAP connection.
Custom web reports don’t have access to arguments in the url string so you won’t be able to do this with a custom report… You could (as Noah suggests) build a simple custom cgi on IIS or Apache or something that does the same work… but that is certainly more work…
Create a custom Web Report that will automatically accept a Computer Name in the URL as parameter
The report will query the system for the corresponding Computer ID
The report will redirect the page to the built-in SingleComputerReport
Note that when you create this report, there is a ReportID that you will need.
Then issue the following URL:
http://
server
:
port
/webreports?page=Report&ReportID=
report_id
&ComputerName=
computer_name
Here is the source for the custom report.
<html> <head> <script type=
"text/javascript"> addEvent(window,
"load", search); var qsParm =
new Array(); function qs()
{ var query = window.location.search.substring(1); var parms = query.split(
'&');
for (var i = 0; i < parms.length; i++)
{ var pos = parms+.indexOf(
'=');
if (pos > 0)
{ var key = parms+.substring(0, pos); var val = parms+.substring(pos + 1); qsParm[key] = val;
}
}
} function search()
{ qs(); var rel =
'((database name of bes deployment options) & "%252f" & id of it as string) of bes computer whose (name of it as lowercase = "' + qsParm[
'ComputerName'] +
'")'; strResponse = EvaluateRelevance(rel); window.location =
"/webreports?page=SingleComputerReport&ComputerName=" + strResponse +
"&PropertyFilter=";
} function addEvent(elm, evType, fn, useCapture)
{
if (elm.addEventListener)
{ elm.addEventListener(evType, fn, useCapture);
return
true;
}
else
if (elm.attachEvent)
{ var r = elm.attachEvent(
"on" + evType, fn);
return r;
}
else
{ alert(
"Handler could not be removed");
}
} </script> </head> <body> <p>This page is intended to be accessed via a directing URL...<br> Format:<br> http:
//[server]:[port]/webreports?page=Report&ReportID=[report_id]&ComputerName=[computer_name]</p> </body> </html>
We can modify this to accept IP address
This report will probably not work if there are computers with duplicate names
Seeing that relevance here made me think of something… sure enough, I was entering the computer name in upper case (just a bad habit). When entered in lowercase the report works beautifully!
var rel = ‘((database name of bes deployment options) & “%252f” & id of it as string) of bes computer whose (name of it as lowercase = "’ + qsParm + ‘")’;
To this:
var rel = ‘((database name of bes deployment options) & “%252f” & id of it as string) of bes computer whose (name of it as lowercase = "’ + qsParm.toLowerCase() + ‘")’;
Thanks again! I’ve added the link to my IDS web front end now, so I can click on the computer name and get a report of the missing / installed patches on the computer in question. It helps quite a bit stream-line the process of determining false positives.
This report that you created Lee, is great and I use it all the time, but unfortunately it is now broken with Bigfix version 8. This is the error message that is generated now:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB0.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR .5.30729)
Timestamp: Wed, 22 Sep 2010 16:28:08 UTC
Message: ‘qsParm.ComputerName’ is null or not an object
Looking more into this… since I’m using SOAP now anyway, I can retrieve the computer id and bypass this redirect report that you created for me back then. I think that will be a better solution anyway!
I know this is quite an old post, but is this still a valid method of passing URL parameters into a Web Report?
We’re on Version: 9.0.777.0 and when creating a custom report and adding the code provided by Lee Wei, it doesn’t seem to do anything - no errors, no filtering of the data set returned by relevance, no obvious redirecting…
My intent is to pass the Computer Name (or ID, IP address, whatever will make it work) from a Dashboard Application Services Hub (DASH on JazzSM) list widget to a web widget containing a custom web report - as these seem to render quicker, are easier to adjust, and have more control of look and feel. Any assistance or input is welcome.