A simple script to report core file to a central location.
I wanted to use abrt (https://github.com/abrt/abrt) on ubuntu 16.04 and got into too many trouble porting it.
This script will upload the corefile to S3 bucket and send slack message with a link to the corefile, and a stacktrace
ip install boto boto3 filechunkio slackclient
Setting this script as coredump handler:
- sudo sysctl -w kernel.core_pattern="|/path/to/handle_crash_reporting.py %h.core.%e.%t %s" 1.1 to make the change peristent between boots: echo kernel.core_pattern="|/path/to/handle_crash_reporting.py %h.core.%e.%t %s" >> /etc/sysctl.conf
- cp handle_crash_reporting.py /path/to/handle_crash_reporting.py && chmod a+x /path/to/handle_crash_reporting.py
- in Slack, create a channel for the reports 3.1 get a token and put it in the script
- in order to upload to Amazon S3, you need some sort of API token. Preferably set IAM role. (see aws docs)
On the target linux machine:
- reboot (to make sure the changes persist)
- sleep 1000 &
- kill -SEGV
pidof sleep
You should get a slack message in a few seconds. To debug, check /tmp/crash_handler.log