Hi,
After a lot of attempts to read the expiration date of user passwords with a local check via bash, I wrote a Python script.
If the password expires in less than 30 days, WARN. In less than 15 days KRIT. Anything over 30 days should be OK.
Not all users should be checked, but only certain users that I have previously defined in the script.
This now also works wonderfully on the console, provided I execute it directly:
root@backup:/usr/lib/check_mk_agent/local# ./check_user_exp.py
1 user_expire_test - WARN: Password expires in 16 days
0 user_expire_backup_user_000 - OK: Password never expires
In the CheckMK GUI, however, everything is displayed as green / OK, which is incorrect.
The command “check_mk_agent -ll” shows that the return value is always 0, i.e. everything is OK:
0 user_expire_test - OK: Password never expires
0 user_expire_backup_user_000 - OK: Password never expires
Command executed with the last 15 lines as output:
I’am using Python3. Is the Agent executed the local check with another Python version as I do it when I execute it on the commandline by myself?
Why is there a delta?
BTW: I dont know if there a built-in check for that. I’am using the RAW edition.
I want to paly a bit arround anyway