Forum Moderators: phranque
open(FILE,"netstat -na ¦ grep ^tcp ¦ wc -l ¦");
while(<FILE>)
{
print "SYSTEM STATUS:<br>$_ users online";
}
close(FILE);
This will return the number of currently open sessions (that will include AOL users where they open numerous sessions to access images), but it's close enough!
Matt
netstat -na ¦ grep ^tcp
This shows the number of TCP connections active, it will not neccessarily correspond to a meaningful number of "site users" from the output. Depending on the system it will also include TCP connections to databases, proxy servers, SSH sessions etc.
You could parse the output to extract only HTTP sessions, possibly with a particular state (ESTABLISHED?), which might give a reasonable ballpark figure. Or it might not, depending on how you define "visitor" (e.g. the figure would include any bots).