Use session table to monitor user logins?


I have had a request to be able to monitor the total number of “unique” and concurrent users logging into a particular system. There is an inactivity timer of 15 minutes for these accounts. I am considering using the session table and using the userid (which I can pull out of the XML calls)as the session key.

The first time we see the login we add the session key for that user. Each subsequent request we check to see if there is a matching entry in the session table if not we add the entry. When we see a specific log out we then remove the entry from the session table.

I have a couple of questions.

I want to be able to visualize this in three ways.

1.Histogram showing the number of users logged in concurrently over time
2.Average number of users logged in during the time period
3.Maximum number of users logged in during the time period

I was initially thinking of setting the session expire time to be 15 minutes BUT if I want to see a histogram I am thinking I need to set this to a smaller number to get more granular recording of the metric? Am I correct in this thought?

As far as visualizing I can use a standard dashboard to choose how I want to display the metrics. Is there anything specific I need to do with the trigger to create the metrics for a device or would it be easier to create a network or application based metric?


We have specific datatype metrics for these kinds of analytics. Specifically:

1). Histogram showing the number of users currently logged in: SNAP
2). Average number of users logged in during the time period: Dataset / Sampleset
3). Maximum number of users logged in during the time period: Dataset / Max

Now, to identify which object to tie the metric to? Device, Network, or Application. This is a difficult question because it “depends”. If you already have an application container created (or want one), this would probably be the most likely. For others, it is intuitive. “Where do I get my application metrics? Oh, wait, in ‘Applications’”

Of course, there is nothing wrong to tie it to a specific device if you want to see how each system is performing, and roll it up to a network object to see how all systems are performing. Many do this. But, it’s my opinion that application-level metrics should go to an application container for better navigation and understanding. There is no “wrong” way, but you decide if there is a “better” way.

Each time you see a login, you can count by 1.

Application("My App").metricAddCount("My App User Logins",1);

If you would also like to track how many times a specific user logs in:

Application("My App").metricAddDetailCount("My App User Logins by User", username, 1);

Since a dataset can do average, max, and percentiles, this is usually my go-to metric. However, it does take more storage to do so. On heavier-loaded systems, if all you need is the average, you can use a more “lossy” datatype of SampleSet.

Application("My App").metricAddDataset("My App User Logins", 1);