Skip to content

Instantly share code, notes, and snippets.

@awesome
Forked from barroco/raven-shell
Created November 9, 2023 18:36
Show Gist options
  • Save awesome/d6c24bcab1b47105ebd9c6ece40f1a25 to your computer and use it in GitHub Desktop.
Save awesome/d6c24bcab1b47105ebd9c6ece40f1a25 to your computer and use it in GitHub Desktop.

Revisions

  1. Michael Barroco revised this gist Jun 14, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions raven-shell
    Original file line number Diff line number Diff line change
    @@ -38,5 +38,6 @@ curl --data "{

    }

    # Example:
    capture_error "Unable to execute the command"
    exit 1
  2. Michael Barroco created this gist Jun 14, 2015.
    42 changes: 42 additions & 0 deletions raven-shell
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    #!/bin/sh

    SENTRY_KEY=
    SENTRY_SECRET=
    SENTRY_PROJECTID=1
    SENTRY_HOST=sentry.example.com

    SCRIPT_ARGUMENTS=$@
    capture_error()
    {

    MESSAGE=$1
    EVENT_ID=`openssl rand -hex 32`
    EVENT_TIMESTAMP=`date +"%Y-%m-%dT%H:%M:%S"`
    SENTRY_TIMESTAMP=`date +%s`

    curl --data "{
    \"event_id\": \"$EVENT_ID\",
    \"culprit\": \"$0\",
    \"timestamp\": \"$EVENT_TIMESTAMP\",
    \"message\": \"$MESSAGE\",
    \"tags\": {
    \"shell\": \"$SHELL\",
    \"server_name\": \"`hostname`\",
    \"path\": \"`pwd`\"
    },
    \"exception\": [{
    \"type\": \"ScriptError\",
    \"value\": \"$MESSAGE\",
    \"module\": \"__builtins__\"
    }],
    \"extra\": {
    \"sys.argv\": \"$SCRIPT_ARGUMENTS\"
    }
    }" -H "Content-Type: application/json" -H "X-Sentry-Auth: Sentry sentry_version=5, sentry_timestamp=$SENTRY_TIMESTAMP,
    sentry_key=$SENTRY_KEY, sentry_client=raven-bash/0.1,
    sentry_secret=$SENTRY_SECRET" http://$SENTRY_KEY:$SENTRY_SECRET@$SENTRY_HOST/api/$SENTRY_PROJECTID/store/

    }

    capture_error "Unable to execute the command"
    exit 1