Page 1 of 1

Monitoring age of active user sessions

Posted: Mon Jan 27, 2020 5:13 am
by Luminary
Hi all,

I'm a bit of a novice with nagios and I'm having trouble with checking the amount of time that users have been logged into a Linux server. is there any way to have nagios poll this information?

For example, I want to be alerted if a user has been logged in for more than 5 hours. Have any of you had any experience with monitoring this or something similar?

Thanks in advance.

Re: Monitoring age of active user sessions

Posted: Tue Jan 28, 2020 6:24 pm
by Box293
I've looked in the Nagios Exchange and I could not find any plugins that give you what you want, hence you are going to have to write your own plugin or alter the existing one

I looked at the existing check_users plugin and it seems that it uses the who command to determine information about users.

You may want to look at the who command and it's output and see if you can determine how long a user has been logged in for. If that doesn't provide the information then you'll need to find some command that will give you that information. Once you have that information then you can write a plugin to do what you need.

Sorry it's not a straight forward answer but all the plugins that exist out there are simply the result of a scenario like this.