Jump To Top

comment

create(message, properties, callback)

create a new comment

Parameters:

message

the message of the comment

properties

optional, an object containing any of the following

  • handle: the handle to associate the comment with (e.g. "user@domain.com")
  • related_event_id: the event to associate the comment with
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.comment.create("a comment message", function(err, res){
  console.dir(res);
});

update(commentId, message, handle, callback)

update an existing comment

Parameters:

commentId

the id of the comment to update

message

the message of the comment

handle

optional, the handle to associate the comment with (e.g. "user@domain.com")

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.comment.update(1234, "new message", function(err, res){
  console.dir(res);
});

remove(commentId, callback)

remove a comment

Parameters:

commentId

the id of the comment to remove

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.comment.remove(1234, function(err, res){
  console.dir(res);
});

downtime

create(scope, properties, callback)

schedule a new downtime

Parameters:

scope

string scope that the downtime should apply to (e.g. "env:staging")

properties

optional, an object containing any of the following

  • start: POSIX timestamp for when the downtime should start
  • end: POSIX timestamp for when the downtime should end
  • message: a string message to accompany the downtime
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.downtime.create("env:staging", function(err, res){
  console.dir(res);
});

update(downtimeId, properties, callback)

update an existing downtime

Parameters:

downtimeId

the id the downtie to update

properties

optional, an object containing any of the following

  • scope: the scope the downtime should be changed to (e.g. "env:staging")
  • start: POSIX timestamp for when the downtime should start
  • end: POSIX timestamp for when the downtime should end
  • message: a string message to accompany the downtime
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var properties = {
  scope: "env:staging"
};
dogapi.downtime.update(1234, properties, function(err, res){
  console.dir(res);
});

remove(downtimeId, callback)

delete a scheduled downtime

Parameters:

downtimeId

the id of the downtime

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.downtime.remove(1234, function(err, res){
  console.dir(res);
});

get(downtimeId, callback)

get a scheduled downtimes details

Parameters:

downtimeId

the id of the downtime

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.downtime.get(1234, function(err, res){
  console.dir(res);
});

getAll(callback)

get all downtimes details

Parameters:

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.downtime.getAll(function(err, res){
  console.dir(res);
});

embed

create(graph_json, options, options["timeframe"], options["size"], options["legend"], options["title"], callback)

create an embed graph of a metric query

Parameters:

graph_json

The request array to pass create in the embed

options

optional, object of extra parameters to pass to the embed create (see options[*] params)

options["timeframe"]

optional, one of ("1_hour", "4_hours", "1_day", "2_days", and "1_week")

options["size"]

optional, one of ("small", "medium", "large", "xlarge")

options["legend"]

optional, "yes" or "no"

options["title"]

optional, the title of the embed

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var query = "system.cpu.idle{*}";
var graphJSON = {
       viz: "timeseries",
       requests: [
         {
           q: query,
           aggregator: "avg",
           conditional_formats: [],
           type: "area"
         }
       ]
     }
var options = {
    timeframe: "1_hour",
    size: "xlarge",
    legend: "yes",
    title: "my awesome embed"
};
dogapi.embed.create(graphJSON, options, function(err, res){
  console.dir(res);
});

revoke(embedId, callback)

delete an embed with a specific id

Parameters:

embedId

the id of the embed to delete

callback

function(err, res)

var embedid = "foo";
dogapi.embed.revoke(embedid, function(err, res){
  console.dir(res);
});

getAll(callback)

get all embeds from datadog

Parameters:

callback

function(err, res)

dogapi.embed.getAll(function(err, res){
  console.dir(res);
});

get(embedId, callback)

get a single embed

Parameters:

embedId

the id of the embed to get

callback

function(err, res)

var embedId = "foo";
dogapi.embed.get(embedId, function(err, res){
  console.dir(res);
});

event

create(title, text, properties, callback)

create a new event

Parameters:

title

the title of the event

text

the body of the event

properties

an optional object continaing any of the following additional optional properties

  • date_happened: POSIX timestamp of when it happened
  • priority: "normal" or "low" [defualt: "normal"]
  • host: the host name to associate with the event
  • tags: array of "tag:value"'s to associate with the event
  • alert_type: "error", "warning", "info" or "success" [defualt: "info"]
  • aggregation_key: an arbitrary string used to aggregate like events
  • source_type_name: options: "nagios", "hudson", "jenkins", "user", "my apps", "feed", "chef", "puppet", "git", "bitbucket", "fabric", "capistrano"
callback

function(err, res)

 var dogapi = require("dogapi");
 var options = {
   api_key: "api_key",
   app_key: "app_key"
 };
 dogapi.initialize(options);
 var title = "some new event";
 var text = "IT HAPPENED!";
 dogapi.event.create(title, text, function(err, res){
   console.dir(res);
 });
 title = "another event";
 text = "IT HAPPENED AGAIN!";
 var properties = {
   tags: ["some:tag"],
   alert_type: "error"
 };
 dogapi.event.create(title, text, properties, function(err, res){
   console.dir(res);
 });

get(eventId, callback)

get event details from the provided event id

Parameters:

eventId

the id of the event to fetch

callback

function(err, res)

 var dogapi = require("dogapi");
 var options = {
   api_key: "api_key",
   app_key: "app_key"
 };
 dogapi.initialize(options);
 dogapi.event.get(10005, function(err, res){
   console.dir(res);
 });

query(start, end, parameters, callback)

query the event stream

Parameters:

start

POSIX timestamp for start of query

end

POSIX timestamp for end of query

parameters

optional parameters to use for the query

  • priority: "low" or "normal"
  • sources: comma separated list of sources (e.g. "jenkins,user")
  • tags: comma separated list of tags (e.g. "tag:value1,tag:value2")
callback

function(err, res)

 var dogapi = require("dogapi");
 var options = {
   api_key: "api_key",
   app_key: "app_key"
 };
 dogapi.initialize(options);
 var now = parseInt(new Date().getTime() / 1000);
 var then = now - 3600; // an hour ago
 var parameters = {
   tags: "some:tag",
   sources: "jenkins"
 };
 dogapi.event.query(then, now, parameters, function(err, res){
   console.dir(res);
 });

graph

snapshot(query, from, to, eventQuery, callback)

take a snapshot of a metric query

Parameters:

query

the metric query to use for the snapshot

from

POSIX timestamp for the beginning of the query

to

POSIX timestamp for the end of the query

eventQuery

optional, an event query to overlay event bands on the snapshot

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var query = "system.cpu.idle{*}";
var to = dogapi.now();
var from = to - 3600;  // an hour ago
dogapi.graph.snapshot(query, from, to, function(err, res){
  console.dir(res);
});

host

mute(hostname, options, callback)

mute the given host, if it is not already muted

Parameters:

hostname

the hostname of the host to mute

options

optional, an object containing any of the following

  • end: POSIX timestamp for when the mute should end
  • override: whether or not to override the end for an existing mute
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.host.mute("my.host.name", function(err, res){
  console.dir(res);
});

unmute(hostname, callback)

unmute the given host, if it is not already unmuted

Parameters:

hostname

the hostname of the host to unmute

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.host.unmute("my.host.name", function(err, res){
  console.dir(res);
});

infrastructure

metric

send(metric, points, extra, callback)

submit a new metric

Parameters:

metric

the metric name

points

a single data point (e.g. 50), an array of data points (e.g. [50, 100]) or an array of [timestamp, value] elements (e.g. [[now, 50], [now, 100]])

extra

optional, object which can contain the following keys

  • host: the host source of the metric
  • tags: array of "tag:value"'s to use for the metric
  • metric_type|type: which metric type to use ("gauge" or "count") [default: gauge]
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.metric.send("my.metric", 1000, function(err, results){
  console.dir(results);
});
dogapi.metric.send("my.metric", [500, 1000], function(err, results){
  console.dir(results);
});
var now = parseInt(new Date().getTime() / 1000);
dogapi.metric.send("my.metric", [[now, 1000]], function(err, results){
  console.dir(results);
});
dogapi.metric.send("my.counter", 5, {type: "count"}, function(err, results){
  console.dir(results);
});

send_all(metrics, callback)

send a list of metrics

Parameters:

metrics

an array of metrics where each element is an object with the following keys

  • metric: the name of the metric
  • points: a single data point (e.g. 50), an array of data points (e.g. [50, 100]) or an array of [timestamp, value] elements (e.g. [[now, 50], [now, 100]])
  • tags: an array of "tag:value"'s
  • host: the source hostname to use for the metrics
  • metric_type|type: the type of metric to use ("gauge" or "count") [default: gauge]
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var now = parseInt(new Date().getTime() / 1000);
var metrics = [
  {
    metric: "my.metric",
    points: [[now, 1000]],
    tags: ["tag:value"]
  },
  {
    metric: "another.metric",
    points: [50, 1000]
  },
  {
    metric: "another.metric",
    points: 1000
  }
];
dogapi.metric.send_all(metrics, function(err, results){
  console.dir(results);
});

query(from, to, query, callback)

make a metric query

Parameters:

from

POSIX timestamp for start of query

to

POSIX timestamp for end of query

query

the string query to perform (e.g. "system.cpu.idle{*}by{host}")

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var now = parseInt(new Date().getTime() / 1000);
var then = now - 3600; // one hour ago
var query = "system.cpu.idle{*}by{host}";
dogapi.metric.query(then, now, query, function(err, res){
  console.dir(res);
});

monitor

create(type, query, properties, callback)

create a new monitor

Parameters:

type

one of "metric alert" or "service check"

query

the monitor query to use, you probably want to read datadog's monitor create docs

properties

optional, an object containing any of the following

  • name: the name of the monitor
  • message: the message for the monitor
  • tags: a list of strings as tags to associate with the monitor
  • options: an object, to see available options please see the monitor create docs
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var metricType = "metric alert";
var query = "avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100";
dogapi.monitor.create(metricType, query, function(err, res){
  console.dir(res);
});

get(monitorId, groupStates, callback)

get an existing monitor's details

Parameters:

monitorId

the id of the monitor

groupStates

an array containing any of the following "all", "alert", "warn", or "no data"

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.monitor.get(1234, function(err, res){
  console.dir(res);
});

getAll(options, callback)

get all monitors

Parameters:

options

optional, an object containing any of the following

  • group_states: an array containing any of the following "all", "alert", "warn", or "no data"
  • tags: an array of "tag:value"'s to filter on
  • monitor_tags: a comma separated list indicating what service and/or custom tags
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.monitor.getAll(function(err, res){
  console.dir(res);
});

update(monitorId, query, properties, callback)

update a monitor's details

Parameters:

monitorId

the id of the monitor to edit

query

the query that the monitor should have, see the monitor create docs for more info

properties

optional, an object containing any of the following

  • name: the name of the monitor
  • message: the message for the monitor
  • tags: a list of strings as tags to associate with the monitor
  • options: an object, to see available options please see the monitor create docs
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var query = "avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100";
dogapi.monitor.update(1234, query, function(err, res){
  console.dir(res);
});

remove(monitorId, callback)

delete an existing monitor

Parameters:

monitorId

the id of the monitor to remove

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.monitor.remove(1234, function(err, res){
  console.dir(res);
});

mute(monitorId, options, callback)

mute an existing monitor

Parameters:

monitorId

the id of the monitor to mute

options

optional, an object containing any of the following

  • scope: the scope to mute (e.g. "role:db")
  • end: POSIX timestamp indicating when the mute should end
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.monitor.mute(1234, function(err, res){
  console.dir(res);
});

muteAll(callback)

mute all monitors

Parameters:

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.monitor.muteAll(function(err, res){
  console.dir(res);
});

unmute(monitorId, scope, callback)

unmute an existing monitor

Parameters:

monitorId

the id of the monitor to unmute

scope

optional, a scope to apply the unmute to (e.g. "role:db")

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.monitor.unmute(1234, function(err, res){
  console.dir(res);
});

unmuteAll(callback)

unmute all monitors

Parameters:

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.monitor.unmuteAll(function(err, res){
  console.dir(res);
});

screenboard

create(boardTitle, widgets, options, callback)

create a new screenboard

Parameters:

boardTitle

the name of the screenboard

widgets

an array of widgets, see http://docs.datadoghq.com/api/screenboards/ for more info

options

optional, a object which can contain any of the following keys

  • description: description of the screenboard
  • templateVariables: | an array of objects with the following keys
    • name: the name of the variable
    • prefix: optional, the tag prefix for this variable
    • default: optional, the default value for this tag
  • width: the width of the screenboard in pixels
  • height: the height of the screenboard in pixels
  • readOnly: the read-only status of the screenboard
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var boardTitle = "my screenboard";
var widgets = [
  {
    type: "image",
    height: 20,
    width: 32,
    y: 7,
    x: 32,
    url: "https://path/to/image.jpg"
  }
];
var options = {
  templateVariables: [
    {
      name: "host1",
      prefix: "host",
      "default": "host:my-host"
    }
  ],
  description: "it is super awesome"
};
dogapi.screenboard.create(
  boardTitle, widgets, options,
  function(err, res){
    console.dir(res);
  }
);

update(boardId, boardTitle, widgets, options, callback)

update an existing screenboard

Parameters:

boardId

the id of the screenboard to update

boardTitle

the name of the screenboard

widgets

an array of widgets, see http://docs.datadoghq.com/api/screenboards/ for more info

options

optional, a object which can contain any of the following keys

  • description: description of the screenboard
  • templateVariables: | an array of objects with the following keys
    • name: the name of the variable
    • prefix: optional, the tag prefix for this variable
    • default: optional, the default value for this tag
  • width: the width of the screenboard in pixels
  • height: the height of the screenboard in pixels
  • readOnly: the read-only status of the screenboard
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var boardTitle = "my screenboard";
var widgets = [
  {
    type: "image",
    height: 20,
    width: 32,
    y: 7,
    x: 32,
    url: "https://path/to/image.jpg"
  }
];
var options = {
  description: "it is super awesome"
};
dogapi.screenboard.update(
  1234, boardTitle, widgets, options,
  function(err, res){
    console.dir(res);
  }
);

remove(boardId, callback)

delete an existing screenboard

Parameters:

boardId

the id of the screenboard to delete

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.screenboard.remove(1234, function(err, res){
  console.dir(res);
});

get(boardId, callback)

get the info of a single existing screenboard

Parameters:

boardId

the id of the screenboard to fetch

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.screenboard.get(1234, function(err, res){
  console.dir(res);
});

getAll(callback)

get all existing screenboards

Parameters:

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.screenboard.getAll(function(err, res){
  console.dir(res);
});

share(boardId, callback)

share an existing screenboard

Parameters:

boardId

the id of the screenboard to share

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.screenboard.share(1234, function(err, res){
  console.dir(res);
});

serviceCheck

check(check, hostName, status, parameters, callback)

post an update to a service check

Parameters:

check

the check name (e.g. "app.ok")

hostName

the name of the host submitting the check

status

one of dogapi.OK, dogapi.WARNING, dogapi.CRITICAL or dogapi.UNKNOWN

parameters

optional, an object containing any of the following

  • timestamp: POSIX timestamp for when the check happened
  • message: string message to accompany the check
  • tags: an array of "tag:value"'s associated with the check
callback

function(err, res)

 var dogapi = require("dogapi");
 var options = {
   api_key: "api_key",
   app_key: "app_key"
 };
 dogapi.initialize(options);
 var check = "app.ok";
 var hostName = "some.machine";
 dogapi.serviceCheck.check(
   check, hostName, dogapi.WARNING, function(err, res){
     console.dir(res);
 });

tag

getAll(source, callback)

get all host tags

Parameters:

source

optional, only show tags for a particular source [default: null]

callback

function callback(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.tag.getAll(function(err, results){
  console.dir(results);
});

get(hostname, options, callback)

get the host tags for a provided host name or host id

Parameters:

hostname

the hostname or host id

options

optional, an object of options for the query allowing the following

  • source: the source of the tags (e.g. chef, puppet, users, etc) [default: null]
  • by_source: whether or not to group the results by source [default: false]
callback

function callback(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.tag.get("host.name", function(err, results){
  console.dir(results);
});

create(hostname, tags, source, callback)

assign new host tags to the provided host name or host id

Parameters:

hostname

the hostname or host id

tags

list of <tag>:<value> tags to assign to the server

source

optional, the source of the tags (e.g. chef, puppet, etc) [default: users]

callback

function callback(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.tag.create("host.name", ["role:webserver"], function(err, results){
  console.dir(results);
});

update(hostname, tags, source, callback)

update the host tags for the provided host name or host id

Parameters:

hostname

the hostname or host id

tags

list of <tag>:<value> tags to assign to the server

source

optional, the source of the tags (e.g. chef, puppet, etc) [default: users]

callback

function callback(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.tag.update("host.name", function(err, results){
  console.dir(results);
});

remove(hostname, source, callback)

delete the host tags for the provided host name or host id

Parameters:

hostname

the hostname or host id

source

optional, the source of the tags (e.g. chef, puppet, etc) [default: users]

callback

function callback(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.tag.remove("host.name", function(err, results){
  console.dir(results);
});

timeboard

create(title, description, graphs, templateVariables, callback)

add a new timeboard

Parameters:

title

the title of the timeboard

description

the description of the timeboard

graphs

an array of objects with the following keys

  • title: the name of the graph
  • definition: an object containing the graph definition, e.g. {"requests": [{"q": "system.cpu.idle{*} by {host}"}
templateVariables

optional, an array of objects with the following keys

  • name: the name of the variable
  • prefix: optional, the tag prefix for this variable
  • default: optional, the default value for this tag
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var title = "Time Keeps on Slipping";
var description = "Into the Future";
var graphs = [
  {
    definition: {
      events: [],
      requests: [
        {q: "avg:system.mem.free{*}"}
      ],
      viz: "timeseries"
    },
    title: "Average Memory Free"
  }
];
var templateVariables = [
  {
    name: "host1",
    prefix: "host",
    "default": "host:my-host"
  }
];
dogapi.timeboard.create(
  title, description, graphs, templateVariables,
  function(err, res){
    console.dir(res);
  }
);

update(dashId, title, description, graphs, templateVariables, callback)

update an existing timeboard

Parameters:

dashId

the id of the timeboard to update

title

the title of the timeboard

description

the description of the timeboard

graphs

an array of objects with the following keys

  • title: the name of the graph
  • definition: an object containing the graph definition, e.g. {"requests": [{"q": "system.cpu.idle{*} by {host}"}
templateVariables

optional, an array of objects with the following keys

  • name: the name of the variable
  • prefix: optional, the tag prefix for this variable
  • default: optional, the default value for this tag
callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var title = "Time Keeps on Slipping";
var description = "Into the Future";
var graphs = [
  {
    definition: {
      events: [],
      requests: [
        {q: "avg:system.mem.free{*}"}
      ],
      viz: "timeseries"
    },
    title: "Average Memory Free"
  }
];
var templateVariables = [
  {
    name: "host1",
    prefix: "host",
    default: "host:my-host"
  }
];
dogapi.timeboard.update(
  1234, title, description, graphs, templateVariables,
  function(err, res){
    console.dir(res);
  }
);

remove(dashId, callback)

remove an existing timeboard

Parameters:

dashId

the id of the timeboard to remove

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.timeboard.remove(1234, function(err, res){
  console.dir(res);
});

getAll(callback)

get all existing timeboards

Parameters:

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.timeboard.getAll(1234, function(err, res){
  console.dir(res);
});

get(dashId, callback)

get an existing timeboard

Parameters:

dashId

the id of the timeboard to get

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.timeboard.get(1234, function(err, res){
  console.dir(res);
});

user

invite(emails, callback)

invite users via e-mail

Parameters:

emails

an array of email addresses to send invites to

callback

function(err, res)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
var emails = ["me@domain.com", "you@domain.com"];
dogapi.user.invite(emails, fuction(err, res){
  console.dir(res):
});

client

client()

the constructor for client object

request(method, path, params, callback)

used to make a raw request to the datadog api

Parameters:

method

http method GET, POST, PUT, DELETE

path

the api url path e.g. /tags/hosts

params

an object which allows the keys query or body

callback

function to call on success/failure callback(err, result)

var dogapi = require("dogapi");
var options = {
  api_key: "api_key",
  app_key: "app_key"
};
dogapi.initialize(options);
dogapi.client.request("GET", "/url/path", {}, function(err, results){
  console.dir(results);
});

dogapi

initialize(options)

configure the dogapi client with your app/api keys

Parameters:

options

An object which allows you to override the default set parameters for interacting with the datadog api. The available options are.

  • api_key: your api key
  • app_key: your app key
  • api_version: the version of the api [default: v1]
  • api_host: the host to call [default: api.datadoghq.com]
  • proxy_agent: Optional, A Https Proxy agent.
var dogapi = require("dogapi");

// Optional for Proxy -------8<----------
// Code from http://blog.vanamco.com/proxy-requests-in-node-js/
var HttpsProxyAgent = require("./httpsproxyagent");

var agent = new HttpsProxyAgent({
    proxyHost: "MY_PROXY_HOST",
    proxyPort: 3128
});
// Optional for Proxy -------->8----------

var options = {
  api_key: "<API_KEY_HERE>",
  app_key: "<APP_KEY_HERE>",
  proxy_agent: agent  // Optional for Proxy
};
dogapi.initialize(options);
dogapi.event.create(...);

now()

get the current POSIX timestamp

var dogapi = require("dogapi");
dogapi.now();
// this is the same as
parseInt(new Date().getTime() / 1000);
Fork me on GitHub