Jump to content


Photo
- - - - -

Keeping track of users...


21 replies to this topic

#1 gkwalton

gkwalton

    Expert

  • Members
  • PipPipPipPip
  • 106 posts
  • Gender:Male

Posted 01 June 2004 - 03:48 PM

Hello,

Does anyone know the best way to keep track of the number of users in a proiv session.

As a user signs on I would like to query the number of users on that session and stop them from signing on if there are too many. This would work similar to the way PROIV does it but I would like to have control.
The reason for this is that I have two companies running on the same server and only X users are allowed to sign onto the one company and Y onto the other.

Any ideas would be appreciated.

George.

#2 Ross Bevin

Ross Bevin

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 226 posts
  • Gender:Male
  • Location:Manzanillo, Colima, Mexico

Posted 01 June 2004 - 03:57 PM

Hi George,

The only way that I know how to do this is to write your own logon function. This function would write logon stats to a file that could be used to regulate logons. When the user logs off their session is deleted from the stats file. It is not widely known but you can alter the contents of @COMP and @OPR using your own logon function.

Ross

#3 gkwalton

gkwalton

    Expert

  • Members
  • PipPipPipPip
  • 106 posts
  • Gender:Male

Posted 01 June 2004 - 04:15 PM

Ross,

Thanks for the input.

What if the users breaks out abnormally (which they tend to do all the time)? Is there a way to refresh the user count? It would be great if SLMSTACK only had records for those users that were signed onto the system or something.

George.

#4 Ross Bevin

Ross Bevin

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 226 posts
  • Gender:Male
  • Location:Manzanillo, Colima, Mexico

Posted 01 June 2004 - 04:21 PM

We prevent our users from breaking out. They can only log off through a designated logoff function which removes their session data. The only problem we face is when we have to kill a user; we have to remember to go in and remove their session data manually.

Edited by Ross Bevin, 01 June 2004 - 04:22 PM.


#5 Tony Waszkiewicz

Tony Waszkiewicz

    Expert

  • Members
  • PipPipPipPip
  • 174 posts
  • Gender:Male
  • Location:London, United Kingdom

Posted 01 June 2004 - 04:25 PM

Hi George,

If you are running on a Unix box it is quite easy to see the number of sessions being used by "pro" by running "ps".
You can also use different logons for the two companies and thus know how many are signed on for each company.
It is also posible to see how long it has been since any activity and kill any defunct processes.

Of course all bets are off if you are on Windows, but you could also try the pro-iv timeout facility.
Does anyone know if it now works correctly?

regards

Edited by Tony Waszkiewicz, 01 June 2004 - 04:28 PM.


#6 Ross Bevin

Ross Bevin

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 226 posts
  • Gender:Male
  • Location:Manzanillo, Colima, Mexico

Posted 01 June 2004 - 04:30 PM

You are correct Tony; we are running in a Windows 2000 environment. Does anyone know of a system command in Windows that would return a list of Pro-IV users currently logged in, similar to the info in Pro-IV Services Manager?

#7 Joseph Bove

Joseph Bove

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 756 posts
  • Gender:Male
  • Location:Ramsey, United States

Posted 01 June 2004 - 07:48 PM

George,

To just fill in a little more detail on the Unix side...

Since you want to count the number of users in a given company (ABC).

ABCusers=`ps -edaf | grep pro | grep ABC | grep -v grep | wc | awk '{print $1}'`

Be sure to include grep -v grep. This guarantees that you will not find your own ps -edaf command and inadvertently count it as one of your user licenses.

hth,

Joseph

#8 Joseph Bove

Joseph Bove

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 756 posts
  • Gender:Male
  • Location:Ramsey, United States

Posted 01 June 2004 - 07:53 PM

Tony,

Timeout functionality looks like it is working on all platforms in later versions of 5.5.

As for knowing number of users logged into windows, sorry no idea. I wonder if their might be a way to consult %WINDIR%\prousers.pro. ProIV makes a lot of information available in their service manager and it must be stored somewhere.

It would be nice to get that service manager info on Unix as well - even if it were just in an ASCII dump.


Regards,

Joseph

#9 Donald Miller

Donald Miller

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 205 posts
  • Gender:Male
  • Location:Cupar, Fife, Scotland
  • Interests:Motorcycling, Running, Cooking

Posted 02 June 2004 - 07:52 AM

Hi George

I use the same method as Ross - there is a transparent logon that accesses a logon screen. This updates data and allows parameters to be set/maintained for individual users. There is also a logoff function that updates the record appropriately. There is also a feature that allows users that have crashed or broken out to have their data corrected appropriately. The users generally don't break out unless there's a Windows problem. They have to logoff correctly or they cannot logon again (or they need to get the supervisor to reset their user details).
Half of what he said meant something else, and the other half didn't mean anytthing at all

#10 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,640 posts
  • Gender:Male
  • Location:Spain

Posted 02 June 2004 - 09:04 AM

Hi,

If you really want to keep track of users on a Windows system....

First of all, there is a process on the windows server box that needs to always run, and that is pro32srv.exe

If you bring up Task Manager, you will see it in there.

First of all, you need to find the PID of that process, and you do this in the Task Manager. The PID column might not be displayed on your system, so you may have to go into the menu item View / Select Column and then check the PID column.

Next, in DOS type netstat -o.

This will list all connections to the windows server.

You have to look for lines that have your PID of the pro32srv.exe process on, and that will give you the IP address of the user logged on, under the 'Foreign Address' field.

Using this as a base, it should be possible to write a function, that gets the clients IP address who has logged on, and then runs at netstat on the server and effectively 'grep' out that IP address, and count the number of sessions...

A bit of work , yes... but it will accurately keep count of "logged on" users.

HTHs,

Rob D.

#11 George Macken

George Macken

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 248 posts
  • Gender:Male
  • Location:Co. Wicklow, Ireland

Posted 02 June 2004 - 09:09 AM

Hi George

Your requirement is

a) The control of the no. of Users Allowed to connect to an application, while having more than 1 PRO-IV application present on the machine.

:) This requirement would also generally fulfill the simpler requirement, of the no. of users allowed access to an application.
Some distributors make their Application avavailable on a per user pricing - therefore when the user needs more Users they need to
1) obtain more pro-iv licences
2) obtain the necessary application key/controls that allow more users on the application

I have wrote functionality into a few PRO-IV application over the years to meet both of the above - If I were to write this funtionality again I'd develop it to be available to any PRO-IV application, its really just LOG-ON & LOG-OFF functionality.

Really all thats required is a control record in the Application and some additional fields on the Application Operator record - (We also control that an Operator is only logged on once, provide operators with many logons if necessary)

Looks like lots of us having wrote this kind of code into our apps over the years

PRO-IV should have this funtionality built in (maybe it is there now, I havent looked recently) - My recommendation for PRO-IV to meet your immediate requirement - I assume you've 2 entries in the PRO-IV.INI - one for each application - If with this entry you could also specify the No. of PRO-IV users/connections - IF pro-iv.exe was checking this No. the same as it checks the total pro-iv connections - (I used another 4GL that worked similar to this) - its with PRO-IV todo if not already there

Rgds

George

#12 gkwalton

gkwalton

    Expert

  • Members
  • PipPipPipPip
  • 106 posts
  • Gender:Male

Posted 02 June 2004 - 12:58 PM

Joseph,

Thank you for the UNIX command. It works great!

My only problem now is getting that value into PROIV. The only way I can think of doing it is to return the output of the command to a file and then read that file into PROIV.

Is there an easier way to do it? I know you can get the value of PROPATH etc. by using &$@~PROPATH. Is there a similar way to do it with variables that you set in UNIX.

Thanks again,
George.

#13 Joseph Bove

Joseph Bove

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 756 posts
  • Gender:Male
  • Location:Ramsey, United States

Posted 02 June 2004 - 04:22 PM

George,

I think that reading the value into a file might be the best answer.

The problem with loading the value into an environment variable is that you do not end up with a real-time value. So, there is not much benefit in knowing how many people were logged in when you logged in.

But, my question is, do you even need the value within ProIV?

It seems to me that your login script would like something like this:

test number of licenses in use for company ABC
if value >= max, then
echo You will need to buy more licenses. Call today!
exit 0
fi
pro ABC operator....

If you wait until you're in ProIV, then you're exceeding the license quota and bouncing them after the fact.

Regards,

Joseph

#14 Tony Waszkiewicz

Tony Waszkiewicz

    Expert

  • Members
  • PipPipPipPip
  • 174 posts
  • Gender:Male
  • Location:London, United Kingdom

Posted 02 June 2004 - 05:59 PM

Hi George,

We do as Joseph has suggested, i.e. check in the login script and prevent the user from starting proiv if the count has been exceeded.

Don't forget to include your phone number and email just to make it easy to buy those extra licences :)

We also have the internal logging of users and activities etc. referred to as of course it would be all too easy to "hack" a login script if this was your only revenue source.

regards

#15 gkwalton

gkwalton

    Expert

  • Members
  • PipPipPipPip
  • 106 posts
  • Gender:Male

Posted 03 June 2004 - 06:59 PM

Joseph,

Your technique makes a lot of sence. I never thought of testing in the script itself as unfortunately, my programming knowledge outside of PROIV is quite limited.

I like the idea of including the phone number :) Great touch!

Thanks for all your help.

George.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users