Actual action start and end time

This is for the end date:

(end date of it ,end time_of_day of it) of bes actions whose (id of it = 4683)

However, if I replace “end” with “start” (as the Inspector Reference suggest), It does not work…

  • this the expiration date of the action… I’m still looking for it myself because I need it too, but it’s not that easy.

(btw, you can download the Session Relevance Tester for testing)

i used this command but i am not getting the actual end time of action

Yes, as I said, that’s the expiration date of the action. I’m still looking for that too.

ok thank you @steini44

1 Like

I’ve imported following report, but this gives all the actions:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014744532#repliesPg=0

I tried to adjust the relevance from inside of it, but no luck so far. I’ll keep you posted.

There is some info here.
Summary is that this is not available in Session Relevance but possible via the REST API.

Example:

https://localhost:52311/api/action/399/status
<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
    <ActionResults Resource="https://localhost:52311/api/action/399/status">
        <ActionID>399</ActionID>
        <Status>Expired</Status>
        <DateIssued>Mon, 04 May 2015 01:09:51 +0000</DateIssued>
        <Computer ID="11577043" Name="TINTIN">
            <Status>The action executed successfully.</Status>
            <State IsError="0">3</State>
            <ExitCode>0</ExitCode>
            <ApplyCount>1</ApplyCount>
            <RetryCount>1</RetryCount>
            <LineNumber>42</LineNumber>
            <StartTime>Mon, 04 May 2015 01:11:16 +0000</StartTime>
            <EndTime>Mon, 04 May 2015 01:11:57 +0000</EndTime>
        </Computer>
    </ActionResults>
</BESAPI>

@leewei 's answer is what you want to do – use the REST API.

I was playing around with the client and it looks like start times and end times are stored under “State” in the “ACTION_STATE_HISTORY” table in the sqlite database actionhistory.db.

You could write an analysis like this:

(preceding texts of first ":" of it as integer, (parenthesized part of matches (regex "ast=(\d*)") of it| "0") as integer * second + ("01 Jan 1970 00:00:00" as local time), (parenthesized part of matches (regex "lat=(\d*)") of it | "0") as integer * second + ("01 Jan 1970 00:00:00" as local time)) of (rows of statement "Select State from ACTION_STATE_HISTORY" of sqlite database of file (pathname of parent folder of client & "\__BESData\__Global\ActionHistory.db") as string)

Which will return results like this:

A: 276, ( Sun, 20 Dec 2015 16:09:30 -0600 ), ( Sun, 20 Dec 2015 16:09:30 -0600 )
A: 275, ( Sun, 20 Dec 2015 16:09:30 -0600 ), ( Sun, 20 Dec 2015 16:12:04 -0600 )

ActionID, Start DateTime, End DateTime.

You could use this and the actionIDs to generate average runtimes for actions across your environment.

But I would still probably do it LeeWei’s way if that’s an option.

2 Likes

Hi @leewei and @strawgate

Thanks for your answer.

Just a small question for Lee: How do you do it in the customized report https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014744532#repliesPg=0 ?

<?relevance concatenations of trs of (td of html ("<A name=%22" & (if (exists name of computer of it) then (name of computer of it) else ("Name Missing")) & "%22 href=%22" & (if (exists link href of computer of it) then (link href of computer of it) else ("")) & "%22 target=%22_blank%22>" & (if (exists name of computer of it) then (name of computer of it) else ("Name Missing")) & "</A>") & td of (if (exists id of action of it) then (id of action of it as string) else ("ID Missing")) & td of html ("<A name=%22" & (if (exists name of action of it) then (name of action of it) else ("Action Name Missing")) & "%22 href=%22" & (if (exists link href of action of it) then (link href of action of it) else ("")) & "%22 target=%22_blank%22>" & (if (exists name of action of it) then (name of action of it) else ("Action Name Missing")) & "</A>") & td of (if (exists state of action of it) then (state of action of it) else ("Action State Missing")) & td of (if (exists time issued of action of it) then (((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 & ":" & two digit second of it as string) of time (local time zone) of it) of time issued of action of it) else ("Issued Time Missing")) & td of (if (exists start date of action of it and exists start time_of_day of action of it) then (((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 & ":" & two digit second of it as string) of time (local time zone) of it) of ((start date of it as string & " " & start time_of_day of it as string) as local time) of action of it) else (if (exists time issued of action of it) then ((((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 & ":" & two digit second of it as string) of time (local time zone) of it) of time issued of action of it)) else ("No Start Date"))) & td of (if (exists end date of action of it and exists end time_of_day of action of it) then (((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 & ":" & two digit second of it as string) of time (local time zone) of it) of ((end date of it as string & " " & end time_of_day of it as string) as local time) of action of it) else ("No End Date")) & td of (if (exists issuer of action of it and exists name of issuer of action of it) then (name of issuer of action of it) else ("Issued By Missing"))) of results of bes actions ?>

Isn’t that session relevance?

And I honestly thought that REST API and session relevance were the same…?

Thanks for your help!

@steini44, When we take an action against a Fixlet/Task, we get a “BES Action” object.
Every computer responding to that will generate a “BES Action Result” object.

“BES Action” has a start and end time. The end time is when the BES Action is to expire.

The “BES Action Result” start and end times are when individual computers performs the action.
This is the one not available through Session Relevance.

Session Relevance can be issued via the REST API with the resource /api/query?relevance=XXX.
The availability of the BES Action Results start/end times is through a special REST API resource.

Hope you are now confused. :smile:

1 Like

It’s perfectly clear now! Thanks for the help Lee! :smile:

See here for more ActionHistory.db examples that @strawgate mentions:

Side Note: I’d like to see more info in ActionHistory.db … it is very useful, but could be even more so.

Also, the amount of history in the ActionHistory.db seems to be controlled by a Client Setting that defaults to 1 year. I’m considering increasing it to 5 years.

1 Like

i used this , id,date,month are same but time is not matching with my action

Is it just a timezone issue? Is it off by just a few hours but the minutes and seconds are right?

As long as it is just off by hours that shouldn’t matter because you are talking about the difference between start and end times and not the exact start or exact end time

1 Like

And did you use the REST API or the session relevance? Can you post your code of what you tried?

If this is the case, you can adjust it with relevance. @strawgate might be right about this, it would make the most sense for the times to be stored as UTC but then they can be converted to the local time zone equivalent easily.

1 Like

Hi Lee,

How can I filter result to get only actions deployed within 60 days?Thanks

It will be perfect to have the “Start Time” and “End Time” showing in the console in the Actions result screen like the “Exit Code”. This way we can export it easily. I contacted IBM and they suggested to open an RFE. Here is the link: http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=102861

Hi All,

Any update on this? Thanks

Thanks Strawgate, that was the thing I was searching for.
Is there a way to find only a DateTime that match with a fixlet ID ?

Added in 9.5.7 Start Time of <action result> and End Time of <action result>
https://developer.bigfix.com/relevance/reference/bes-action-result.html

2 Likes