Page 3 of 3

Re: check_users plugin

Posted: Wed Jul 12, 2017 10:57 pm
by gsl_ops_practice
Hi, I am experiencing same issue in RH Linux 6.8.
the current users logged in via w or who command is 5 users.
But the uptime, top command shows 27 users
check_users nagios plugin is using uptime o/p.
Can you please shed some light where from uptime or top is taking these high number of users active ?
Should we use https://exchange.nagios.org/directory/P ... sh/details check_users.sh instead ?

$ /usr/local/nagios/libexec/check_users -help
check_users v2.2.1 (nagios-plugins 2.2.1)
Copyright (c) 1999 Ethan Galstad
Copyright (c) 2000-2014 Nagios Plugin Development Team
<[email protected]>

This plugin checks the number of users currently logged in on the local
system and generates an error if the number exceeds the thresholds specified.


Usage:
check_users -w <users> -c <users>

Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
--extra-opts=[section][@file]
Read options from an ini file. See
https://www.nagios-plugins.org/doc/extra-opts.html
for usage and examples.
-w, --warning=INTEGER
Set WARNING status if more than INTEGER users are logged in
-c, --critical=INTEGER
Set CRITICAL status if more than INTEGER users are logged in

Send email to [email protected] if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
[email protected]


$ /usr/local/nagios/libexec/check_users --version
check_users v2.2.1 (nagios-plugins 2.2.1)

$ /usr/local/nagios/libexec/check_users -w 5 -c 10
USERS CRITICAL - 27 users currently logged in |users=27;5;10;0
$

$ who -u | wc -l
5

$ uptime
03:46:20 up 72 days, 13:18, 27 users, load average: 1.64, 1.76, 1.80
$

$ top
top - 03:49:15 up 72 days, 13:21, 27 users, load average: 1.36, 1.58, 1.72

$ id nagios
id: nagios: No such user
$

Re: check_users plugin

Posted: Thu Jul 13, 2017 11:24 am
by tgriep
I searched the web and found a possible fix for the wrong number of users on the system.
/var/run/utmp can sometimes get corrupt and incorrectly report the number of users that are logged in to the system.
If you do a

Code: Select all

sudo tee /var/run/utmp < /dev/null
it will get reset.
It is not needed to be single-user but it is advisable: logged in users might see some weird results when they try to view users until they log out.

Re: check_users plugin

Posted: Tue Jul 25, 2017 2:40 pm
by ctretelea
tgriep wrote:I searched the web and found a possible fix for the wrong number of users on the system.
/var/run/utmp can sometimes get corrupt and incorrectly report the number of users that are logged in to the system.
If you do a

Code: Select all

sudo tee /var/run/utmp < /dev/null
it will get reset.
It is not needed to be single-user but it is advisable: logged in users might see some weird results when they try to view users until they log out.

This works.

Thank you.

Re: check_users plugin

Posted: Tue Jul 25, 2017 4:32 pm
by bolson
May we go ahead and close this topic?

Re: check_users plugin

Posted: Wed Aug 02, 2017 8:49 am
by gsl_ops_practice
Thank you, this appears to work as well on the host where we had the incorrect information being displayed. We can now use this as a fix on any other hosts in the future.
tgriep wrote:I searched the web and found a possible fix for the wrong number of users on the system.
/var/run/utmp can sometimes get corrupt and incorrectly report the number of users that are logged in to the system.
If you do a

Code: Select all

sudo tee /var/run/utmp < /dev/null
it will get reset.
It is not needed to be single-user but it is advisable: logged in users might see some weird results when they try to view users until they log out.

Re: check_users plugin

Posted: Wed Aug 02, 2017 9:44 am
by bolson
Closing topic as resolved.

Thank you for using the Nagios Support Forum.