mibuso.com

Microsoft Business Solutions online community
It is currently Fri May 24, 2013 3:43 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Count - Users Logged in at a time and storing result
PostPosted: Thu May 31, 2012 10:20 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
My Manager has asked me to create a table that will keep track of no. of user that are logged on to the database. We want this table to be run every 5 minutes. This is being done because one of our client is starting to run low on the no. of user licences. We would like to find out when we have the most user traffic and how many users were logged in. This information must be saved on a table, because our ultimate goal is to create a report, which will display the time at which max no. of users were logged on each day. I am not really sure where to begin. Any suggestions.

My manager told me if I were to go to FILE-> DATABASE-> INFORMATION->SESSIONS, I can see the number of current sessions (users that are logged in). :D

Is it possible to automate the table so it could run every 5 minutues and store the result????.


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Thu May 31, 2012 10:33 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6979
Location: L.I., New York
Country: United States (us)
Is the real issue that some sessions are open & unattended?

If so there are many posts about automatically loggin out user sessions after a set amount of time has passed (10 mins, 20 mins, 30 min, etc) without activity.

This will insure that you have just active users logged in creating space for those who need to login from being locked out. Search forum for "Kill Idle Sessions"

Else increase your concurrent users in your license.

Also, we use in G/L Setup - there is a user setup where we check off "Register Time" and it stores the times in table 51 "User Time Register" We've modified CU1 & that table to include some new fields like
"Login Time"
"Logout Time"
"Day"

Code: Select all
LogInStart()
..
..
LogInDate := TODAY;
LogInTime := TIME;
..

Code: Select all
LogInEnd()
..
..
  IF RegisterTime THEN BEGIN
    LogOutDate := TODAY;
    LogOutTime := TIME;
..

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Last edited by Savatage on Thu May 31, 2012 10:49 pm, edited 1 time in total.

Top
 Profile E-mail WWW  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Thu May 31, 2012 10:47 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
I just talked to my manager again, and he suggested that I should create a codeunit instead and he suggested that I should make it work by using the OnRun Trigger and when its working manually, he will show me how we to automate it so it would run every 5 mintues.

Let me bang my head against the wall ](*,) and try to figure it out before I ask you guyz for help. :D

The bottom line is to show this information to the client, so that we could buy more licenses.


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Thu May 31, 2012 10:50 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6979
Location: L.I., New York
Country: United States (us)
See my post above - nav have the ability to store the times of users.
And we then can run reports off of that table.

What your manager is asking doesn't make sence to me. You either have enough licensed user sessions or you don't. Now if some users are leaving there sessions open & unattended then that's what you need to attack by closing these sessions.

I mean for how log do you plan on logging this info?
What if all your sessions are full early one day, midday then next or late at night the next.
Will you be telling some users they can't work between x:xx o'clock?

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Thu May 31, 2012 11:03 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5315
Location: Prague
Country: Czech Republic (cz)
nverma wrote:
My Manager has asked me to create a table that will keep track of no. of user that are logged on to the database.

You do know that there is a standard function in Navision that will give you this info right? ](*,)

_________________
David Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 10:27 am 
Offline

Joined: Fri May 18, 2012 3:04 pm
Posts: 148
Location: Armenia, Quindio
Country: Colombia (co)
You can use the Session virtual table to get this information and it might be helpful to also get the user's idle time in the process in order to know if it would help to be killing sessions of idle users.

_________________
Gerry Kistler
KCP Consultores


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 8:43 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
I just had a quick question. I have been able to count the total number of users that are logged on to the live database. I am not sure how to do the next step. Once its done counting I want the count to be written to a table(UsersLogged) to this field (Current Users) . and every time i run this codeunit it should add the count to the next line of the table. I tried this line but it didnt work: UsersLoggedOn."Current Users" := TotalUsers; :(

Code is written on the OnRun trigger on the codeunit.
Code: Select all
TotalUsers :=0 ;

Session.SETRANGE("Database Name", 'MODC - Live');
IF Session.FINDSET THEN
  REPEAT

    TotalUsers += 1;
   //     UsersLoggedOn.INSERT;
  UNTIL Session.NEXT = 0;
// UsersLoggedOn."Current Users" := TotalUsers;
MESSAGE('Total Users %1', TotalUsers);


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 8:47 pm 
Offline

Joined: Fri May 18, 2012 3:04 pm
Posts: 148
Location: Armenia, Quindio
Country: Colombia (co)
You need a primary key on the table maybe it is the DateTime, or an Entry No. If you use DateTime, no problem you will be creating a unique record each time. If you use EntryNo., then just get the last value in the table and increment it.

_________________
Gerry Kistler
KCP Consultores


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 8:51 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6979
Location: L.I., New York
Country: United States (us)
What I notice from your replys from multiple posts is that you appear never to question your "manager".
And even tho other suggestions are made you seem to just plow thru with the "managers" requests. You can have all your users loggin in at once doing nothing or 1 user doing heavy posting. Now you are not learning anything about usage by just saving the # of logged in users every 5 minutes in my opinion.

and closing unused/unactive sessions is where your focus should be.

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 9:01 pm 
Offline

Joined: Fri May 18, 2012 3:04 pm
Posts: 148
Location: Armenia, Quindio
Country: Colombia (co)
I agree with Harry just tracking users logged in does not give you much. You ought to choose an idle time limit and track not only total users but idle users as well. Then you will have something you can analyze and can intelligently decide if your problem is idle users not logging out or if you are using TS or Citrix, not logging out properly, or you really need to purchase addition user sessions. This information is in the Session table, so getting this information at the same time will be easy.

_________________
Gerry Kistler
KCP Consultores


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 9:08 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
I see your point and I agree with kicking the user off after a certain idle time. But, what I am trying to do is just create a table which has the total number of users that are logged on and collect data for few weeks and then present it to the client so they could take the appropriate steps to get more licenses.

I am doing this table just to get the proof to show them we are getting close to using up all the licenses.


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 9:18 pm 
Offline

Joined: Fri May 18, 2012 3:04 pm
Posts: 148
Location: Armenia, Quindio
Country: Colombia (co)
You are not doing your customer any service if you do not include idle users. You would be far better ahead with customer relations if you included idle users, and if that is the problem then sell them something to kill the idle users. If you find out it is not idle users then go ahead and sell them more user sessions. But if you sell them user sessions and then they find out their problem really was idle users, they will not be a happy customer. I have found if I think of the customer first, I will come out ahead in the long run.

_________________
Gerry Kistler
KCP Consultores


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 9:20 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
There are already measures in place to kick the user off after a certain idle time. This little piece that I am working on is to show them we are in need of more licenses.


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 9:25 pm 
Offline

Joined: Fri May 18, 2012 3:04 pm
Posts: 148
Location: Armenia, Quindio
Country: Colombia (co)
It would have saved all of us time if you had bothered to mention this little piece of information when idle users was first mentioned.

_________________
Gerry Kistler
KCP Consultores


Top
 Profile E-mail  
 
 Post subject: Re: Count - Users Logged in at a time and storing result
PostPosted: Fri Jun 01, 2012 9:32 pm 
Offline

Joined: Fri Sep 30, 2011 7:04 pm
Posts: 298
Country: Canada (ca)
my bad....

how do i write the count to the UserLoggedON table....i did setup a primary key called Line No. (integer -data type) and i increment it at the end of codeunit...but still nothing...any idea what i might be doing wrong....?????


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: