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

Re: how do i monitor Linux User Account Status

Post by harsha.s.aryan »

the issue is after running the nagios script i am not getting the user account which is having issue

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
root@Nagios:~# /home/harshas/check_passwd_expiration
PASSWD_EXPIRATION CRITICAL - , Excluded account(s): [none]
root@Nagios:~#
in this place
[/code]
(root@Nagios:~# /home/harshas/check_passwd_expiration
PASSWD_EXPIRATION CRITICAL - , Excluded account(s): [none])
[/code]
i was suppose to get PASSWD_EXPIRATION CRITICAL - harsha, Excluded account(s): [none]) where harsha account is 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 »

The script works as expected for me, however my "test" user (tom) has a password that expires today:
[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
You user's password must be changed - the chage output doesn't even show when user's password will expire...
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
root@Nagios:~# /home/harshas/check_passwd_expiration
PASSWD_EXPIRATION CRITICAL - , Excluded account(s): [none]
Most probably, this is the reason why the plugin doesn't show the user for you as it does it for me.

It is also possible that the plugin would show this (PASSWD_EXPIRATION CRITICAL -) if the user's password is ALREADY expired. Try resetting the password and see if this is going to help.

FYI, this is NOT one of our "official" plugins (it's a 3rd party plugin), so we are not familiar with it. We tested it in-house though, and it worked for us (for me and a co-worker).
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 »

i changed only issue is am not getting which user account is expired.

Code: Select all

root@Nagios:~# chage -d 1 harsha
root@Nagios:~# chage -l harsha
Last password change                                    : Jan 02, 1970
Password expires                                        : Mar 03, 1970
Password inactive                                       : Apr 02, 1970
Account expires                                         : Jun 16, 2016
Minimum number of days between password change          : 0
Maximum number of days between password change          : 60
Number of days of warning before password expires       : 14
root@Nagios:~# /home/harshas/check_passwd_expiration
PASSWD_EXPIRATION CRITICAL - , Excluded account(s): [none]
is there any way to get that user account in 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 »

Because the dates are set to the following -

Code: Select all

Last password change                                    : Jan 02, 1970
Password expires                                        : Mar 03, 1970
Password inactive                                       : Apr 02, 1970
The plugin does not know what to do. Can you try setting these to dates that are in the future, and try again?
Former Nagios Employee
Locked