extracting srvid in uniface

Author: lalitpct@gmail.com (lalitpct)


I was trying to get process id for the entry created for uniface application in unix,when i check the process i get below processes runnign by same id.
only difference i see is for srvid , i have two question
is there any way to find srvid in uniface.?
is it unique pers session ?  
 
/opt/uniface/9401/common/bin/userver -srvid=12 -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=smart2ap -chn=6 -ex -dir=/rsmtreg1/rsm2app1/var/dev/ap -asn=/rsmtreg1/rsm2app1/opt/dev/ap/sources/asn/gui/SMART2AP.asn
/opt/uniface/9401/common/bin/userver -srvid=11 -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=tsmart2ap -chn=6 -ex -dir=/rsmtreg1/rsm2app1/var/dev/tap -asn=/rsmtreg1/rsm2app1/opt/dev/tap/sources/asn/gui/TSMART2AP.asn
/opt/uniface/9401/common/bin/userver -srvid=10 -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=startup -chn=6 -ex -dir=/rsmtreg1/rsm2app1/var/dev/ap -asn=/rsmtreg1/rsm2app1/opt/guistart/startup_dev_ap.asn
/opt/uniface/9401/common/bin/userver -srvid=9 -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=startup -chn=6 -ex -dir=/rsmtreg1/rsm2app1/var/dev/ap -asn=/rsmtreg1/rsm2app1/opt/guistart/startup_dev_ap.asn
/opt/uniface/9401/common/bin/userver -srvid=26 -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=smart2ap -chn=6 -ex -dir=/rsmtreg1/rsm2app1/var/dev/ap -asn=/rsmtreg1/rsm2app1/opt/dev/ap/sources/asn/gui/SMART2AP.asn
/opt/uniface/9401/common/bin/userver -srvid=25 -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=startup -chn=6 -ex -dir=/rsmtreg1/rsm2app1/var/dev/ap -asn=/rsmtreg1/rsm2app1/opt/guistart/startup_dev_ap.asn

16 Comments

  1. The UROUTMON internal uniface utility will give you access to the functionality of the urouter monitor from which you can identify the server numbers in use. (The GET_SERVERS operation).

    To find out which server a client is using directly you can use GET_CLIENT_DYN.

    Whether the servers are session specific is more dependant on the asn file. Any paths in the ASN with /ex will start session specific servers. Otherwise the servers form a pool, where the first server in line will receive the request from every client, unless it is in use, when the next server will get routed the client. This is the default, and probable implementation, and means each client COULD get a different server for each request. (There are various programming tricks to either ensure the client does or doesn't get the same server back for a reque4st for the same data.... )


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)

  2. but while compiling i get warning  ,not sure how to use it i even tried GET_CLIENT_DYN() and get same warning.
    Phase  7:   Procs compilation
    (EXEC)      2         script_output =GET_CLIENT_DYN
    (EXEC)  warning:   1000 - Field 'GET_CLIENT_DYN' not found


    Author: lalitpct (lalitpct@gmail.com)
  3. it's

    activate "UROUTMON".GET_CLIENT_DYN( , , updatestatic, URCLIENTD.UROUTMON)

    This involves you haveing imported the DICT model into your repository, and probably having found your client information from the other operations available on the UROUTMON signature. Look up UROUTMON in the help file for more information.


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)

  4. when i open DICT  I can only go to enities and not any forms and i could not see any uroutmon as the entity.
    Just to give more info..We are opening by below command as a result capturing process id in the unix doesnt seem to be possible.
    since srvid seems unique i think we can look for that in all userver connections.

    open "|%%$$func_id|%%$pinfo$|%%$$server /ex","$LOG/NET".
    1)can we get srvid when above command is executed which will give some info about srvid
    2)If there should be some forms in DICT model please let me know how to import that, as i thought this should be present by default


    Author: lalitpct (lalitpct@gmail.com)
  5. No the model is just the entities, the component 'UROUTMON' just exists for use in the same way that the component UPOPMAIL exists.

    Have you looked at the examples in the help pages under UROUTMON?


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  6. The UROUTMON model is not part of the DICT or the Meta Dictionary (that can be installed with the idf.exe command line switch "/ins meta").

    When you however check the description of the different operations of the UROUTMON component API in the Uniface Library then you'll find the definition of the required UROUTMON entities. See bellow an excerpt from the doc fo the GET_CLIENT_DYN operation.

    But if you're too "lazy" - just kidding :-) - to create the UROUTMON entities yourself then you also can download an export of the model from here:

    I hope the provided information is helpful.

    Kind regards,
    Daniel

    *** Usual disclaimer ***

     

     

    Uniface Reference > APIs: Uniface Components > UROUTMON > GET_CLIENT_DYN

    GET_CLIENT_DYN

    Get dynamic information about a client registered with the Uniface Router.

    Syntax

    operation GET_CLIENT_DYN

    params

       string Host : IN ; (C80)

       numeric PID : IN ; (I4)

       boolean Updatestatic : OUT ; (B2)

       entity URCLIENTD.UROUTMON : OUT

    endparams


    Parameters

    • Host (mandatory) is the client’s host name (from the URCLIENTS entity)
    • PID (mandatory) is the client’s process ID.
    • The output parameter Updatestatic specifies whether the last returned static clients view should be updated (TRUE) or not (FALSE).
    • Single occurrence of entity URCLIENTD.UROUTMON, containing client information

    Table 1. URCLIENTD.UROUTMON Entity

    Fieldname

    Packing Code/ Data Type

    Description

    host

    C80/S

    Client's host / IP address: primary key field 1

    pid

    I4/N

    Client's process ID: primary key field 2

    idle

    I4/N

    Ticks idle

    idlepercent

    I1/N

    Percentage idle

    busy

    I4/N

    Ticks busy

    busypercent

    I1/N

    Percentage busy

    wait

    I4/N

    Ticks wait

    waitpercent

    I1/N

    Percentage wait

    state

    C1/S

    B = busy, I=idle, W=wait

    srvust

    C20/S

    Current or last server's UST

    srvustque

    I2/N

    Position in server UST wait queue

    srvid

    I4/N

    Current or last server's server ID

    srvidque

    I2/N

    Position in server ID wait queue

     


    Author: diseli (daniel.iseli@uniface.com)

  7. I got example for UPOPMIAL and not for GET_CLIENT_DYN
    when i checked the eg IntegrateHtmlEmail , it greates an instance and the acess the funcation in it.
    Could not figure out how to do similarly in GET_CLIENT_DYN

    Do you have some working examples on GET_CLIENT_DYN , as i am unable to use it properly.


    Author: lalitpct (lalitpct@gmail.com)
  8. I've just realised that the UROUTMON API will not really help you, since you're using exclusive Uniface Server's (-ex). The Uniface Router Monitor can only provide information about shared server's, since these are managed by the Uniface Router (URouter). An exclusive server is just started by the Router and then it's handed over to the client.


    Author: diseli (daniel.iseli@uniface.com)

  9. But in the process we see srvid =9 , somewhere this can be captured.
    rsm2app2  3408610  4063680   0 12:03:02      -  0:00 /rsmtreg1/rsm2app1/opt/uniface/9401/common/bin/userver -srvid=9  -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=startup    -chn  =6 -ex -dir  =/rsmtreg1/rsm2app1/var/dev/ap -asn   =/rsmtreg1/rsm2app1/opt/guistart/startup_dev_ap.asn

    When we have this exclusive connection at that time also we cant get the details ??


    Author: lalitpct (lalitpct@gmail.com)
  10. No you can't. But if you're /ex, then you're sure the userver you are working on is yours, and you can manage another way to retrieve the information.

    Since Uniface 9.4, you've the $processinfo("pid") which gives you the PID of your process, so the userver's one on a remote service. As soon as you have your pid, you can activate an OS command to get additional information from your system itself, including the command line, with ps for example.

    Kind regards
    Richard


    Author: richard.gill (richard.gill@agfa.com)
  11. Hi Richard,

     This works but gives pid which i guess is specific to compuware license manager , is there a way to link this process to unix process id.

    Or

    By using this pid can we try to kill the session on the server side , I checked options in license manager but could not see much info on that


    Author: lalitpct (lalitpct@gmail.com)
  12. Not sure what you mean, because I think this has nothing to do with the "License Manager".

    Do you mean that the pid you got is not the pid of the "real" acting process ??


    Author: ulrich-merkel (ulrichmerkel@web.de)
  13. Hem,

    For me, $processinfo("pid") has nothing to do with the license manager, only the system process id (we use this feature to kill zombie uservers fro aborted debug session, from a DSP). So you can use this pid with any unix/windows tool using this (kill, ps, tasklist, ...)

    Kind regards,
    Richard


    Author: richard.gill (richard.gill@agfa.com)

  14. I will try to explain the sceanrio
    We have client server architecture..
    when a user logs in below is the process that is generated

    Checking process in uniface using ps command , as we can see process id is 8126578

     In uniface when we capture $processinfo("pid") we get 6876 and I see it only license manager logs as shown below
     these two things are not linked hence could not get details
     
    /opt/uniface/cpwr/AIX/64/logging/log.txt
    [02/15/12-18:01:15] --OUT-ERR            tok(------------------) cv(4.5,Vista) usr(LD78977@APSGONTW0045@0) pid(6876) app(UWV1,09.01) cnt(1) pool(nill)
    [02/15/12-18:01:16] --OUT-HRTB1          tok(67E740D211990001) cv(4.5,Vista) dt(0.666 sec) usr(LD78977@APSGONTW0045@0) pid(6876) app(UW32,09.01) cnt(1) pool(nill)
    [02/15/12-18:01:17] --OUT-HRTB1          tok(67E740ABF5E400001) cv(4.5,Vista) dt(0.703 sec) usr(LD78977@APSGONTW0045@0) pid(6876) app(UCLIENT,09.01) cnt(1) pool(nill)
    [02/15/12-18:03:59] --OUT-HRTB1          tok(67E740FCFFF870001) cv(4.5,Vista) dt(0.758 sec) usr(LD78977@APSGONTW0045@0) pid(6876) app(UCLTSRV,09.01) cnt(1) pool(nill)
    [02/15/12-18:04:05] --OUT-HRTB1          tok(67E7404AA4B530001) cv(4.5,Vista) dt(0.741 sec) usr(LD78977@APSGONTW0045@0) pid(6876) app(UCLTSRVDB,09.01) cnt(1) pool(nill)

    In unix using ps -ef | grep userver
    rsm2app2  8126578  4063680   0 18:03:43      -  0:00 /rsmtreg1/rsm2app1/opt/uniface/9401/common/bin/userver -srvid=113 -dnp=TCP:+13000||D357AE89-5574-11E1-8260-C2F1FF759853| -drv=ANY -ust=smart2ap -chn=8 -ex -dir=/rsmtreg1/rsm2app1/var/dev/ap -asn=/rsmtreg1/rsm2app1/opt/dev/ap/sources/asn/gui/SMART2AP.asn
     


    Author: lalitpct (lalitpct@gmail.com)
  15. You're sure to use $processinfo("pid") from the service, which runs on the userver, not locally in uniface.exe ?

    aka in client's asn:

        [SERVICES_EXEC]
        SVC = $TCP:SVC

    in the form:

        activate "SVC".remote_oper()

    and in the service SVC:

        operation remote_oper
        variables
            string vPID
        endvariables

            vPID = $processinfo("pid")

        end

     


    Author: richard.gill (richard.gill@agfa.com)
  16. Great it worked thanks a lot


    Author: lalitpct (lalitpct@gmail.com)