Project

General

Profile

Docs ModUserOnline » History » Revision 11

Revision 10 (Anonymous, 2006-09-07 23:37) → Revision 11/35 (Anonymous, 2006-09-07 23:38)

{{{ 
 #!rst 
 ========== 
 UserOnline 
 ========== 

 ---------------------- 
 Module: mod_useronline 
 ---------------------- 

 .. meta:: 
   :keywords: lighttpd, online user, tracking, unique ips 
  
 .. contents:: Table of Contents 


 Description 
 ----------- 
 Module that tracks users online/active by unique ips (no cookies), includes counting hits, and linking into mod_status (http://trac.lighttpd.net/trac/wiki/Docs%3AModStatus#server-statistics). 


 Options 
 ------- 

 useronline.enable 

   enable or disable tracking for given area 

   Default: 0 [disabled] 

   Example: useronline.enable = 1  

 useronline.online_age 

   number of seconds till user/ip is no longer considered online 

   Default: 300 

   Example: useronline.online_age = 600 

 useronline.active_age 

   number of seconds till user/ip is no longer considered active (note: setting this higher than online_age will give you the same active count as online) 

   Default: useronline.online_age / 3 = 100 

   Example: useronline.active_age = 60 

 useronline.max_ips 

   max number of ips to track (note: if this limit is hit, the server will not track new users/ips) 

   Memory Usage: 16 * max_ips (on a 64bit system) 

   Default: 1024 

   Example: useronline.max_ips = 4096 

 useronline.status_name 

   name to associate to the variables shown in server-statistics (if not set, it will not report) 
 
   Default: unset 

   Example: useronline.status_name = "myWonderfulSite" 


 Output/Result 
 ------------- 

 When configured properly, you will notice a few new environment variables accessible to you. In PHP you can output the number of online users like so: 

   :: 

     <?php echo $_ENV['USERS_ONLINE'] ?> 



 Here is a current list of environment variables generated by this module: 


 users_online 

   number of online users (IPs that last hit >= online_age seconds ago) 

 users_active 

   number of active users (IPs that last hit >= min(online_age, active_age) seconds ago) 

 user_hits 

   number of hits seen by the current ip while being online/active 

 users_online_age 
  
   number of seconds that a user is still considered online (just reports the current setting) 

 users_active_age 

   number of seconds that a user is still considered active (just reports the current setting) 

 users_online_max_ips 

   max number of ips tracked (just reports the current setting) 

 users_online_id 

   site/conditional id, where the tracking data is located (may be used in the future to link) 


 Server Statistics  
 ----------------- 

 If useronline.status_name is set, the module will report to status counters that will be displayed in http://trac.lighttpd.net/trac/wiki/Docs%3AModStatus#server-statistics  

   Example: (using: useronline.status_name = "myWonderfulSite") 

   :: 

     useronline.myWonderfulSite.active_age: 100 
     useronline.myWonderfulSite.id: 9 
     useronline.myWonderfulSite.max_ips: 4096 
     useronline.myWonderfulSite.online_age: 300 
     useronline.myWonderfulSite.users_active: 110 
     useronline.myWonderfulSite.users_online: 296 

 The top 4 lines report settings, while the last 2 report the current counters.  

 You will notice an id number listed, this is the id where the data for that site/conditional is stored. It may be used in the future to link multiple sites/conditonals together to use the same counters, to make it easier to count online users across multiple domains. 


 Download 
 -------- 

 http://trac.lighttpd.net/trac/attachment/wiki/Docs/ModUserOnline/mod_useronline.c 

 }}}