Link to Computer Property report

(imported topic written by Shawn_Jefferson)

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.

Thanks,

Shawn

(imported comment written by NoahSalzman)

Have you considered using the SOAP API?

http://support.bigfix.com/bes/misc/soapapi.html

(imported comment written by Shawn_Jefferson)

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.

(imported comment written by Shawn_Jefferson)

What I’d like to do is simply go to a URL like:

http://bcfbigfix.mycompany.com/webreports?page=SingleComputerReport&ComputerName=BIGFIX%2F1729181&PropertyFilter=

but specify the computer name without the ID appended to it. That way I can create an easy link from another webpage…

(imported comment written by BenKus)

Hey Shawn,

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…

Ben

(imported comment written by Lee Wei)

Shawn,

This sounds like an interest scenario.

This is one way to solve the problem.

  1. Create a custom Web Report that will automatically accept a Computer Name in the URL as parameter

  2. The report will query the system for the corresponding Computer ID

  3. 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
  • Note that you can also embed the username/password in the URL if desired: http://forum.bigfix.com/viewtopic.php?id=2340

Lee Wei

(imported comment written by BenKus)

Haha… Nice trick to parse the url in javascript, Lee Wei…

Ben

(imported comment written by Shawn_Jefferson)

Hi,

Thanks for looking at this and coming up with a solution! Unfortunately, I get a script error on the page when running this…

Webpage error details

Message: Unspecified error.

Line: 47

Char: 5

Code: 0

URI: http://bigfix.bcferries.corp/JavaScript/EvaluateString.js

(imported comment written by Lee Wei)

Shawn,

  • Can you please post the post the URL that you are using?
  • Did you log on to Web Reports before issuing the URL?
  • What is the result of this session relevance? It should return the database name/computer id.

((database name of bes deployment options) & “%252f” & id of it as string) of bes computer whose (name of it as lowercase = “computername”)

Lee Wei

(imported comment written by Shawn_Jefferson)

Hi,

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!

Thanks,

Shawn

(imported comment written by Lee Wei)

Shawn,

My mistake, we should make it non case sensitive.

You can change 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 + ‘")’;

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() + ‘")’;

Lee Wei

(imported comment written by Shawn_Jefferson)

Hi,

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.

(imported comment written by Shawn_Jefferson)

Hi,

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

Line: 67

Char: 17

Code: 0

URI: http://bigfix.mycompany.corp/webreports?ShortenedParams=c5c170370962a989129c9ca7ba8c799dd5690dd6

(imported comment written by Shawn_Jefferson)

Hi,

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!

(imported comment written by Lee Wei)

Excellent, thanks for letting us know.

(imported comment written by TyMcCormick)

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.