check_users plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
gsl_ops_practice
Posts: 151
Joined: Thu Apr 09, 2015 9:14 pm

Re: check_users plugin

Post 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
$
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_users plugin

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ctretelea
Posts: 59
Joined: Fri Feb 17, 2017 5:43 pm

Re: check_users plugin

Post 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.
bolson

Re: check_users plugin

Post by bolson »

May we go ahead and close this topic?
gsl_ops_practice
Posts: 151
Joined: Thu Apr 09, 2015 9:14 pm

Re: check_users plugin

Post 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.
bolson

Re: check_users plugin

Post by bolson »

Closing topic as resolved.

Thank you for using the Nagios Support Forum.
Locked