Skip to content

Available triggers

Lujeni edited this page May 13, 2016 · 12 revisions

Common

  • Same file to configure your triggers: /path/to/setting.py

  • You can easily combine multiple (same) triggers with differents threshold.

  • Common parameters for slow operation check:

    • type (str): the name of type (killer, mongodb, email, webhook...).
    • threshold (int): the threshold in second.
    • state (bool): True if you want trigger this action when a slow operation is found, False otherwhise.
    • params (dict): specific params of the trigger.
  • Common parameters for balancer check:

    • type (str): the trigger type (killer, mongodb, email, webhook...).
    • state (bool): True if you want trigger this action when a the balancer is enabled, False otherwhise (balancer disabled).
    • params (dict): specific params of the trigger.

Actions by check

op nok: find slow operation.

op ok: 0 slow operation.

balancer nok: the balancer state is different from the state settings value.

balancer ok: the balancer state is good.

op nok op ok balancer nok balancer ok
killer X
email X X
mongodb X
sentry X
webhook X X X X
graphite X
mattermost X X X X

Killer

  • Send a signal to mongodb to terminates an operation.
op_triggers:
  foo_killer:
    type: killer
     threshold: 120

Webhook

  • Send a simple HTTP request.

  • parameters:

    • url: The target URL.
    • method: The HTTP method.
  • optionals parameters:

    • http_params: Passing Parameters In URLs (default: {})
    • requests_params: Kwargs of the requests module. (default: {})
op_triggers:
  foo_bar_webhook:
    type: webhook
    state: True
    params:
      method: get
      url: http://requestb.in/17qzafm1
      http_params:
        fizz: buzz
      requests_params:
        verify: False

  foo_bar_webhook:
    type: webhook
    state: False # no slow operation found
    params:
      method: get
      url: http://requestb.in/17qzafm1
      http_params:
        fizz: buzz
        foo: bar
      requests_params:
        verify: False

MongoDB

  • Insert the slow operation in another database through bulk insert.
  • Index is created on the opid field.
  • optionals parameters:
    • database (default: mongoop)
    • collection (default: history)
op_triggers:
  trigger_mongodb_1:
     type: mongodb
     threshold: 5
     state: True
     params:
       database: mongoop
       collection: history

Email

  • Send a simple email.
  • optionals parameters:
    • tls (default: False)
    • auth (default: False)
op_triggers:
   trigger_email_foo:
     type: email
     threshold: 60
     state: True
     params:
       subject: 'Mongoop report'
       from: 'mongoop@localhost'
       to: 'root'
       smtp_host: 'localhost'
       tls: False
       auth:
         user: coconut
         password: 1234

Sentry

  • Trigger to allow message to be submitted via Sentry.
  • You can customize the message with the field name of a slow operation.
  • parameters:
    • ``dsn: The sentry addr.
    • message: The culprit message.
  • optionals parameters:
    • level (default: info)
op_triggers:
   foo_bar_sentry:
     type: sentry
     threshold: 80
     state: True
     params:
       dsn: 'https://898weqe899qweqeq8:wqeqw8888@app.getsentry.com/76885'
       message: 'mongoop slow operation :: {opid}'
       level: info

Graphite

  • Trigger to send metrics throught Graphite/Carbon.
  • parameters:
    • metric_per_ns: Add metric per mongodb namespace.
  • optionals parameters:
    • graphitesend_params: Kwargs of the graphitesend module. (default: {})
op_triggers:
   foo_bar_graphite:
     type: graphite
     threshold: 60
     state: True
     params:
       metric_per_ns: True
       graphitesend_params:
         graphite_server: localhost
         prefix: mongoop
         system_name: cluster_mongodb_1

Sentry

  • Trigger to allow message to be submitted via Sentry.
  • You can customize the message with the field name of a slow operation.
  • parameters:
    • ``dsn: The sentry addr.
    • message: The culprit message.
  • optionals parameters:
    • level (default: info)
op_triggers:
   foo_bar_sentry:
     type: sentry
     threshold: 80
     state: True
     params:
       dsn: 'https://898weqe899qweqeq8:wqeqw8888@app.getsentry.com/76885'
       message: 'mongoop slow operation :: {opid}'
       level: info

Mattermost

op_triggers:
   foo_bar_mattermost:
     type: mattermost
     threshold: 60
     state: True
     params:
       url: https://mattermost.coconut.com
       api_key: dkhjyh7701mh6
       channel: mongoop
       username: Mongoop
       icon_url: https://coconut.com/coco.png