I’ve created a patch site to which all ‘new’ machines do subscribe in order to install the needed patches.
I wanted to display in an easy to understand way the advancement of the installation of the (many) patches.
The following relevance do work, but it is very inefficient, because it has to fetch the action results 4 times instead of just once as it would be ideal. (see @jgstew post here about how writing relevance DOES matter).
To make a long story short, the following relevance does list:
the names of the computers subscribed to the patching site
the relay from wich the computers will download the patches (its relay)
the number of actions each computer has executed
the total number of actions it will have to execute
the downloaded (prefetch-ed) size (again, thanks to @jgstew for this code!, you can find it here) of relevant actions
the total prefetch size of relevant actions.
(
name of it,
(it as uppercase) of (preceding text of first “:” of it|it) of (preceding text of first “.” of it|it) of relay server of it,
number of it whose (status of it = bes action status fixed) of results (bes actions whose (name of issuer of it =“patch_robot”),it),
number of results (bes actions whose (name of issuer of it =“patch_robot”),it),
sum of (((parenthesized parts of matches (regex " size:= ") of it) as integer) of action scripts of actions of (results (bes actions whose (name of issuer of it =“patch_robot”),it)) whose (status of it != bes action status pending downloads)) / 1048576,
sum of ((parenthesized parts of matches (regex " size:= ") of it) as integer) of action scripts of actions of results (bes actions whose (name of issuer of it =“patch_robot”),it) / 1048576
) of subscribed computers of action site of bes user whose (name of it = “patch_robot”)
the result looks like this:
I’ve tried to move the results in the outer part of the cycle…
(
name of computer of it,
(it as uppercase) of (preceding text of first ":" of it|it)
of (preceding text of first "." of it|it)
of relay server of computer of it,
number of it whose (status of it = bes action status fixed) of it,
number of it,
sum of (((parenthesized parts of matches (regex " size[:=](\d+) ") of it) as integer)
of action scripts of actions of it
whose (status of it != bes action status pending downloads)) / 1048576,
sum of ((parenthesized parts of matches (regex " size[:=](\d+) ") of it) as integer)
of action scripts of actions of it / 1048576
) of results (
bes actions whose (name of issuer of it ="patch_robot"),
subscribed computers of action site of bes user whose (name of it = "patch_robot")
)
but doing so (of course) multiplies the number of rows by a factor of (number of computers*number of results)
I’m surely missing something … please help a young relevance-r
Sorry for the bump… I’m really banging my head at it… I feel I’m getting closer, by correctly iterating separately for the computers vs the results (simplified relevance, just to show the concept):
(
name of it,
(it as uppercase) of (preceding text of first ":" of it|it) of (preceding text of first "." of it|it) of relay server of it,
(
number of it whose (status of it = bes action status fixed) of it,
number of it,
sum of ((parenthesized parts of matches (regex " size[:=](\d+) ") of it) as integer) of action scripts of actions of it
) of results (bes actions whose (name of issuer of it ="patch_robot"),it)
) of subscribed computers of action site of bes user whose (name of it = "patch_robot")
…I.E. I still get (Computers * Results) rows, this time tho because it seems to me that I’m being unable to ‘aggregate’ the 3 integer tuple result… any idea?
Many thanks!
I solved my problem… I’ll post the solution, hoping to help someone else
The ‘trick’ here is to remember to keep objects as singular as possible until needed (to avoid a geometric explosion of data).
In this specific scenario, the key was to use a “SET OF ACTIONS” to avoid the “computers x actions” issue.
Long story short:
(
name of item 0 of it,
(preceding text of first "." of it|it) of preceding text of first ":" of relay server of item 0 of it as uppercase,
number of (results (item 0 of it,elements of item 1 of it) whose (status of it != bes action status fixed)),
number of results (item 0 of it,elements of item 1 of it),
(it / 1048576) of sum of ((parenthesized parts of matches (regex " size[:=](\d+) ") of it) as integer)
of action scripts of actions of (results (item 0 of it,elements of item 1 of it) whose (status of it != bes action status pending downloads)),
(it / 1048576) of sum of ((parenthesized parts of matches (regex " size[:=](\d+) ") of it) as integer)
of action scripts of actions of results (item 0 of it,elements of item 1 of it)
)
of
(
subscribed computers of it,
set of actions of it
)
of action site of bes user whose (name of it ="patch_robot")
This is exactly right. You want to create just 1 tuple if possible from the sets rather than computer * action number of tuples because constructing the tuples takes time, and then it becomes hard to collapse it back down into a sensible result.
Yes, I do google with site:bigfix.me when looking for content on there, but then I have to remember what keywords to search for to bring up what I am looking for, which can be the more significant challenge as the number of items on BigFix.Me grows.