Using new DB table - Trying to get Session data

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Using new DB table - Trying to get Session data

Post 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
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using new DB table - Trying to get Session data

Post by scottwilkerson »

session_user_id maps to user_id in xi_users
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: Using new DB table - Trying to get Session data

Post 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
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using new DB table - Trying to get Session data

Post by scottwilkerson »

Steve,

Unfortunately this is not logged anywhere other than the httpd log, and that would not contain the logged in user.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked