Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the iX crash reporter util framework

  • Loading branch information...
commit 4c8cfab941e6edd8a94cab809bcf25a6efcb2e59 1 parent 653c581
@kmoore134 kmoore134 authored
View
66 .gitignore
@@ -545,8 +545,74 @@ src-qt4/qsudo/i18n/qsudo_zh_TW.qm
src-qt4/qsudo/i18n/qsudo_zu.qm
src-qt4/qsudo/qsudo
src-qt4/qsudo/ui_mainwindow.h
+src-qt4/warden-gui/i18n/Warden_af.qm
+src-qt4/warden-gui/i18n/Warden_ar.qm
+src-qt4/warden-gui/i18n/Warden_az.qm
+src-qt4/warden-gui/i18n/Warden_bg.qm
+src-qt4/warden-gui/i18n/Warden_bn.qm
+src-qt4/warden-gui/i18n/Warden_bs.qm
+src-qt4/warden-gui/i18n/Warden_ca.qm
+src-qt4/warden-gui/i18n/Warden_cs.qm
+src-qt4/warden-gui/i18n/Warden_cy.qm
+src-qt4/warden-gui/i18n/Warden_da.qm
+src-qt4/warden-gui/i18n/Warden_de.qm
+src-qt4/warden-gui/i18n/Warden_el.qm
+src-qt4/warden-gui/i18n/Warden_en_GB.qm
+src-qt4/warden-gui/i18n/Warden_en_ZA.qm
+src-qt4/warden-gui/i18n/Warden_es.qm
+src-qt4/warden-gui/i18n/Warden_et.qm
+src-qt4/warden-gui/i18n/Warden_eu.qm
+src-qt4/warden-gui/i18n/Warden_fa.qm
+src-qt4/warden-gui/i18n/Warden_fi.qm
+src-qt4/warden-gui/i18n/Warden_fr.qm
+src-qt4/warden-gui/i18n/Warden_fr_CA.qm
+src-qt4/warden-gui/i18n/Warden_fur.qm
+src-qt4/warden-gui/i18n/Warden_gl.qm
+src-qt4/warden-gui/i18n/Warden_he.qm
+src-qt4/warden-gui/i18n/Warden_hi.qm
+src-qt4/warden-gui/i18n/Warden_hr.qm
+src-qt4/warden-gui/i18n/Warden_hu.qm
+src-qt4/warden-gui/i18n/Warden_id.qm
+src-qt4/warden-gui/i18n/Warden_is.qm
+src-qt4/warden-gui/i18n/Warden_it.qm
+src-qt4/warden-gui/i18n/Warden_ja.qm
+src-qt4/warden-gui/i18n/Warden_ka.qm
+src-qt4/warden-gui/i18n/Warden_ko.qm
+src-qt4/warden-gui/i18n/Warden_lt.qm
+src-qt4/warden-gui/i18n/Warden_lv.qm
+src-qt4/warden-gui/i18n/Warden_mk.qm
+src-qt4/warden-gui/i18n/Warden_mn.qm
+src-qt4/warden-gui/i18n/Warden_ms.qm
+src-qt4/warden-gui/i18n/Warden_mt.qm
+src-qt4/warden-gui/i18n/Warden_nb.qm
+src-qt4/warden-gui/i18n/Warden_ne.qm
+src-qt4/warden-gui/i18n/Warden_nl.qm
+src-qt4/warden-gui/i18n/Warden_pa.qm
+src-qt4/warden-gui/i18n/Warden_pl.qm
+src-qt4/warden-gui/i18n/Warden_pt.qm
+src-qt4/warden-gui/i18n/Warden_pt_BR.qm
+src-qt4/warden-gui/i18n/Warden_ro.qm
+src-qt4/warden-gui/i18n/Warden_ru.qm
+src-qt4/warden-gui/i18n/Warden_sa.qm
+src-qt4/warden-gui/i18n/Warden_sk.qm
+src-qt4/warden-gui/i18n/Warden_sl.qm
+src-qt4/warden-gui/i18n/Warden_sr.qm
+src-qt4/warden-gui/i18n/Warden_sv.qm
+src-qt4/warden-gui/i18n/Warden_sw.qm
+src-qt4/warden-gui/i18n/Warden_ta.qm
+src-qt4/warden-gui/i18n/Warden_tg.qm
+src-qt4/warden-gui/i18n/Warden_th.qm
+src-qt4/warden-gui/i18n/Warden_tr.qm
+src-qt4/warden-gui/i18n/Warden_uk.qm
+src-qt4/warden-gui/i18n/Warden_uz.qm
+src-qt4/warden-gui/i18n/Warden_vi.qm
+src-qt4/warden-gui/i18n/Warden_zh_CN.qm
+src-qt4/warden-gui/i18n/Warden_zh_HK.qm
+src-qt4/warden-gui/i18n/Warden_zh_TW.qm
+src-qt4/warden-gui/i18n/Warden_zu.qm
# Compiled binaries
+src-qt4/pc-usermanager/pc-usermanager
src-qt4/warden-gui/warden-gui
src-qt4/pc-bugreport/pc-bugreport
src-qt4/pc-pkgmanager/pc-pkgmanager
View
25 src-sh/pc-extractoverlay/ports-overlay/usr/local/bin/crashuploader
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import requests
+import sys
+import os
+
+if len(sys.argv) < 2:
+ print "Usage: %s file" % sys.argv[0]
+ sys.exit(1)
+
+url = 'http://ext-data.ixsystems.com/uploader/list/'
+files = {'docfile': open(sys.argv[1], 'rb')}
+
+data = None
+if os.path.isfile("/etc/hostid"):
+ f = open("/etc/hostid")
+ hostid = f.read().strip()
+ f.close()
+ data = { 'hostid': hostid }
+
+r = requests.post(url, data=data, files=files)
+#if r.status_code != 200:
+# print "Bad upload, status code: %s" % r.status_code
+# print "Response data:"
+# print r.text
View
119 src-sh/pc-extractoverlay/ports-overlay/usr/local/bin/ixdiagnose
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+#
+# Script to capture debug for system crash reporting.
+#
+#
+
+mydir=`dirname $0`
+
+# there is a dumpfile in /var/crash
+# sets "$actualdump" -> to $dumpdir/textdump.tar.N
+dumpfile_to_submit_exists ()
+{
+ local dumpdir=$1
+
+ # no crashdump at all
+ if [ ! -e $dumpdir/textdump.tar.last ] ; then
+ return 1
+ fi
+ actualdump=$(realpath $dumpdir/textdump.tar.last)
+ if [ $? -gt 0 ] ; then
+ echo "can not realpath $dumpdir/textdump.tar.last" >&2
+ return 2
+ fi
+
+ # dump already submitted
+ if [ -e "$actualdump.submitted" ] ; then
+ return 1
+ fi
+ return 0
+}
+
+test -e /etc/rc.conf && . /etc/rc.conf
+[ "$dumpdir" = "" ] && dumpdir="$dumpdir"
+
+boot_time=false
+force_upload=false
+has_ticket_info=false
+
+while getopts "bFt:" opt ; do
+ case "${opt}" in
+ b)
+ boot_time=true
+ ;;
+ F) force_upload=true
+ ;;
+ t) has_ticket_info=true
+ ticket_info=$OPTARG
+ ;;
+ \?) exit 2
+ ;;
+ esac
+done
+
+if [ -t 1 ] && ! $boot_time && ! $force_upload ; then
+ cat <<END_TEXT
+Welcome to ixdiagnose.
+
+ixdiagnos sends iXsystems the debugging information of your
+computer. In this mode we will send your logs and the
+contents of your diagnostics to iXsystems.
+
+Press 'Enter' to continue or ^C (control+C) to abort.
+END_TEXT
+ read dummy
+fi
+
+# during boot ix-diagnose will call us with --boot
+# if there is no crashdump, then just exit
+if $boot_time ; then
+ if ! dumpfile_to_submit_exists $dumpdir ; then
+ exit 0
+ fi
+fi
+
+set -x
+topdir=`mktemp -d -t ixdiagnose`
+if [ $? -gt 0 ] ; then
+ echo "can't make temp directory"
+ exit 1
+fi
+trap "rm -rf $topdir" EXIT
+dir=$topdir/ixdiagnose
+
+set -e
+mkdir $dir
+
+if ! $boot_time ; then
+ $mydir/freenas-debug -A > $dir/nas-debug.log
+ tar -cHf - -C /var log | tar -C $dir -xf -
+fi
+
+if ! dumpfile_to_submit_exists $dumpdir ; then
+ if [ $? = 2 ] ; then
+ exit 2
+ fi
+else
+ cp $dumpdir/textdump.tar.last "$dir"
+ cp $dumpdir/info.last "$dir"
+fi
+
+if $has_ticket_info ; then
+ TICKET_ARG="-t $ticket_info"
+ cp $ticket_info "$dir/ticket_info.json"
+fi
+
+if [ -f /etc/hostid ] ; then
+ cp /etc/hostid "$dir/hostid"
+fi
+
+if [ -f /usr/local/etc/registration ] ; then
+ cp /usr/local/etc/registration "$dir/registration.json"
+fi
+
+tar -C $dir/.. -cHzf $dir/../ixdiagnose.tgz ixdiagnose
+$mydir/crashuploader $topdir/ixdiagnose.tgz
+if [ "$actualdump" != "" ] ; then
+ touch $actualdump.submitted
+fi
View
61 src-sh/pc-extractoverlay/ports-overlay/usr/local/etc/rc.d/ix_diagnose
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ix_diagnose
+# REQUIRE: NETWORKING FILESYSTEMS
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="ix_diagnose"
+rcvar="ix_diagnose_enable"
+start_cmd="ix_diagnose_start"
+stop_cmd="ix_diagnose_stop"
+
+ix_diagnose_start()
+{
+ local _pidfile
+ local _seconds
+
+ # add /usr/local/bin for python..
+ PATH="$PATH:/usr/local/bin:/usr/local/sbin"
+ export PATH
+ _pidfile=`mktemp -t ix_diagnose`
+ (
+ sh -x /usr/local/bin/ixdiagnose -b \
+ > /tmp/ixdiagnose_boot.log 2>&1 &
+ pid=$!
+ echo $pid > $_pidfile;
+ wait
+ rm $_pidfile
+ ) &
+
+ _seconds=5
+
+ echo -n "Waiting up to $_seconds seconds for ixdiagnose to finish..."
+ (
+ while [ $_seconds -gt 0 ] ; do
+ for i in 1 2 3 4 5 6 7 8 9 0 ; do
+ if [ ! -e "$_pidfile" ] ; then
+ echo " done."
+ exit 1
+ fi
+ sleep 0.1
+ done
+ echo -n " $_seconds"
+ _seconds=$(($_seconds - 1))
+ done
+ echo ". timed out. Will proceed in the background."
+ )
+}
+
+ix_diagnose_stop()
+{
+ # nothing
+}
+
+load_rc_config $name
+run_rc_command "$1"
+
View
45 src-sh/pc-extractoverlay/ports-overlay/usr/local/etc/rc.d/ix_textdump
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ix_textdump
+# BEFORE: savecore
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="ix_textdump"
+rcvar="ix_textdump_enable"
+start_cmd="ix_textdump_start"
+stop_cmd="ix_textdump_stop"
+
+
+ix_textdump_start()
+{
+
+ if [ -z "${dumpdev}" ] ; then
+ debug "dumpdev not set exiting"
+ return 1
+ fi
+ # watchdog 38 = ~256 seconds or ~4 minutes, see sys/watchdog.h for explanation
+ ddb script "kdb.enter.break=watchdog 38; textdump set; capture on"
+ ddb script "kdb.enter.sysctl=watchdog 38; textdump set; capture on"
+ ddb script "kdb.enter.default=watchdog 38; textdump set; capture on; show allpcpu; bt; ps; alltrace; textdump dump; reset"
+ sysctl debug.ddb.textdump.pending=1
+ sysctl debug.debugger_on_panic=1
+ mkdir -p "/data/crash"
+}
+
+ix_textdump_stop()
+{
+
+ # We don't undo start_textdump() so that we can catch crashes at shutdown.
+ # XXX: undo 'sysctl debug.debugger_on_panic=1' ?
+ #sysctl debug.debugger_on_panic=0
+ #ddb unscript "kdb.enter.panic"
+}
+
+load_rc_config $name
+run_rc_command "$1"
+
Please sign in to comment.
Something went wrong with that request. Please try again.