Progress Application Server - pasman sessions

Posted by Derek Lord on 24-May-2018 12:49

I am trying to get the number of users actively connected to a Progress Application Server to control concurrent access to an application. The backend database is SQL Server, using the SQL Dataserver. There are a mix of users using the application from normal windows desktop Prowin sessions (which I can already count and do not use the PAS) and Mobile access via the Progress Application Server.


Given the output:(below) from pasman, is there a way to get the session count (value from <1 minutes) without issuing a pasman command?

proenv>pasman sessions -I Test -u user:pswd WebApp
OK - Session information for application at context path /WebApp
Default maximum session inactive interval 30 minutes
<1 minutes: 2 sessions
12 - <13 minutes: 1 sessions
13 - <14 minutes: 1 sessions

All Replies

Posted by Peter Judge on 24-May-2018 12:56

How would you want to get them (what client)?
 

Posted by Derek Lord on 24-May-2018 13:20

When the mobile app signs into the application I want to get a session count of active sessions.

The call needs to be from a progress procedure to get the number of active sessions on the PAS instance.

We are doing this to ensure the customers comply with the license counts they are licensed for.

Posted by Irfan on 24-May-2018 13:43

Are you interested to run JMX query from command line, write that to a output to a file in JSON and read it from there? All this can be done from ABL(if you like to run the JMX query from OS-COMMAND).

Posted by Derek Lord on 24-May-2018 13:50

I am wide open to suggestions, it will be the PAS instance that will execute the code.

If you could provide a sample of the JMX query and how to run it from ABL to get the active sessions that would certainly be something I would be interested in.

Thanks,

Derek

Posted by Peter Judge on 24-May-2018 13:58

You should be able to get this via REST call from an ABL session
- you will need the oemanager webapp deployed
- there’s an example of making a call to the oemanager stuff at github.com/.../get_applications.p
 
 

Posted by Irfan on 24-May-2018 14:08

The one you are looking for is a manager (tomcat)  API, so you cannot have access for its REST API. To run it from JMX, you can run the following query

{"O":"Catalina:type=Manager,host=localhost,context=/","A":"activeSessions"}

This should be written to file(any name and extension) and then run the following command

 oejmx.bat|sh -R -Q <your query file> -O <Absolute PATH of output file>

It should dump the json output in the file you have mentioned.

if you are running 11.7.2 then you have to change the oejmx script to pick the right JDK. You do not have to do anything with 11.7.3.

Posted by Derek Lord on 24-May-2018 15:27

I am using OE 11.7.1, where do I find oejmx.bat?

Posted by Derek Lord on 24-May-2018 15:38

The article: knowledgebase.progress.com/.../How-to-get-an-OEPas-Session-Agent-Stack

Seems to indicate it should be <PASOE Instance>/bin: oejmx.bat

I do not have that bat file in either my dev instance folder, or a test production environment.

Posted by Irfan on 24-May-2018 15:41

We started shipping oejmx from 11.7.2.

Posted by Derek Lord on 24-May-2018 15:47

Is it available for 11.7.1, can I install it somehow other than going to 11.7.2?

Posted by Derek Lord on 24-May-2018 15:49

And how would I call that from a Windows desktop prowin session that does not have access to the Instance/bin folder?

Posted by Matt Baker on 24-May-2018 16:47

If /oemanager web app is installed you can use the ABL HTTP client to fetch the URL.  If not, then you need to use JMX which requires a java client.

Posted by Derek Lord on 24-May-2018 17:00

What would the URL be to get the activeSessions?

Posted by Derek Lord on 24-May-2018 17:38

This seems to give me what I want from a URL:

http://<server>:<port>/manager/jmxproxy/?get=Catalina:type=Manager,host=localhost,context=/WebApp&att=activeSessions

Result:

OK - Attribute get 'Catalina:type=Manager,host=localhost,context=/LumberTrack' - activeSessions = 1

Posted by dbeavon on 24-May-2018 17:58

"LumberTrack".... Looks like we have something in common. Our version of it originates about 20 years ago, and we still run ours on HP-UX!

I think the difference between your "manager" url and the "oemanager" URL (that Matt suggested) is that the first one is a REST interface that is focused on tomcat HTTP sessions and the latter is for OE ABL sessions.

"Session" is a term that is way over-utilized, especially within the context of PASOE. Here is a KB that describes the variety of things that are named "session" in PASOE. https://knowledgebase.progress.com/articles/Article/What-are-the-types-of-OpenEdge-sessions . So it might be helpful if we could start by clarifying which type of session you want to monitor.

More importantly, it sounds like Progress sold you DataServer licenses for concurrent ABL users. Couldn't you ask Progress to sell you the same type of licensing model as you have for PASOE (ie. probably core licensing for both?) It seems a pain to self-audit with home-grown code.  I'm eager to hear how things turn out.

Posted by Matt Baker on 24-May-2018 18:31

The /manager application is Tomcat's manager application.  It has functionality specifically for Tomcat.

tomcat.apache.org/.../manager-howto.html

The /oemanager web application is from OpenEdge.  It provides data on ABL applications, including agent and ABL sessions.

documentation.progress.com/.../index.html

Both of these have REST interfaces, although Tomcat's mostly returns raw text, while /oemanager always sends and receives JSON.

Posted by Irfan on 24-May-2018 19:32

Darek,

If that is what you were looking for then yes, accessing the manager Web Application should give you what you want. I thought you wanted to run it as a batch program within the PASOE Instance.

Posted by Derek Lord on 25-May-2018 15:30

I don't see 'activeSessions' sessions from /oemanager, is that available?  It seems like that is coming from the /manager only.

Irfan, I do not 'need' a batch program. The flow would be to attempt to sign in, check user counts and stop the sign in if the license count does not come within the parameters we set.

I just need to see how many desktop connections (which I know) + Mobile connections.

Active sessions (which have not timed out yet) seems to be the only metric I can get from the PASOE.

Assuming the mobile app keeps sending requests to the WebApp they are active, until their session times out.

Am I wrong in this assumption?

Thanks,

Derek

Posted by dbeavon on 25-May-2018 16:43

There are a few levels of management cruft you need to drill thru before you get the sessions.  (1) instance of pasoe/tomcat, (2) abl application name - often the same as the instance name, (3) multisession agent ID, (4) available sessions hosted within the agent

Assuming you have an instance of tomcat at port 8815, and an abl application named abl_dev_statefree_dev (as an alternative to oepas1 which is the normal application name and instance name) then you can get down to the multisession agent ID(s) with a powershell script like so:

$agent= $null
$response = $null
$response2 = $null
 
# Store credentials
$pass="tomcat" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object   System.Management.Automation.PsCredential('tomcat',$pass)
 

# Retrieve available agents
$response = Invoke-RestMethod -Uri hddp://localhost:8815/oemanager/applications/abl_dev_statefree_dev/agents -Credential $cred 
 
# Parse out the results into JSON
$jsonstring = ConvertTo-Json -InputObject $response -Depth 3
$json = ConvertFrom-Json -InputObject $jsonstring 
 
# Retrieve an available agent 
$agent = $json.result.agents | Where-Object -Property 'state' -EQ 'AVAILABLE' 
  
# PRINT AGENTS
$agent
 

Then you should see an agent ID that looks a bit like a nasty guid: "Js89lnhITRaVIivJOewS1w", along with an operating system PID and a state.

At that point you can use the agent ID ("Js89lnhITRaVIivJOewS1w") in a new REST url in order to drill down to the next level which is the abl sessions:

$agent= $null
$response = $null
$response2 = $null
$jsonstring = $null
 
# Store credentials
$pass="tomcat" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object   System.Management.Automation.PsCredential('tomcat',$pass)


 
# Retrieve available agent sessions using abl app and agent id
$response2 = Invoke-RestMethod -Method Get -Uri ('hddp://localhost:8815/oemanager/applications/abl_dev_statefree_dev/agents/Js89lnhITRaVIivJOewS1w/sessions') -Credential $cred

# Parse out the results into JSON
$jsonstring = ConvertTo-Json -InputObject $response2 -Depth 4

# PRINT
$jsonstring

Note that there can be multiple abl sessions within each agent process.  This is why they are called multi session agents.  It is less common but there can also be multiple agent processes within each abl application (this would happen under extreme load).  

It may take a bit of effort but you should be able to enumerate *all* sessions for *all* agents.  Note that the sessions also have a "SessionState" property and are often "IDLE".  I wouldn't think that these idle ones would count towards your concurrent user total. Hope this helps.

Posted by Irfan on 25-May-2018 16:49

Darek,

The metrics you want is only available in "manager" WebApp, it is not part of oemanager. /manager is tomcat WebApp and the metrics it displays is different to that of what "oemanager" displays. You might also want to look at /oemanager/applications/<ABL App>/metrics this will give you metrics information and you can get the active requests count from 'concurrentConnectedClients' value from the REST API output. I am guessing you could run a ABL HTTP Client   from your desktop Application.

Posted by dbeavon on 30-May-2018 18:46

Derek,

Could you please let us know how you ended up self-auditing your concurrent user licenses in the context of the PASOE appserver? I think your approach would be of interest to the community.  

Ideally there would be a practical example of doing this in the Progress KB as well.

Thanks, David

Posted by Derek Lord on 31-May-2018 11:59

Hi David,

For our needs, looking at the active sessions in the tomcat manager is sufficient.

This shows the active sessions for the webapp that have not yet timed out.

When a session times out, the next call to the api will require signing in again.

The sign in process will look at the active session count to determine whether it falls into the allowable application license counts.

Hope that helps,

Derek

This thread is closed