Page 1 of 1
Using new DB table - Trying to get Session data
Posted: Mon Feb 04, 2019 5:43 pm
by SteveBeauchemin
I would like to get current session data from the xi_sessions table, and I can.
I am having a challenge tying it to a username.
Can someone please provide the correct SQL such that I can see username, session_page, IP address, and session_last_active.
I am trying to tie either the session_id or the session_user_id to some column in other tables so I can see the username.
Thanks
Steve B
Re: Using new DB table - Trying to get Session data
Posted: Mon Feb 04, 2019 5:54 pm
by scottwilkerson
session_user_id maps to user_id in xi_users
Re: Using new DB table - Trying to get Session data
Posted: Mon Feb 04, 2019 6:47 pm
by SteveBeauchemin
I am not seeing my own sessions when I try this.
I see 21 rows when I do this - 3 are not 0 in session_user_id
SELECT * FROM xi_sessions;
When I run this - I get the 3 non zero items listed. But I do not see my own activity.
Code: Select all
SELECT
xi_users.last_login,
xi_sessions.session_last_active,
xi_sessions.session_address,
xi_users.username,
xi_users.name,
xi_sessions.session_page
FROM xi_sessions, xi_users
where xi_users.user_id = xi_sessions.session_user_id
order by xi_sessions.session_last_active desc;
Maybe I don't understand what a session is?
I'm just trying to see current activity in the Nagios XI tool. Is there a different path I should take? I like to see who is using Nagios, and what they are clicking on. I have hopes for this new table to help me stay on top of the tool and make sure it is working properly. This could help me see what they are trying to run that they need help with.
Any advice would be appreciated.
This gives more data - but NULL in some columns.
Code: Select all
SELECT
xi_users.last_login,
xi_sessions.session_last_active,
xi_sessions.session_address,
xi_sessions.session_user_id,
xi_users.username,
xi_users.name,
xi_sessions.session_page
FROM xi_sessions
LEFT JOIN xi_users
ON xi_users.user_id = xi_sessions.session_user_id
order by xi_sessions.session_last_active desc;
Thanks
Steve B
Re: Using new DB table - Trying to get Session data
Posted: Tue Feb 05, 2019 7:42 am
by scottwilkerson
Steve,
Unfortunately this is not logged anywhere other than the httpd log, and that would not contain the logged in user.