As alluded to by Ben, this is exposed via JMX.
The TotalActiveUsers attribute of the com.ptc -> Monitors -> ActiveUsers MBean provides what you're looking for.
And I'd note that the implementation of the server status page is entirely in the JSP itself, so you can see how it does things as needed.