determine which node a user is logged into?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2014 09:02 AM
I would like to be able to determine which node a user is logged into? I'm able to see logged in users (v_user_session) but if I understand correctly this list only contains user sessions on the node that I'm currently logged into. Is there a way to determine which node a user is logged into (which node they have an active session on)?
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2015 11:24 PM
Hi Brian,
Have you found something around this?
BR
Marc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 07:07 AM
I think a simple way to do this for an individual user is to query the syslog_transaction table. Here's a basic script that should suite your needs. You can add it to a Script Include and call it from a UI Action on the User table to provide a quick way to find a user's node. Just keep in mind that any given user can have multiple sessions open with different browsers -- so you might want to use the session field of the syslog_transaction table to account for this.
function findUserNode(userID) {
if (userID)
{
var logs = new GlideRecord('syslog_transaction');
logs.addQuery('sys_created_by', userID);
logs.addQuery('sys_created_on', '>', gs.minutesAgo(15)); // This is arbitrary
// You should add an order by here -- use sys_created_on
logs.setLimit(1);
logs.query();
if (logs.next()) // change to a loop if you want nodes for multiple sessions.
{
var node = logs.system_id.toString();
var num = node.indexOf(':');
var nodeName = node.substring(parseInt(num + 1), parseInt(node.length));
gs.addInfoMessage("User " + userID + " is currently logged into node: " + nodeName);
}
else
{
gs.addInfoMessage("User " + userID + "is not currently logged in");
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2015 01:01 PM
I'm working on something similar, and after thinking about it for awhile, we can get much more useful and relevant information using GlideAggregate instead:
function getSessionInfo(userID) {
if (userID)
{
var ga = new GlideAggregate('syslog_transaction');
ga.addQuery('sys_created_on', '>', gs.minutesAgo(15)); // again, this is arbitrary.
ga.addQuery('sys_created_by', userID);
ga.groupBy('session'); // This gives us relevant data for each session -- one user might have multiple sessions going.
ga.groupBy('system_id'); // Also grouping by node.
ga.addAggregate('AVG', 'network_time'); // Additional info, if you want it.
ga.addAggregate('AVG', 'response_time');
ga.query();
while (ga.next())
{
gs.print("Data for session ID: " + ga.session);
gs.print("User: " + userID);
gs.print("Node: " + ga.system_id);
var secs = (parseFloat(ga.getAggregate('AVG', 'response_time')))/1000;
gs.print("AVG Response Time: " + secs);
} // end while
} // end if
}
Something like this would work well in a UI action (infomessage), homepage widget or as its own UI Page/GlideDialogWindow.
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2018 10:01 AM
If your just looking to find what node a user is on you can check it 2 different ways.
1. Have the user type stats.do in the left nav. Then ask them for the cluster node name.
2. Under System Diagnostics > Active Transactions (All Nodes) add the user field to your list view and search for the user that way.
Nadia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 11:34 AM
