Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created November 10, 2020 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/319b76533c9732f627dba13da9fa35ec to your computer and use it in GitHub Desktop.
Save rtrouton/319b76533c9732f627dba13da9fa35ec to your computer and use it in GitHub Desktop.
Jamf Pro Extension Attribute which is designed to report on kernel panics which occurred in the last seven days.
#!/bin/bash
# Detects kernel panics which occurred in the last seven days.
#
# Original idea and script from here:
# https://www.jamf.com/jamf-nation/discussions/23976/kernal-panic-reporting#responseChild145035
#
# This Jamf Pro Extension Attribute is designed to
# check the contents of /Library/Logs/DiagnosticReports
# and report on how many log files with the file suffix
# of ".panic" were created in the previous seven days.
PanicLogCount=$(/usr/bin/find /Library/Logs/DiagnosticReports -Btime -7 -name *.panic | grep . -c)
echo "<result>$PanicLogCount</result>"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment