If you are portal administrator, you can be interested which users logged into your portal and how much time they are spending here. In this case, you can try to use portal extension user-tracker-extension, which can provide these informations to you.
User-tracker-extension is extension of GateIn portal (EPP), which can be used to monitor user activities (login and logout of user). It contains listener services, which are able to detect login and logout of user into GateIn portal, and then save login/logout events into persistent storage (like DB).
Administrator is able to look at saved records and so that he can monitor who logged into his portal and when he logged etc. Administrator is also able to reset old records or other records, which are not important for him.
At this moment, there are 2 administration interfaces. First is jmx interface (It's recommended to operate JMX with web interface like jmx-console from JBoss), second is administration portlet developed with usage of JSF and Richfaces frameworks.
Actually we are using JCR for store the data and Chromattic framework for map Java objects into JCR nodes. This is implementation detail and you can look into source code if you are more interested in it.
Using this extension in your environment is very easy. You only need to download bundle with extension (or build it by yourself) and deploy it into deploy folder in your portal. And then restart the portal. This automatically enables tracking of login and logout operations. Here is a screenshot:
More detailed installation and usage steps (working with GateIn on JBoss)
1) Choose if you want to download EAR (1.a) or you want to download sources and build it by yourself (1.b)
1.a) Download ear from attachement of this document (file gtn-user-tracker-extension.ear ) into some location on your computer
1.b) Checkout project sources from http://anonsvn.jboss.org/repos/qa/portal/user-tracker-extension-parent/ and build with mvn clean install . ( It's tested with maven 2.2.1 so this version should work without problems )
2) Copy downloaded EAR into directory $GATEIN_HOME/server/default/deploy where GATEIN_HOME is location of your GateIn portal (assuming that you are using JBoss). If you build it by yourself (1.b) then you should have final ear bundle in user-tracker-extension-ear/target/gtn-user-tracker-extension.ear
3) Restart portal.
4) Go to http://localhost:8080/portal/private/classic and try to login as some user. And then logout. You can try predefined accounts mary, john, root .
5) Use administration interface to look at informations about user login/logout and administer them.
You can do these actions with admin interface:
- print informations about login/logout of all users or specified user
- print informations between dates, in which you are interested
- Delete records, which you choose. You can delete all records or records for particular date etc.
We are storing these informations about each login/logout event. And all these informations can be seen in admin interfaces:
- Username - Login of user who logged
- Session start - Time when HTTP session of particular user has been started
- Login - Time when user logged into portal
- Last click - Time when logged user made his last click
- Logout - Logout from portal. This can be same as Last click if user logged out with his browser. But sometimes user can be automatically logged out from portal because of session expiration. In this case Logout is time of session expiration.
Example: User logged into GateIn portal and he has doing some work during 5 minutes. Then he left his browser and he didn't made logout with his browser. It means that his logout time will be 35 minutes after his login time (assuming that standard time of session expiration is 30 minutes). So length of his session is 35 minutes (Time between login and logout) but his real time of work is only 5 minutes (Time between Login and Last click).
For administration, you can choose Administration Portlet (6.a) or JMX (6.b)
6.a) Administration portlet is deployed by default as part of extension. You can find it in Application registry under name UserTrackerAdminPortlet . You can look at screenshot userTrackerScreenshot.png where you can see how is portlet looking.
6.b) Use JMX for check the informations about logged user. You will need to look at MBean exo:name=userTrackerMonitor,portal="portal",service=UserTrackerMonitoringService . For example, you can try it with standard JBoss tool JMX console. Go to http://localhost:8080/jmx-console and look for this MBean.
You can send a mail to email@example.com with potential bugs or feature requests.