check_users plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_users plugin

Post by tgriep »

I saw that you had issues changing to the nagios user account and it could be that it has a password assigned to it or that it is expired.
Login as root and run the following to remove the password and reset the account.

Code: Select all

passwd --delete nagios
chage -I -1 -m 0 -M 99999 -E -1 nagios
The nagios user account cannot have a password as the plugins need to run without it.

Then, while logged in as root on the remote server, run the following commands and post the output.

Code: Select all

chage -l nagios
grep nag /etc/passwd
grep nag /etc/group
ls -l /usr/local/nagios/libexec/check_users
uname -a
cat /etc/*release*
Thanks
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 »

avandemore wrote:What happens when run from the listener?

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -t 30 -c check_users -a '-w 5 -c 10'
Can you attach the full nrpe.cfg?
Hi avandemore,

I don't know what you mean by listener?
I ran this on Nagios XI server and I post it.
You do not have the required permissions to view the files attached to this post.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_users plugin

Post by dwhitfield »

On the remote server, what is the output of the following:

Code: Select all

chage -l nagios
grep nag /etc/passwd
grep nag /etc/group
ls -l /usr/local/nagios/libexec/check_users
uname -a
cat /etc/*release*
ctretelea
Posts: 59
Joined: Fri Feb 17, 2017 5:43 pm

Re: check_users plugin

Post by ctretelea »

dwhitfield wrote:On the remote server, what is the output of the following:

Code: Select all

chage -l nagios
grep nag /etc/passwd
grep nag /etc/group
ls -l /usr/local/nagios/libexec/check_users
uname -a
cat /etc/*release*
Hi dwhitfield,

Code: Select all

[root@lxelkapp] 10:50 # chage -l nagios
Last password change                                    : Aug 04, 2014
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : -1
Maximum number of days between password change          : -1
Number of days of warning before password expires       : -1
[root@lxelkapp] 10:50 # grep nag /etc/passwd
nagios:x:496:491::/var/spool/nagios:/sbin/nologin
[root@lxelkapp] 10:50 # grep nag /etc/group
nagios:x:491:nagios
nagcmd:x:10668:nagios
[root@lxelkapp] 10:50 # ls -l /usr/local/nagios/libexec/check_users
-rwxr-xr-x 1 root nagios 136185 May 30 08:12 /usr/local/nagios/libexec/check_users
[root@lxelkapp] 10:50 # uname -a
Linux lxelkapp.tecsys.us 2.6.32-431.23.3.el6.x86_64 #1 SMP Wed Jul 16 06:12:23 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@lxelkapp] 10:50 # cat /etc/*release*
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
cat: /etc/lsb-release.d: Is a directory
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Red Hat Enterprise Linux Server release 6.5 (Santiago)
cpe:/o:redhat:enterprise_linux:6server:ga:server
[root@lxelkapp] 10:51 #
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_users plugin

Post by tgriep »

Edit the /etc/passwd file on the remote server and change this line from

Code: Select all

nagios:x:496:491::/var/spool/nagios:/sbin/nologin
to

Code: Select all

nagios:x:496:491::/var/spool/nagios:/bin/bash
Save the file and see if the check_users plugin functions.
This will give the nagios user account back the ability to login and run the plugins on the server.
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:Edit the /etc/passwd file on the remote server and change this line from

Code: Select all

nagios:x:496:491::/var/spool/nagios:/sbin/nologin
to

Code: Select all

nagios:x:496:491::/var/spool/nagios:/bin/bash
Save the file and see if the check_users plugin functions.
This will give the nagios user account back the ability to login and run the plugins on the server.
That doesn't help:

Code: Select all

[root@lxelkapp] 06:03 # usermod -s /bin/bash nagios
[root@lxelkapp] 06:04 # su - nagios
-bash-4.1$ /usr/local/nagios/libexec/check_users


Usage:
check_users -w <users> -c <users>
-bash-4.1$ /usr/local/nagios/libexec/check_users -w 5 -c 10
USERS CRITICAL - 251 users currently logged in |users=251;5;10;0
-bash-4.1$ who
user1 pts/0        2017-06-06 05:05 (192.168.10.155)
user pts/2        2017-06-06 06:03 (10.237.60.113)
user2 pts/7        2017-05-12 10:36 (192.168.10.162)
root     hpsa         2016-12-20 03:19 (HP Server Automation)
user1 pts/3        2017-06-05 06:12 (192.168.60.249)
-bash-4.1$
who command and check_user plugin have different results.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_users plugin

Post by tgriep »

Try and upgrade the plugins in the remote server by following this KB article and see if that resolves the issue for you.
https://support.nagios.com/kb/article/n ... ource.html
Let us know if it works for you.
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:Try and upgrade the plugins in the remote server by following this KB article and see if that resolves the issue for you.
https://support.nagios.com/kb/article/n ... ource.html
Let us know if it works for you.
I installed the plugins manually as was described in article, but the issue steel.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: check_users plugin

Post by avandemore »

Code: Select all

# su - nagios
$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -t 30 -c check_users -a '-w 5 -c 10'
Please run this from the listener eg the place NRPE daemon is listening eg the place where you installed NRPE.

What is the output of:

Code: Select all

# ls -la /usr/local/nagios/etc/nrpe
Please change the value debug=0 to debug=1 in nrpe.cfg and restart it, then send an updated /var/log/messages after the check_nrpe test was run again.
Previous Nagios employee
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_users plugin

Post by tgriep »

I was hoping that would fix it.
The check_users command does the same functionality as the users command and not the who command.
Can you login to that server, run the following and post the output?

Code: Select all

su nagios
users
echo $?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked