how do i monitor Linux User Account Status

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
harsha.s.aryan
Posts: 52
Joined: Fri Nov 13, 2015 9:05 am

how do i monitor Linux User Account Status

Post by harsha.s.aryan »

hi All,

is there any Way to monitor Linux Users status (Locked/Active, password Exp Etc,.) details using nagios

Regards,
Aryan
Regards,
Harsha
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: how do i monitor Linux User Account Status

Post by hsmith »

Former Nagios Employee.
me.
harsha.s.aryan
Posts: 52
Joined: Fri Nov 13, 2015 9:05 am

Re: how do i monitor Linux User Account Status

Post by harsha.s.aryan »

Hi That plugin is really awesome but i am not getting which user is critical

Output is pasting below, please let me know if i have to do any changes.

./check_passwd_expiration
PASSWD_EXPIRATION CRITICAL - , Excluded account(s): [none]

i am not getting the user names which are expired
Regards,
Harsha
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: how do i monitor Linux User Account Status

Post by lmiltchev »

Did you add the following lines to sudoers?

Code: Select all

User_Alias NAGIOS = nagios
NAGIOS ALL = NOPASSWD: /usr/bin/chage -l *
Defaults:NAGIOS !requiretty
Run the following command and show the output:

Code: Select all

chage -l <user with expiring password>
The plugin seems to be working fine for me.

Code: Select all

[root@192 libexec]# chage -l tom
Last password change                                    : Jun 09, 2016
Password expires                                        : Jun 10, 2016
Password inactive                                       : never
Account expires                                         : Jun 10, 2016
Minimum number of days between password change          : 0
Maximum number of days between password change          : 1
Number of days of warning before password expires       : 7

Code: Select all

[root@192 libexec]# ./check_passwod_expiration
PASSWOD_EXPIRATION CRITICAL - Exp < 4j:[tom], Excluded account(s): [none]
The username (tom) is shown.
Be sure to check out our Knowledgebase for helpful articles and solutions!
harsha.s.aryan
Posts: 52
Joined: Fri Nov 13, 2015 9:05 am

Re: how do i monitor Linux User Account Status

Post by harsha.s.aryan »

Hi,

Please find the output below

i am using Ubuntu 14.04.3

Code: Select all

root@Nagios:/home/harshas# chage -l harsha
Last password change                                    : password must be changed
Password expires                                        : password must be changed
Password inactive                                       : password must be changed
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
root@Nagios:/home/harshas# ./check_passwd_expiration
PASSWD_EXPIRATION CRITICAL - , Excluded account(s): [none]
root@Nagios:/home/harshas#
Regards,
Harsha
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: how do i monitor Linux User Account Status

Post by lmiltchev »

You have:
Account expires : never
What happens if you set your user to expire (for example) in a week?

Code: Select all

chage -E "2016-06-16" harsha
Test the plugin again:

Code: Select all

./check_passwd_expiration
Be sure to check out our Knowledgebase for helpful articles and solutions!
harsha.s.aryan
Posts: 52
Joined: Fri Nov 13, 2015 9:05 am

Re: how do i monitor Linux User Account Status

Post by harsha.s.aryan »

Getting same output
Regards,
Harsha
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how do i monitor Linux User Account Status

Post by rkennedy »

Can you show us the full output of this? chage -l harsha
Former Nagios Employee
harsha.s.aryan
Posts: 52
Joined: Fri Nov 13, 2015 9:05 am

Re: how do i monitor Linux User Account Status

Post by harsha.s.aryan »

Please find the output below

Code: Select all

root@Nagios:~# chage -l harsha
Last password change                                    : password must be changed
Password expires                                        : password must be changed
Password inactive                                       : password must be changed
Account expires                                         : Jun 16, 2016
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
Regards,
Harsha
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: how do i monitor Linux User Account Status

Post by lmiltchev »

Last password change : password must be changed
Password expires : password must be changed
Password inactive : password must be changed
Ask the user to log in and change the password. In comparison, I have:
Last password change : Jun 09, 2016
Password expires : Jun 10, 2016
Password inactive : never
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked