Graphite events not working

Asked by Franklin Angulo

I'm trying to post events to Graphite using curl but I get the following error message. I'd appreciate some help.

curl -X POST http://localhost/events/ -d '{"what": "Event through curl", "tags": "curl"}'

<body style="background-color: #666666; color: black;">
<center>
<h2 style='font-family: "Arial"'>
<p>Graphite encountered an unexpected error while handling your request.</p>
<p>Please contact your site administrator if the problem persists.</p>
</h2>
<br/>
<div style="width: 50%; text-align: center; font-family: monospace; background-color: black; font-weight: bold; color: #ff4422;">

</div>

<div style="width: 70%; text-align: left; background-color: black; color: #44ff22; border: thin solid gray;">
<pre>
Traceback (most recent call last):
  File &quot;/usr/lib/python2.6/site-packages/django/core/handlers/base.py&quot;, line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File &quot;/opt/graphite/webapp/graphite/events/views.py&quot;, line 32, in view_events
    return post_event(request)
  File &quot;/opt/graphite/webapp/graphite/events/views.py&quot;, line 44, in post_event
    event = json.loads(request.raw_post_data)
AttributeError: &#39;WSGIRequest&#39; object has no attribute &#39;raw_post_data&#39;

</pre>
</div>

</center>

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
Franklin Angulo
Solved:
Last query:
Last reply:
Revision history for this message
Jason Dixon (jason-dixongroup) said :
#1

Looks like you're running a newer version of Django that breaks compatibility with HttpRequest#raw_post_data. You'll either need to downgrade to 1.4 or patch events/views.py to use HttpRequest#body instead.

e.g. Line 44 should read:

event = json.loads(request.body)

Revision history for this message
Jason Dixon (jason-dixongroup) said :
#2
Revision history for this message
Franklin Angulo (feangulo) said :
#3

Worked like a charm - thanks for the insight!