Relevance action cumulative status

Any way to get the cumulative status of action while its progressing and final status as complete?
This is the relevance I am using
(detailed status of result of it) of bes action whose (id of it =1615606 )

image

If I’m understanding what you’re asking, perhaps something like the following might work for you:

(if it = 100 then "Complete" else (relative significance place 3 of it as string & "%25")) of (item 0 of it as floating point / item 1 of it as floating point * 100) of (number of statuses of results of it, number of targeted computers of it) of bes actions whose (id of it = 1615605)

This compares the number of results vs. the number of machines targeted for a given action, and will return a percentage if less than 100%, or Complete if 100%. This will only really work for statically targeted actions, since the scope of dynamically targeted actions is unknown. This also treats all returned results the same (i.e. a failed status counts the same as a fixed status), though this is easily adjustable.

odd error…

“resource don’t exist”

r=requests.get(‘https://abc:52311/api/query?relevance=(if it = 100 then “Complete” else (relative significance place 3 of it as string & “%25”)) of (item 0 of it as floating point / item 1 of it as floating point * 100) of (number of statuses of results of it, number of targeted computers of it) of bes actions whose (id of it = 1615605)’, verify=False,auth=(‘ops’, ‘2no’))

Be sure to properly URL encode the relevance parameter.

Try something like:

/api/query?relevance=%28if%20it%20%3D%20100%20then%20%22Complete%22%20else%20%28relative%20significance%20place%203%20of%20it%20as%20string%20%26%20%22%20Percent%22%29%29%20of%20%28item%200%20of%20it%20as%20floating%20point%20%2F%20item%201%20of%20it%20as%20floating%20point%20%2A%20100%29%20of%20%28number%20of%20statuses%20of%20results%20of%20it%2C%20number%20of%20targeted%20computers%20of%20it%29%20of%20bes%20action%20whose%20%28id%20of%20it%20%3D%201615605%29%20

I am going to run this xml query to fire the action. I just need to validate if the action is complete or not. The number of computer could be in the range of 50-100.

I think percent is messing the URL encoding.

/api/query?relevance=%28if%20it%20%3D%20100%20then%20%22Complete%22%20else%20%28relative%20significance%20place%203%20of%20it%20as%20string%20%26%20%2245Percent%22%29%29%20of%20%28item%200%20of%20it%20as%20floating%20point%20%2F%20item%201%20of%20it%20as%20floating%20point%20%2A%20100%29%20of%20%28number%20of%20statuses%20of%20results%20of%20it%2C%20number%20of%20targeted%20computers%20of%20it%29%20of%20bes%20action%20whose%20%28id%20of%20it%20%3D1615606%20%29

Using the escaped sequence works just fine and the issue is the slash "/"used for the division which messes up the parameter in the url.

which escape sequence you have used for /?

Yours :slight_smile: … is the action targeted to dynamic groups ? if to I don’t think the relevance will work.

yah. I created the manual group and then deployed the action on that group. I am not sure if that mean its dynamic group.

I used the entire relevance and changed the action id to one I have in my system. Tested with dyn groups and works as well, here’s what I get back from postman.

Otherwise, statically targeting, I get this:

you are right with dynamic action id… it doesnt work.

but with static it works like charm.

This is what I am doing in my code to capture the action status. Not sure if its right way or not.

query=“(detailed status of result of it) of bes action whose (id of it =”+action_id+" )" <<<<-- to get the cumulative status… which will be ‘The action executed successfully.’ and keep it running in the loop till it gets the successful status.

and then run this below query to get the each server status if its failed of fixed…

(name of computer of it,statuses of it) of results of bes action whose (id of it = “+action_id+”) <<<< -

That query doenst work if “Target” is -“Enter device names”

Capture1

Capture

I think this is issue in the qyery “number of target computers of it”… which is 0. It should be 4.

and that is the reason you get infinity. However the 0 should be returned only when using dynamic groups as targets, imho.

yah. I am wondering the same… why its returning 0 for targeted computers even the “target - Enter device names”

If the Target is “Enter device names” no charm. this scenrario comes up when I target action via REST API using XML for action.

image

if Target is “Select devices” then query works… … This scenario is with when I target using bigfix console.

image