datadog

command module
v0.0.0-...-10331b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 10 Imported by: 0

README

datadog

CLI for Datadog API

Installation

$ go get github.com/vsco/datadog

Ensure $GOPATH/bin is in your $PATH in order to use the binary.

Authorization

In order to successfully use this tool, you will have to provide it a datadog API key and application key. Visit your DatadogHQ account settings to generate a new application key.

Once you have these values, you have two options for configuration: environment variables or a configuration file.

For environment variables, assign your API key to DATADOG_API_KEY and your application key to DATADOG_APP_KEY.

For configuration files, put your API key and app key in a file like:

{
  "api_key": "YOUR_API_KEY",
  "app_key": "YOUR_APP_KEY"
}

The default location for this file is ~/.datadogrc, but you may put it anywhere and tell the CLI about it via a flag: -config=path/to/your/file. It will expand only tildes at the beginning of paths as in the default.

Usage

$ datadog TYPE NAME VALUE

This CLI accepts with two types: increment and gauge. They send a counter or gauge metric to Datadog, respectively.

The name of the metric is identical to the statsd metric name, e.g. vsco.my_metric.

The value must be a float.

Increment
$ datadog increment vsco.my_metric 100

increment can be shortened to incr or i, and one may use counter or c as an alias.

Gauge
$ datadog gauge vsco.my_metric 100

gauge can be shortened to g.

License / Credit

This code is licensed under the MIT License, with credit to Visual Supply Co (VSCO). See LICENSE for more.

Documentation

Overview

A CLI command for sending metrics (and soon events) to DatadogHQ.

To install, just run:

go get github.com/vsco/datadog

and ensure that $GOPATH/bin is in your $PATH. Then, run "datadog".

In order to authenticate with DatadogHQ, you will need to create a JSON file with your api key and app key:

{
    "api_key": "YOUR API KEY",
    "app_key": "YOUR APP KEY"
}

By default, datadog will look at ~/.datadogrc for this information but accepts a -conf flag if this information is elsewhere:

$ datadog -conf="/opt/mycompany/creds/datadogrc"

The command line requires at least 3 arguments: metric type, metric name, and at least one value:

$ datadog increment mycompany.mymetric 101.2

You may list any number of floating point values, which will each be sumitted along with the time of execution as their time of reporting.

Valid metric types are:

  • increment, incr, i, counter, c
  • gauge, g

You can also add tags for your metric. Tagging by environment or DC? No sweat:

$ datadog incr mycompany.temp 98.6 -tags="dc:us-east-1,env:prod"

Lastly, if you don't want to send any data, there is the -dry-run flag.

For more information and default values, run datadog -h

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL