honeycombio/honeytrigger

Name: honeytrigger

Owner: Honeycomb

Description: CLI for managing honeycomb triggers.

Created: 2018-03-28 22:39:04.0

Updated: 2018-04-12 18:04:01.0

Pushed: 2018-04-12 18:04:00.0

Homepage: http://honeycomb.io

Size: 51

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

honeytrigger

honeytrigger provides a simple interface for managing Honeycomb triggers

Warning: This tool is based upon the experimental Triggers API. It has not been released and is subject to change at any time. Use at your own risk.

Installation
 get github.com/honeycombio/honeytrigger
neytrigger    # (if $GOPATH/bin is in your path.)
Usage

$ honeytrigger -k <your-writekey> -d <dataset> COMMAND [command-specific flags]

Available commands:

| Command | Description | | ——– | ———– | | apply | create/update triggers from a config file | | list | print a list of all trigger names | | export | dump the existing trigger config in JSON format |

Adding and updating triggers (apply)

First, create a config file defining your triggers. If this seems daunting, try creating a trigger you want in the UI and then using the export command to generate the config:


"triggers": [
    {
        "name": "Trigger 1",
        "description": "helpful description of this trigger",
        "frequency": 300,
        "query": {
            "breakdowns": [
                "user",
            ],
            "calculations": [
                {
                    "op": "COUNT"
                }
            ],
            "filters": [
                {
                    "column": "user",
                    "op": "=",
                    "value": "root"
                }
            ]
        },
        "threshold": {
            "op": ">",
            "value": 0
        },
        "recipients": [
            {
                "type": "email",
                "target": "me@example.com"
            }
        ]
    },
    {
        "name": "Trigger 2",
        "description": "something something\nsomething",
        "frequency": 300,
        "query": {
            "breakdowns": [
                "user",
            ],
            "calculations": [
                {
                    "op": "COUNT"
                }
            ],
            "filters": [
                {
                    "column": "user",
                    "op": "!=",
                    "value": "root"
                }
            ]
        },
        "threshold": {
            "op": ">",
            "value": 0
        },
        "recipients": [
            {
                "type": "email",
                "target": "me@example.com"
            }
        ]
    }
]

Triggers that already exist will be updated. Triggers that do not exist will be created. Currently, deleting triggers is not supported.

Example:

honeytrigger -k ${WRITE_KEY} -d mydataset apply -f config.json
ng trigger 'Trigger 2'
ting trigger 'Trigger 1' with id Euex2tHuEuy


Listing triggers (list)

Just print a list of triggers by name.

Example:

honeytrigger list -k ${WRITE_KEY} -d mydataset
ger 1
ger 2



Exporting triggers (export)

You can use this to generate a JSON config suitable for use by apply.

Example:

honeytrigger export -k ${WRITE_KEY} -d mydataset
d":"Euex2tHuEuy","threshold":{"value":0,"op":"\u003e"},"description":"something something something","frequency":300,"name":"Trigger 1","recipients":[{"type":"email","target":"me@example.com"}],"query":{"calculations":[{"op":"COUNT"}],"filters":[{"value":"root","op":"=","column":"user"}],"breakdowns":["user"]}},{"id":"BtFqDeE7SjU","threshold":{"value":0,"op":"\u003e"},"description":"something else","frequency":300,"name":"Trigger 2","recipients":[{"type":"email","target":"me@example.com"}],"query":{"calculations":[{"op":"COUNT"}],"filters":[{"value":"root","op":"!=","column":"user"}],"breakdowns":["user"]}}]



This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.