Session Relevance efficiency and duplication of results

All,

I’m trying to use the SOAP API to retrieve the names and relevancy dates of fixlets for a group of computers (which will eventually be all computers, so I want this to be as efficient as possible). Here’s the session relevance statement I’ve got now (trimmed a little for clarity):

(name of computers of it, name of fixlets of it, first became relevants of it) of results (((bes computers) whose (name of it as lowercase starts with "abc")), (relevant fixlets of ((bes computers) whose (name of it as lowercase starts with "abc"))) whose (source severity of it = "Critical"))

The first issue is that I get multiples of most lines which, if I’m seeing the pattern, will only get worse once I remove the “whose” for bes computers. What I get is each relevant fixlet’s details once for each computer for which it’s relevant. If three computers are relevant, I’ll get each computers name, the fixlet name, and the specific computer’s relevancy date three times. If four, then four times each. When there’s hundreds (or thousands), it’ll be disastrous.

If I run the above session relevance for a specific bes computer (by ID), I get exactly what I’d expect…that one computer’s data once. So, I could run thousands of individual API calls, one for each computer, but that sounds like it could be disastrous as well.

Does anyone have any insight before I bring down our server? :slight_smile:

  • John

Also, is there a way to get different separators than commas? Some of these fields have commas making the parsing extremely difficult. :-/

My go-to reference on efficient session relevance queries is @brolly33’s blog post at https://www.ibm.com/developerworks/community/blogs/e9d21113-aa93-467e-ac77-a0d20a21eaec/entry/Session_Relevance_Computer_Properties_query_Efficiency?lang=en

There’s a great primer on efficiency there. I’ll see whether I can adapt it to your use case later today.

1 Like

Will read it now. Thanks!

Something else that can help here is the Excel Connector (as its wizard can actually build this query for you). Here’s a sample query it generated based on the parameters above:

(	item 0 of it as string  & "$x$" &
	item 1 of it as string  & "$x$" &
	item 2 of it as string  & "$x$" &
	(if ((year of date (local time zone) of it) as integer = 1980) 
		then ("<none>") 
		else (
			(year of it as string & "/" & 
			 month of it as two digits & "/" & 
			 day_of_month of it as two digits) of date (local time zone) of it & " " & 
			(two digit hour of it as string & ":" & 
			 two digit minute of it as string) of time (local time zone) of it)) 
				of (item 3 of it as time)) 
of (
	(if (exists Name of Computer of it | false) 
		then (concatenations "%0A" of (Name of Computer of it as string)) 
		else ("<none>")), 
	(if (exists Name of Fixlet of it | false) 
		then (concatenations "%0A" of (Name of Fixlet of it as string)) 
		else ("<none>")), 
	(if (exists Name of Site of Fixlet of it | false) 
		then (concatenations "%0A" of (Name of Site of Fixlet of it as string)) 
		else ("<none>")), 
	(if (exists First Became Relevant of it) 
		then (First Became Relevant of it as string) 
		else ("Fri, 15 Feb 1980 00:00:00 -0000"))) 
of 
	results of bes fixlets whose (source severity of it = "Critical")

And yes, you can have any delimiter you want (you don’t have to use tuples - the example above uses $x$).

That said, I would expect this query to take some time to evaluate especially if you have large numbers of Fixlets and/or Computers. The inclusion of first became relevant of <bes fixlet result> will also require more time, and means that this query cannot be evaluated in the Console’s presentation debugger (which does not load time metrics associated with Fixlet results).

Narrowing the scope of either Fixlets or Computers can help reduce evaluation time of this type of query. For instance, can we limit the scope to Fixlets from a particular site (or list of sites)?

@Aram - I’m a little confused (okay, I’m a LOT confused) by the “results” portion at the end only having “bes fixlets” and not the junction of “bes computers” and “bes fixlets”. Can you explain (or point to an explanation of) how the two are different?

Oh, and the computers will be scoped down, but not by much. There may be some scoping down of the fixlets, but we want info on just about all the Critical fixlets out there, so again, not by much.

Have a look at the creation methods for <bes fixlet result>, and you’ll find there’s a few different ways you could go about it.

1 Like