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
$
check_users plugin
Re: check_users plugin
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
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.
/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/nullIt 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_users plugin
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 ait will get reset.Code: Select all
sudo tee /var/run/utmp < /dev/null
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.
-
gsl_ops_practice
- Posts: 151
- Joined: Thu Apr 09, 2015 9:14 pm
Re: check_users plugin
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 ait will get reset.Code: Select all
sudo tee /var/run/utmp < /dev/null
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.
-
bolson
Re: check_users plugin
Closing topic as resolved.
Thank you for using the Nagios Support Forum.
Thank you for using the Nagios Support Forum.