munkireport / mdm_status

2 stars 6 forks source link

mdm_status error #20

Closed miawri closed 4 weeks ago

miawri commented 10 months ago

I am seeing this error with the mdm_status module: -

mdm_status.py Error: Traceback (most recent call last):
File "/usr/local/munkireport/scripts/mdm_status.py", line 255, in
main()
File "/usr/local/munkireport/scripts/mdm_status.py", line 241, in main
result['last_mdm_kickstart'] = string_to_timestamp(watchdog_state[item])
File "/usr/local/munkireport/scripts/mdm_status.py", line 197, in string_to_timestamp
dt = dt_utc.replace(tzinfo=FixedOffset(tz))
File "/usr/local/munkireport/scripts/mdm_status.py", line 205, in __init__
offset = (int(hours) * 60 + int(minutes.replace(":",""))) * (-1 if sign == "-" else 1)
ValueError: invalid literal for int() with base 10: '38Z'

I am unsure when this error started to appear...it does seem to affect all OS versions though.

It seems the previous version of the module is also affected: -

mdm_status.py Error: Traceback (most recent call last):
File "/usr/local/munkireport/scripts/mdm_status.py", line 191, in
main()
File "/usr/local/munkireport/scripts/mdm_status.py", line 177, in main
result['last_mdm_kickstart'] = string_to_timestamp(watchdog_state[item])
File "/usr/local/munkireport/scripts/mdm_status.py", line 138, in string_to_timestamp
dt = dt_utc.replace(tzinfo=FixedOffset(tz))
File "/usr/local/munkireport/scripts/mdm_status.py", line 146, in __init__
offset = (int(hours) * 60 + int(minutes.replace(":",""))) * (-1 if sign == "-" else 1)
ValueError: invalid literal for int() with base 10: '13Z'
tuxudo commented 10 months ago

This should be resolved with v3.3 of the module.

miawri commented 9 months ago

The error has cleared from the MR run but I don't see the mdm watchdog entry in the web console anymore.

tuxudo commented 9 months ago

On the Mac that is no longer showing the MDM Watchdog entry, can you verify that the /usr/local/munkireport/scripts/cache/mdm_status.plist file contains an entry for last_mdm_kickstart?

miawri commented 9 months ago

It does not contain an entry for last_mdm_kickstart. /Library/Application Support/mdm-watchdog/state.json does contain an entry though.

tuxudo commented 9 months ago

One of the changes with v3.3 is that if there is an error when trying to process the date/time into a UNIX timestamp, it will silently ignore the error and pass, with nothing being written for the MDM watchdog date/time that caused the error. In this case, the error was caused by the last MDM kickstart and it was not written. This was chosen because I am not able to reproduce the original error