Reporting of Failures

(imported topic written by CCupit91)

OK I’ve been trying to create some custom reports to report on failures but something’s getting confused somewhere :

trs of (td of name of computer of it & td of (value of result (computer of it, bes property “Property1”)) & td of name of action of it & td of (status of it as string)) of results whose (status of it = bes action status failed) of bes actions whose (name of site of source fixlet of it = “Enterprise Security” and name of it contains “Vulnerability”)

Works however this only returns failed machines for patches with the word Vulnerability in the title.

trs of (td of name of computer of it & td of (value of result (computer of it, bes property “Property1”)) & td of name of action of it & td of (status of it as string)) of results whose (status of it = bes action status failed) of bes actions whose (name of site of source fixlet of it = “Enterprise Security” and name of it contains “MS06”)

Returns

Singular expression refers to nonexistent object.

However

trs of (td of name of computer of it & td of (value of result (computer of it, bes property “Property1”)) & td of name of action of it & td of (status of it as string)) of results whose (status of it = bes action status failed) of bes actions whose (name of site of source fixlet of it = “Enterprise Security” and name of it contains “IceCream”)

Returns no results or errors.

Am I going mad?

(imported comment written by dgibson91)

This is something we were just thinking of doing. Following your example, I came up with this:

<?Relevance (tr of (td of link of action of it & td of detailed status of it & td of link of computer of it)) of results whose (status of it = bes action status failed or status of it = bes action status download failed) of bes actions ?>

It may be your “Property1” that is causing the problem.

This report takes a minute or so to generate. Maybe there is a better way to do this?

(imported comment written by CCupit91)

Property1 is a renamed internal property. Performing the same lookup on a particular group of fixlets within our internal Custom site works without issues. It just seems to be something to do with looking for fixlets that contain “MS” or “MS06”

(imported comment written by BenKus)

Hey guys,

This looks like it will be a very cool report.

CCupit, the reason your report is returning “Singular expression refers to nonexistent object” is likely because on of the computers does not have a value for

(result (computer of it, bes property “Property1”))

. The reason it worked for the “Vulnerability” Fixlets is probably because all the computers who failed those Fixlets had a value for “Property1”.

To fix this, replace:

td of (value of result (computer of it, bes property “Property1”))

with

td of (if (exists result (computer of it, bes property “group test”)) then value of (result (computer of it, bes property “Property1”)) else “n/a” )

Hopefully that works for you,

Ben

(imported comment written by BenKus)

dgibson,

Your relevance to detect computers with failed actions looks as optimal as possible (a single iteration over action results and actions). Frankly, I am surprised it takes a minute because I have a database here with 10,000 computers (with 2800 actions and 107,000 action results) and your exact query takes only 10-15 seconds.

I am wondering if the report is going slow because you might be running low on RAM on your BES Web Reports server. Usually SQL Server will hog up all the RAM it can get its hands on and it might not leave a lot for web reports. When Web Reports doesn’t have enough RAM, it goes very slow (like the console).

As a test, I loaded an application that used up a portion of the BES Web Reports memory and re-ran your query and it took 4x longer.

I would concentrate on the RAM on your BES Server to make things faster, but as an optimization for this query, you can restrict the report to only actions that have run in the last 4 weeks:

(tr of (td of link of action of it & td of detailed status of it & td of link of computer of it)) of results whose (status of it = bes action status failed or status of it = bes action status download failed) of bes actions whose (time issued of it > (now - (4 * week)))

(imported comment written by SystemAdmin)

Ben,

Daryl and I were talking about this earlier. One problem with this report is that it doesn’t take account if the fixlet that failed on a machine is still relevant for that patch.

If it failed before but was fixed afterwards (and is no longer relevant), then it probably shouldn’t be on the report. Unless your trying to determine how often things are failing.

For us, we’re interrested in those machines that failed and still need to be patched.

Paul

(imported comment written by CCupit91)

I did this :

trs of (td of name of computer of it & td of (if (exists result (computer of it, bes property “Property1”)) then value of (result (computer of it, bes property “Property1”)) else “n/a” ) & td of name of action of it & td of (status of it as string)) of results whose

(status of it = bes action status failed and relevant(computer of it, (source fixlet of action of it)))

of bes actions whose (name of site of source fixlet of it = “Enterprise Security” and name of it contains “MS06”)

Which certainly seems to work.

(imported comment written by dgibson91)

CCupit: I think that adding the

relevant (…)

will accomplish what i am looking for.

Ben: This query still takes a long time.

Our

ACTIONRESULTS

table has

1630933

records

and our

ACTIONS

table has

26390

records

Could this be why it takes so long for us?

Or is the memory the most likely problem here?

(imported comment written by CCupit91)

I’ve been playing and now added :

trs of (td of name of computer of it & td of (if (exists result (computer of it, bes property “Property2”)) then value of (result (computer of it, bes property “Property2”)) else “n/a” ) & td of (if (exists result (computer of it, bes property “Property1”)) then value of (result (computer of it, bes property “Property1”)) else “n/a” ) & td of name of action of it & td of (status of it as string)) of results whose (status of it = bes action status failed and (

retry count of it >= 4

) and relevant(computer of it, (source fixlet of action of it))) of bes actions whose (name of it starts with “MS06” or name of it starts with “MS05”)

So it only shows actions that have completed retrying and are still failing.

We set retries to 3 but the retry count seems to show 4 for actions that have retried 3 times… any ideas why that is?

(imported comment written by CCupit91)

One other thing I would like to do is have a web form where the user enters the fixlet name to constrain the search (so you could search for failures on a specific fixlet) any idea how (if) I can pass the results of a form into the script?

Edit : Just noticed the section in the session library ‘Using Javascript in Presentations’ where it says ‘There are many advantages to working with Javascript, one of the most important is user interactivity’

Do you have any examples of this? (Not a Java expert i’m afraid).

(imported comment written by jessewk)

CCupit,

The interaction of javascript and relevance evaluation is used in a number of places in the console today. For example, Application Usage Tracking and the File Pre-Cache wizard. You can check out the source of these by looking for .ojo files in the BES Client’s __BESData directory.

I’ve also just created a very simple example to show how to evaluate relevance and update a report based on user interaction. I’ve attached it below. You can paste the source into a custom report in Web Reports to check it out. All it does is populate a select drop-down with the names of the Fixlets in the BES Support site. Then when you select a fixlet name, it writes the relevance for that Fixlet to the page.

I hope this helps give you direction.

-Jesse

(imported comment written by CCupit91)

Thanks for that! Gives me something to work with :slight_smile:

(imported comment written by CCupit91)

Ok I’ve been playing with the example, I’ve managed to make a couple of dropdown menu’s to choose Site and then Fixlet from that site. To report the failures I’ve created this code which runs when you pick the fixlet from the select dropdown :

function DoFixletSelect(select)

{

var results1 = EvaluateRelevance(’(name of computer of it) of results whose (status of it = bes action status failed and relevant(computer of it, (source fixlet of action of it))) of bes actions whose (name of source fixlet of it ="’+ select.value +’")’)

var results2 = EvaluateRelevance(’(if (exists result (computer of it, bes property “Property1”)) then value of (result (computer of it, bes property “Property1”)) else “n/a” ) of results whose (status of it = bes action status failed and relevant(computer of it, (source fixlet of action of it))) of bes actions whose (name of source fixlet of it = “’+ select.value +’”)’)

var results3 = EvaluateRelevance(’(if (exists result (computer of it, bes property “Property2”)) then value of (result (computer of it, bes property “Property2”)) else “n/a” ) of results whose (status of it = bes action status failed and relevant(computer of it, (source fixlet of action of it))) of bes actions whose (name of source fixlet of it = “’+ select.value +’”)’)

select.disabled = true

completetable(results1,results2,results3)

}

function completetable(values1,values2,values3)

{

for (i=0; i < values1.length;i++)

{

var x=document.getElementById(‘myTable’).insertRow(i+1)

var y=x.insertCell(0)

var z=x.insertCell(1)

var a=x.insertCell(2)

y.innerHTML=values1+

z.innerHTML=values2+

a.innerHTML=values3+

}

}

Computer Name PC Owner Supported By

Which inserts the rows into the table by performing 3 seperate EvaluateRelevance’s, one to create an array of computer names, one to create an array of Property1 and 1 to create an array of Property2.

If I try to populate the array with values in a single EvaluateRelevance statement then each ‘row’ is an individual item in the array which I cant break down.

Is there any easier way to do this?

Also… I return the fixlet names as per the example above, however fixlets with " in the name show up with " in the name and wont lookup… is there any way to catch/handle this?

(imported comment written by CCupit91)

Nevermind… Ended up doing a lookup of the name found in the Select against the ID of the fixlet and then using the ID and Sitename to return the results instead of the name of the fixlets. Still wondering if there’s a more elegant solution to the table tho :slight_smile:

(imported comment written by jessewk)

Try this version. It first populates a select drop down with all actions where there was a computer that failed and the computer is still reporting relevant for the source fixlet.

When you select the action, it will build a table with the computer name, os, and cpu. You could change this to populate with any properties you like. You do need to be careful to use properties that have a unique name and that return singular results. If your properties don’t meet those criteria, you will need to adjust the relevance to ‘do the right thing’. For example, in the case of multiple results you my might use 'preceding text of last "

" of ((concatenation of (it & br) of values of results of bes property “IP Address”) as string)’

I think you’ll find this gives a more elegant way to build your table, as requested.

Let us know how it goes!

(imported comment written by dgibson91)

Looking good Jesse, Is there a way to sort the drop down box alphabetically?

I wasn’t aware you could do a “javascript array” in the relevance. Should prove useful in the future. I’ll have to take a closer look at the SessionInspectors guide.

Thanks.

(imported comment written by jessewk)

You can use javascript to sort the results. I had to flip the order of the action name and ID when I pull them out with relevance so that I sort on the name rather than the ID. In javascript you can also supply your own sort function if you’d like to sort non-alphabetically. There are lots of example sort functions available around the web. Also, be aware that when you start sorting arrays performance can be an issue with large datasets.

Here’s the new code:

var Actions = 

new Array();   <?relevance javascript array 
"Actions" of (name of it & 
"," & id of it as string) of bes actions whose (exists results whose (status of it = bes action status failed AND relevant(computer of it, source fixlet of action of it))of it) ?>   Actions.sort();   var ActionNames = 

new Array(); var ActionIDs  = 

new Array();   

for (var i = 0; i < Actions.length; i++) 
{ var Action = Actions+; var lastComma = Action.lastIndexOf(
','); ActionNames+ = Action.substring(0,lastComma); ActionIDs+ = Action.substring(lastComma+1); 
}

(imported comment written by CCupit91)

New question. Is there any easy way to get totals for various actions? Ie. Total Relevant, Total Fixed, Total Failed etc.

(imported comment written by jessewk)

CCupit

New question. Is there any easy way to get totals for various actions? Ie. Total Relevant, Total Fixed, Total Failed etc.

Funny you should ask… here’s one I wrote yesterday. It returns the percentages of each action status for computers that are members of a particular automatic group from an action identified by its action name.

(item 0 of item 0 of it & 
" - " & (item 1 of item 0 of it * 100 as floating point / item 1 of it ) as string & 
"%25") of ((it , multiplicity of it) of unique values of (statuses of results (applicable computers of bes fixlets whose (group flag of it AND name of it = 
"Support"), bes actions whose (name of it = 
"Update Auto Group Membership Policy")) as string), number of (statuses of results (applicable computers of bes fixlets whose (group flag of it AND name of it = 
"Support"), bes actions whose (name of it = 
"Update Auto Group Membership Policy")) as string))

(imported comment written by CCupit91)

ooh wonderful…

Any chance you could give a little more explanation round how it works? :slight_smile:

This bit…

(item 0 of item 0 of it & " - " & (item 1 of item 0 of it * 100 as floating point / item 1 of it )

and this bit in particular

((it , multiplicity of it)

and…

number of (statuses of results (applicable computers of bes fixlets whose (group flag of it AND name of it = “Support”),

(which does not appear in the Session Library manual as far as I can see…) return a number ?

Are there other references I should be using? Currently I’m doing things the long way round (evaluate something that returns a list of computers that failed an action and then reporting on the value.length of that for each action). But for fixlets with 200+ actions touching 90k computers it’s taking 15+ minutes to return. If there is anything I can use that means I ask less questions all the better! :slight_smile: