Expired action status in last 2 hours

Hello All,

We have got requirements to check expired action in last two hours and identify list of servers which not been patched (whose status does not shows as completed or pending restart).
Can anyone please guide how to collect this information using rest api query.

My suggestion is to take a look at the guide here: https://developer.bigfix.com/rest-api/api/

You would probably want to use the query resource for this one. Your query would have to be written in BigFix relevance language.

Tricky part of this query is defining “last two hours”. Are your actions setup in client local time or in UTC? If they are setup in client local time then “last two hours” would be time zone dependent. To create the proper query, you would also need a time zone property for each computer.

All the action are scheduled in UTC time zone.

Hi @Shweta1, Did you find a solution for this query ?

We are willing to extract a list of Expired/Stopped Jobs (Excluding some operators) using REST API for which we are looking for suggestions. Can anyone please suggest

I am not able to figure out how to fetch last 2hours of expired action.
Anyone if you can help with the syntax plz…

Using session relevance

names of BES Actions whose ((State of it as lowercase = "expired") AND (End Date of it >=(current date - 2 * hour)))

names of BES Actions whose ((State of it as lowercase = “expired”) AND (End Date of it >=(current date - 2 * hour)))

How can we use UTC time format “now as universal string” because all the actions in our environment are getting executed in UTC format

Also below command does not give correct out
current date - 2 * hour

Q:current date - 2 * hour
A: Tue, 21 Dec 2021
T: 0.133 ms

Q:Current Date
A: Wed, 22 Dec 2021
T: 0.068 ms

Basically, the requirement is to get action information which are expired in the last 2 hours.
Time Zone action start and End is UTC.

This gets anything expired greater than a day:

(end time_of_day of it, name of it) of bes actions whose(end date of it < current date)

But getting it within the last 2 hours is weird.

This is what would make sense to use: https://developer.bigfix.com/relevance/reference/bes-action.html#expiration-time-of-bes-action-time

But this says: This inspector was deprecated after version 5.0 and now only returns False.

I think this is probably because this is when the option to do UTC was introduced. I wish it would just be normalized and always return the value as UTC instead of just being deprecated, but I think this is also an issue since I don’t think the metadata stores it in a way that is obvious to map to UTC.

This is technically correct depending on the time of day. “current date” never includes time in the result, only the date.

Okay, So getting action details which are expired in the last 2 hrs is not possible via API Call…

I’m pretty sure it is possible, it just isn’t as easy as I hoped.

Is it possible to parse Date and time in API which will fetch Action status?
For example, if Action start Date & time was 10th-Jan-2021 10 AM UTC and action went to expired state then API to provide the status of the Server and patch is applied or not

You’d need to do the time manipulations in a higher-level language like Python or PowerShell and generate your API calls based on that. The API won’t do this for you, but you can do just about anything in a higher-level language by invoking the API.