OverflowError: MongoDB can only handle up to 8-byte ints

837 views
Skip to first unread message

rupinder virk

unread,
Apr 25, 2017, 7:28:39 AM4/25/17
to StackStorm
I am sending alerts from AlertManager to Stackstorm. The alert is being received by Stackstorm as confirmed from st2api.log. 

I am getting the error "OverflowError: MongoDB can only handle up to 8-byte ints"  in st2rulesengine.log and stackstorm is not triggering the action. The reason is found is the "groupKey" value. 

If I manually change the groupKey value to lower or convert it into String and then post it to the Stackstorm, then everything is fine and Stackstorm triggers the action


JSON sent by AlertManager as shown in st2api.log
-------
INFO hooks [-] 71478fb6-d83f-476e-9a88-530a7ee26f40 - POST /v1/webhooks/sample result={"status": "resolved", "groupLabels": {}, "groupKey": 14695981039346656037, "commonAnnotations": {}, "alerts": [{"status": "resolved", "labels": {"name": "st2", "alertname": "testalert23"}, "endsAt": "2017-04-25T04:14:31.232413895-07:00", "generatorURL": "", "startsAt": "2017-04-25T04:14:26.232413895-07:00", "annotations": {}}], "version": "3", "receiver": "slack_g", "externalURL": "http://ubuntu:9093", "commonLabels": {"name": "st2", "alertname": "testalert23"}} (result='{"status": "resolved", "groupLabels": {}, "groupKey": 14695981039346656037, "commonAnnotations": {}, "alerts": [{"status": "resolved", "labels": {"name": "st2", "alertname": "testalert23"}, "endsAt": "2017-04-25T04:14:31.232413895-07:00", "generatorURL": "", "startsAt": "2017-04-25T04:14:26.232413895-07:00", "annotations": {}}], "version": "3", "receiver": "slack_g", "externalURL": "http://ubuntu:9093", "commonLabels": {"name": "st2", "alertname": "testalert23"}}',request_id='71478fb6-d83f-476e-9a88-530a7ee26f40',status_code='202 Accepted',remote_addr='127.0.0.1',path='/v1/webhooks/sample',method='POST')
----

st2rulesengine.log:
Traceback (most recent call last):
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/transport/consumers.py", line 85, in process
    response = self._handler.pre_ack_process(body)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2reactor/rules/worker.py", line 56, in pre_ack_process
    raise_on_no_trigger=True)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2reactor/container/utils.py", line 80, in create_trigger_instance
    return TriggerInstance.add_or_update(trigger_instance)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/persistence/base.py", line 173, in add_or_update
    model_object = cls._get_impl().add_or_update(model_object)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/models/db/__init__.py", line 313, in add_or_update
    instance.save()
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/mongoengine/document.py", line 340, in save
    object_id = collection.save(doc, **write_concern)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/pymongo/collection.py", line 2445, in save
    check_keys, manipulate, write_concern)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/pymongo/collection.py", line 562, in _insert
    check_keys, manipulate, write_concern, op_id, bypass_doc_val)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/pymongo/collection.py", line 543, in _insert_one
    check_keys=check_keys)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/pymongo/pool.py", line 424, in command
    self._raise_connection_failure(error)
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/pymongo/pool.py", line 552, in _raise_connection_failure
    raise error
OverflowError: MongoDB can only handle up to 8-byte ints
--------------------

Thanks,
Rupinder

Dmitri Zimine

unread,
Apr 25, 2017, 3:13:22 PM4/25/17
to rupinder virk, StackStorm
Yes this is MongoDB limitation, and we record the trigger payload into Mongo, and there’s little the platform can do here.
Your easiest way out is to create your custom webhook based sensor for AlertManager, 
and convert the type in the sensor body.

DZ. 


--
You received this message because you are subscribed to the Google Groups "StackStorm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stackstorm+...@googlegroups.com.
To post to this group, send email to stack...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/stackstorm/dff58995-1caa-4e3d-9268-def71acb21a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages