Automic Workload Automation

Expand all | Collapse all

how to check the user login session time

  • 1.  how to check the user login session time

    Posted May 16, 2017 02:05 PM

    Hi is there any particular way to determine the login session of a individual user. We are using script function : DISCONNECT "USER" to log off the deactivated user and we have scheduled it for every 3hrs, so the individual who log in pre-run of the script those session will get terminated, but we want to add a condition under which user session > 2hrs will terminate. 



  • 2.  how to check the user login session time

    Posted May 16, 2017 03:35 PM
    There is no out-of-the-box script function for that request.

    With a small (T-)SQL script it can be determined easy cheesy :-)


    select AUSR_NAMEDEPT, AUSR_CLIENT, AH_TimeStamp1 as 'connected since [UTC]',AUSR_AH_IDNR as 'RUN ID' from AUSR, AH
    where AUSR_AH_IDNR = AH_IDNR
    and AUSR_CLIENT = 1




  • 3.  how to check the user login session time

    Posted May 17, 2017 07:21 AM

    Wolfgang Brueckler said:

    There is no out-of-the-box script function for that request.

    With a small (T-)SQL script it can be determined easy cheesy :-)


    select AUSR_NAMEDEPT, AUSR_CLIENT, AH_TimeStamp1 as 'connected since [UTC]',AUSR_AH_IDNR as 'RUN ID' from AUSR, AH
    where AUSR_AH_IDNR = AH_IDNR
    and AUSR_CLIENT = 1




    Thank you for responding,

    so is there any way to implement the script directly or do we have to install the sql agent to test/run the script. can you please provide some more detail on your script.  



  • 4.  how to check the user login session time

    Posted May 17, 2017 07:59 AM
      |   view attached

    user session > 2hrs will terminate.

    Hi KumarRahul605332
     
    Just a few guidelines on this.

    1 - You can query AUSR and AH to get the list of active users:

    SELECT AH_NAME
    FROM AH
    WHERE AH_IDNR IN (SELECT AUSR_AH_Idnr FROM AUSR)
    AND AH_Client='&$CLIENT#';
    Use this SQL in a SQLI object - let's call it 'VARA.SQLI.ACT.USR'.


    2 - You may use some scripting - preferably activated recursively in an EVNT.TIME - that will :
    • pull the list of active users from 'VARA.SQLI.ACT.USR'
    • get their activation times with GET_STATISTIC_DETAIL (this could also be done via the SQL statement by querying 'AH_Timestamp1', but you'll need to convert the timestamp)
    • calculate the actual connection time and disconnect the user if it's exceeded

    Here is a script that does what is listed above:

    :SET &HND#=PREP_PROCESS_VAR(VARA.SQLI.ACT.USR)

    :PROCESS &HND#

    :  SET &USER# = GET_PROCESS_LINE(&HND#,1)

    :  SET &ACT_TIME#= GET_STATISTIC_DETAIL(,"ACTIVATION_TIME", "&USER#")

    :  P &USER# is active since &ACT_TIME#

    :  SET &ACT_TIME# = STR_CUT(&ACT_TIME#,12)

    :  SET &DURATION# = DIFF_TIME("HH:MM:SS;&$PHYS_TIME_HH_MM_SS#","HH:MM:SS;&ACT_TIME#")

    :  IF &DURATION# GE 20000

    :    P Maximum connection time has been exceeded. User &USER# will be disconnected.

    :    DISCONNECT "USER","&USER#"

    :  ENDIF

    :ENDPROCESS

    Please note however that this is a very simplified method, as it will affect all users in the current client, which may not be what you are looking for. In which case you will need to be more specific on which sessions should be killed and which ones shouldn't.

    I am attaching an xml export of the used objects (generated under User Interface 11.2.4+hf.1.build.739).

    Best regards,
    Antoine

    Attachment(s)

    xml
    disconnect_users.xml   4 KB 1 version


  • 5.  how to check the user login session time

    Posted May 18, 2017 04:40 AM
    so is there any way to implement the script directly or do we have to install the sql agent to test/run the script.

    You do not need a SQL agent to useSQLI variables.

    However you need to allow them inUC_SYSTEM_SETTINGS: set 'SQLVAR_INTERNAL' = 'YES'.

    If you want to usepredefined variableslike&$CLIENT#you will also need to setVAR_SECURITY_LEVELto '1' or higher.


    Best regards,

    Antoine



  • 6.  how to check the user login session time

    Posted Oct 26, 2017 08:07 AM
    Hi Antoine_Sauteron  I have 5 stuck user sessions that show in my system overview and they are also consuming license. I tried disconnecting them via GUI (UC4 tool) and also via your script. But those sessions do not appear to go. I even restarted the CP on which one of the user was connected but it also did not help. Further I deactivated the user to see if it helps, Deactivating the user removed the user session but does not release the license. With no success, I finally raised a support ticket and am awaiting there reply.


  • 7.  how to check the user login session time

    Posted Oct 27, 2017 04:09 AM
    Hi ShashankSingh606566

    Good thing a raised a support ticket! I remember a similar case in the past, and it was resolved after recycling the WPs (stop restart them one after another).

    Hope this helps.

    Best regards,
    Antoine


  • 8.  how to check the user login session time

    Posted Oct 27, 2017 08:03 AM
    Thank you Antoine_Sauteron for this workaround. We have server patching activity coming weekend and the servers will be rebooted. I will take this opportunity to recycle the WPs and see it that resolves my issue.


  • 9.  how to check the user login session time

    Posted Oct 27, 2017 11:57 AM
    Side-bar regarding WP recycles;

    Recycling WPs can orphan some client connections.  I recycle ours monthly because we have memory leaks, and I always warn those that are logged on that they will need to recycle their client.

    And in our case, recycling our WPs causes the system to stop.  This is because we have UC_CLIENT_SETTINGS/STARTUP_ACTION set to "STOP".  We turned this feature on after our DR tests taught us that letting our AE server automatically run things after a reboot can be bad for business recovery.  If it comes up stopped, then an admin can evaluate the situation before letting any of the scheduled objects run.


  • 10.  how to check the user login session time

    Posted Oct 31, 2017 06:15 AM
    Shashank Singh said:
    Thank you Antoine_Sauteron for this workaround. We have server patching activity coming weekend and the servers will be rebooted. I will take this opportunity to recycle the WPs and see it that resolves my issue.
    The issue was resolved after restarting the UC4 services on application servers. Unfortunately there was no help received from support. Thank you once again Antoine_Sauteron



  • 11.  how to check the user login session time

    Posted Oct 31, 2017 06:56 AM
    Thanks for your feedback Shashank!
    I work for support, so you did get help from support, but via a different channel :)

    Best regards,
    Antoine


  • 12.  how to check the user login session time

    Posted Oct 31, 2017 07:10 AM
    Antoine Sauteron said:
    Thanks for your feedback Shashank!
    I work for support, so you did get help from support, but via a different channel :)

    Best regards,
    Antoine

    :)