************************ ' Author: Keith Rogers * ' Version 1.1 * ************************ Description: The 'check_expiry.sh' script will check to see when the root password is due to expire and calculate the remaining days before expiry. Usage: Place the check_expiry.sh script in your Nagios plugins directory, e.g. /usr/lib64/nagios/plugins Add the following line into your NRPE config: "command[check_expiry]=/usr/lib64/nagios/plugins/check_expiry.sh " Create service definition in Nagios: define service{ use generic-service host_name service_description Check Password Expiry for root check_command check_nrpe!check_expiry } Testing: To test, simply paste the following lines into the script after the 'let DAYS' line echo Expiry date from lchage is $get_expiry_date echo Password expiry date in British date format is `date -d "$get_expiry_date" +"%d/%m/%Y"` echo Password expiry date in epoch time is $password_expiry_date echo The current date in British date format is `date +"%d/%m/%Y"` echo The current date in epoch time is $current_date echo The difference in days between the date output from lchage and the current date is $DAYS days Changelog: Version 1.1 (13/02/2014) Added functionality to specify user as argument. Also added ability to detect output of 'Never' from lchage and exit with OK status. Version 1.0 (10/02/2014) Initial release, basic functionality.